Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 03, 2014 Dub shared library issue | ||||
---|---|---|---|---|
| ||||
So, I can get a shared library compiled normally (Assuming it's already compiled first with -shared -fPIC etc) with: dmd -of'Breaker Engine.so' 'Breaker Engine.o' -shared -defaultlib=libphobos2.so -L-rpath=$PWD However, for some reason dub is having issues whenever I try to compile it as a shared library with dynamicLibrary. Any suggestions? I'd like to get this fixed because otherwise there's gonna be portability problems.. |
January 03, 2014 Re: Dub shared library issue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mineko | On Friday, 3 January 2014 at 15:01:16 UTC, Mineko wrote:
> So, I can get a shared library compiled normally (Assuming it's already compiled first with -shared -fPIC etc) with: dmd -of'Breaker Engine.so' 'Breaker Engine.o' -shared -defaultlib=libphobos2.so -L-rpath=$PWD
>
> However, for some reason dub is having issues whenever I try to compile it as a shared library with dynamicLibrary.
>
> Any suggestions? I'd like to get this fixed because otherwise there's gonna be portability problems..
Could you provide some error message / output, and your package.json ?
|
January 03, 2014 Re: Dub shared library issue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | On Friday, 3 January 2014 at 15:03:27 UTC, Mathias LANG wrote: > On Friday, 3 January 2014 at 15:01:16 UTC, Mineko wrote: >> So, I can get a shared library compiled normally (Assuming it's already compiled first with -shared -fPIC etc) with: dmd -of'Breaker Engine.so' 'Breaker Engine.o' -shared -defaultlib=libphobos2.so -L-rpath=$PWD >> >> However, for some reason dub is having issues whenever I try to compile it as a shared library with dynamicLibrary. >> >> Any suggestions? I'd like to get this fixed because otherwise there's gonna be portability problems.. > > Could you provide some error message / output, and your package.json ? Sure, I thought I was missing some info.. Linking... dmd -of.dub/build/library-debug-x86_64-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/libbreaker.so .dub/build/library-debug-x86_64-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/breaker.o -L-ldl -shared -g /usr/bin/ld: /usr/lib/libphobos2.a(object__a_58c.o): relocation R_X86_64_32 against `_D10TypeInfo_m6__initZ' can not be used when making a shared object; recompile with -fPIC /usr/lib/libphobos2.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status { "name": "breaker-engine", "description": "A multi-dimensional engine with a stupid amount of modularity", "homepage": "https://github.com/ICGCC/Breaker-Engine", "license": "Zlib", "author": "Jakob Austin Wimberly (Mineko)", "targetName": "breaker", "targetPath": "lib", "targetType": "dynamicLibrary", "dependencies": { "gl3n": "~master", "derelict-gl3": "~master", "derelict-glfw3": "~master", "derelict-fi": "~master" } } |
January 03, 2014 Re: Dub shared library issue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mineko | On Friday, 3 January 2014 at 15:10:54 UTC, Mineko wrote: > On Friday, 3 January 2014 at 15:03:27 UTC, Mathias LANG wrote: >> On Friday, 3 January 2014 at 15:01:16 UTC, Mineko wrote: >>> So, I can get a shared library compiled normally (Assuming it's already compiled first with -shared -fPIC etc) with: dmd -of'Breaker Engine.so' 'Breaker Engine.o' -shared -defaultlib=libphobos2.so -L-rpath=$PWD >>> >>> However, for some reason dub is having issues whenever I try to compile it as a shared library with dynamicLibrary. >>> >>> Any suggestions? I'd like to get this fixed because otherwise there's gonna be portability problems.. >> >> Could you provide some error message / output, and your package.json ? > > Sure, I thought I was missing some info.. > > Linking... > dmd -of.dub/build/library-debug-x86_64-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/libbreaker.so .dub/build/library-debug-x86_64-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/breaker.o -L-ldl -shared -g > /usr/bin/ld: /usr/lib/libphobos2.a(object__a_58c.o): relocation R_X86_64_32 against `_D10TypeInfo_m6__initZ' can not be used when making a shared object; recompile with -fPIC > /usr/lib/libphobos2.a: error adding symbols: Bad value > collect2: error: ld returned 1 exit status > > { > "name": "breaker-engine", > "description": "A multi-dimensional engine with a stupid amount of modularity", > "homepage": "https://github.com/ICGCC/Breaker-Engine", > "license": "Zlib", > "author": "Jakob Austin Wimberly (Mineko)", > > "targetName": "breaker", > "targetPath": "lib", > "targetType": "dynamicLibrary", > > "dependencies": > { > "gl3n": "~master", > "derelict-gl3": "~master", > "derelict-glfw3": "~master", > "derelict-fi": "~master" > } > } Add this to your package.json: "libs": [ "phobos2" ] I also added: "lflags": [ "-rpath=/home/xxxx/bin/dmd-2.064.2/linux/lib64/" ], for myself, as my dmd is in ~/bin/, but you shouldn't need it if you installed the package. |
January 03, 2014 Re: Dub shared library issue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | ""libs": [ "phobos2" ]" worked perfectly, thank you so much. :) |
Copyright © 1999-2021 by the D Language Foundation