dub
dub copied to clipboard
relocation R_X86_64_32 against `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
seems a bit different from https://github.com/dlang/dub/issues/352
dub.json:
{
"name": "foo",
"targetType": "dynamicLibrary",
// doesn't help: "dflags": ["-fPIC"],
"targetPath":"$build_D",
"authors": ["foo" ],
"description": "foo",
"copyright": "foo",
"dependencies": {
"msgpack-rpc": "~>0.1.2",
},
"license": "proprietary"
}
source/app.d: void test(){import msgpackrpc;}
dub -v --force :
/usr/bin/ld: ../../../.dub/packages/msgpack-rpc-0.1.2/msgpack-rpc/libmsgpack-rpc.a(package.o): relocation R_X86_64_32 against `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
../../../.dub/packages/msgpack-rpc-0.1.2/msgpack-rpc/libmsgpack-rpc.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
AFAIR this error means that dmd and phobos got out of sync on your installation.
It builds fine for me (Linux x64), except that what should presumably be symbolic links (libphobos2.so -> libphobos2.so.0.71.1) were text files in my DVM based DMD installation.
Using fresh dub/dmd/libphobos installed from Manjaro x64 package manager these errors happen.
dub init somename -t vibe.d dub build
https://dpaste.de/SOSA/raw
EDIT: it was caused by hardening-wrapper, removing it fixes build. http://stackoverflow.com/a/32170761
Also happens with:
- libmir (from git 4193f3bdbdd2150c3c407ba5194b6e265b1d2f61)
- dproto-2.1.0
Linking...
/usr/bin/ld: ../../.dub/packages/dproto-2.1.0/dproto/libdproto.a(attributes.o): relocation R_X86_64_32 against `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
../../.dub/packages/dproto-2.1.0/dproto/libdproto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Linking...
/usr/bin/ld: /home/timothee/git_clone/mir//libmir.a(selection.o): relocation R_X86_64_32 against `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC
/home/timothee/git_clone/mir//libmir.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
--- errorlevel 1
dmd failed with exit code 1.
maybe @msoucy has some idea on the dproto package?
Can't say I've ever seen that before, sorry
could this explain?
dub build --config=config_with_shared_lib --compiler=path_to_dmd_that_has_shared_libphobos
Dynamic libraries are not yet supported as dependencies - building as static library.
Are dynamic libraries even supported at all via dub? If not what would need to be changed? I really need to build some shared library so it can be dlopen'd inside another C++ application
Maybe related: https://github.com/dlang/dub/issues/571 https://github.com/dlang/dub/pull/821 https://github.com/dlang/dub/issues/629 https://github.com/dlang/dub/issues/613 https://github.com/dlang/dub/issues/591 https://github.com/dlang/dub/issues/571
http://forum.dlang.org/post/[email protected] : Dub shared library issue
This should be solved now, can we close?