The following is a project created by dub init
.
dub.json
{
"authors": [
"john"
],
"dependencies": {
"squiz-box": {
"repository": "git+https://github.com/rtbo/squiz-box.git",
"version": "6a10caaa01f7cefbe83c65b5a939bee2e0296250"
}
},
"description": "Demo program",
"license": "BSD 2 clause",
"name": "gdc_curl"
}
app.d
import std.net.curl : get, download;
import squiz_box;
void main()
{
immutable jsonURL = "https://ziglang.org/download/index.json";
auto jsonStr = get(jsonURL);
}
squiz_box
is a dlang library for compression and decompression.
I am able to compile this ldc2
and dmd
, but not gdc
. The error appears to be related to the line import squiz_box
, removing of which causes the program to compile successfully, as the main
function doesn't call the squiz_box
library at all.
dub build --compiler=gdc --verbose
Using dub registry url 'https://code.dlang.org/'
Note: Failed to determine version of package gdc_curl at .. Assuming ~master.
Version selection for dependency squiz-box (squiz-box) of gdc_curl is missing.
Scanning local packages...
Determined package version using GIT: squiz-box 0.2.1+commit.51.ga962211
Determined package version using GIT: squiz-box 0.2.1+commit.87.gf0ba9db
Determined package version using GIT: squiz-box 0.3.0+commit.15.g6a10caa
Found dependency squiz-box git+https://github.com/rtbo/squiz-box.git
Generating using build
Configuring dependent gdc_curl, deps:"squiz-box"
Configuring dependent squiz-box, deps:
Starting Performing "debug" build using gdc for x86_64.
Up-to-date squiz-box 0.3.0+commit.15.g6a10caa: target for configuration [library] is up to date.
Using existing build in /home/john/.dub/cache/squiz-box/0.3.0+commit.15.g6a10caa/build/library-debug-8Bi8iTVskbYwwEp3wicUsw.
Copying target from /home/john/.dub/cache/squiz-box/0.3.0+commit.15.g6a10caa/build/library-debug-8Bi8iTVskbYwwEp3wicUsw/libsquiz-box.a to /home/john/.dub/packages/squiz-box/6a10caaa01f7cefbe83c65b5a939bee2e0296250/squiz-box
Target '/home/john/.dub/cache/gdc_curl/~master/build/application-debug-G0CAYx5HyZ1UeOgA779Diw/gdc_curl' doesn't exist, need rebuild.
Building gdc_curl ~master: building configuration [application]
Using pkg-config to resolve library flags for liblzma, libzstd.
Using direct -l... flags for bz2.
gdc -o /home/john/.dub/cache/gdc_curl/~master/build/application-debug-G0CAYx5HyZ1UeOgA779Diw/gdc_curl -fdebug -g -Werror -Wall -fversion=Have_gdc_curl -fversion=Have_squiz_box -fversion=HaveSquizBzip2 -fversion=HaveSquizLzma -fversion=HaveSquizZstandard -Isource/ -I/home/john/.dub/packages/squiz-box/6a10caaa01f7cefbe83c65b5a939bee2e0296250/squiz-box/src/ source/app.d /home/john/.dub/cache/squiz-box/0.3.0+commit.15.g6a10caa/build/library-debug-8Bi8iTVskbYwwEp3wicUsw/libsquiz-box.a -lbz2 -Xlinker -llzma -Xlinker -lzstd
/usr/bin/ld: /tmp/ccPUp96p.o: in function `_D3std6format8internal5write__T8getWidthTAyaZQoFNaNfQlZl':
/usr/lib/gcc/x86_64-redhat-linux/13/include/d/std/format/internal/write.d:3639: undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T8getWidthTAyaZQoFQhZ9__lambda2Z__TQCpTQBcZQCxMFNaNfQBpZb'
/usr/bin/ld: /tmp/ccPUp96p.o: in function `_D3std6format8internal5write__T20formatValueImplUlongTSQCb5array__T8AppenderTAyaZQoTaZQCdFNaNfKQBpmIbMKxSQDzQDy4spec__T10FormatSpecTaZQpZv':
/usr/lib/gcc/x86_64-redhat-linux/13/include/d/std/format/internal/write.d:262: undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T20formatValueImplUlongTSQDg5array__T8AppenderTAyaZQoTaZQCdFKQBlmIbMKxSQFaQDu4spec__T10FormatSpecTaZQpZ10__lambda16Z__TQFvTAaZQGcMFNaNfQmZb'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/include/d/std/format/internal/write.d:268: undefined reference to `_D3std9algorithm9searching__T3allSQBg6format8internal5write__T20formatValueImplUlongTSQDg5array__T8AppenderTAyaZQoTaZQCdFKQBlmIbMKxSQFaQDu4spec__T10FormatSpecTaZQpZ10__lambda17Z__TQFvTAaZQGcMFNaNfQmZb'
collect2: error: ld returned 1 exit status
FAIL /home/john/.dub/cache/gdc_curl/~master/build/application-debug-G0CAYx5HyZ1UeOgA779Diw gdc_curl executable
Error gdc failed with exit code 1.
I cannot figure out this error is caused by squiz_box
libray, gdc
or dub
. My apologies to you if I should have filed this bug in other places. Thanks for your attention.