You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You're probably already aware of it, but search didn't prompt anything so I'm opening a new issue.
Simple use case: dub init testlib
Go into teslib, edit dub.json to add "targetType": "dynamicLibrary" and change app.d main() to test().
Then run dub, and:
geod@Barsoom:~/testlib$ \dub build --compiler=gdc-4.9 --force
testlib: ["testlib"]
Building testlib configuration "library", build type debug.
Running gdc-4.9...
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/libgphobos2.a(object_.o): relocation R_X86_64_32S against `_D10TypeInfo_m6__initZ' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.9/libgphobos2.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
FAIL .dub/build/library-debug-linux.posix-x86_64-gdc-4.9-EDE7316C4CF9D54D3D6146C2770BD5A3 testlib dynamicLibrary
Error executing command build: GDC compile run failed with exit code 1
geod@Barsoom:~/testlib$ \dub build --force
testlib: ["testlib"]
Building testlib configuration "library", build type debug.
Compiling...
Linking...
/usr/bin/ld: .dub/build/library-debug-linux.posix-x86_64-dmd-F0AFF9EF6E22D753597E009158EE6446/testlib.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
.dub/build/library-debug-linux.posix-x86_64-dmd-F0AFF9EF6E22D753597E009158EE6446/testlib.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
--- errorlevel 1
FAIL .dub/build/library-debug-linux.posix-x86_64-dmd-F0AFF9EF6E22D753597E009158EE6446 testlib dynamicLibrary
Error executing command build: Link command failed with exit code 1
Note that this is not a dub bug IMO. To work around this issue, one can use: dmd app.d -fPIC -shared -oftest.so -defaultlib=libphobos2.so
OR gdc app.d -fPIC -shared -o test.so -nodefaultlibs -lphobos2
The text was updated successfully, but these errors were encountered:
You're probably already aware of it, but search didn't prompt anything so I'm opening a new issue.
Simple use case:
dub init testlib
Go into
teslib
, edit dub.json to add"targetType": "dynamicLibrary"
and change app.d main() to test().Then run dub, and:
Note that this is not a dub bug IMO. To work around this issue, one can use:
dmd app.d -fPIC -shared -oftest.so -defaultlib=libphobos2.so
OR
gdc app.d -fPIC -shared -o test.so -nodefaultlibs -lphobos2
The text was updated successfully, but these errors were encountered: