www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Shared library ld issue?

reply "Mineko" <uminekorox gmail.com> writes:
So, these are the commands I put in:
../gdc/x86_64/gdc -c -fPIC -B ../gdc/x86_64 -I 
../gdc/x86_64/phobos test.d
This one worked fine, as expected.

The problem is here:
../gdc/x86_64/gdc -lgphobos2 -shared -B ../gdc/x86_64 test.o -o 
test.so

And this is what the problem outputs:
ld: /lib/../lib64/libgphobos2.a(minfo.o): relocation R_X86_64_32 
against `_D32TypeInfo_APxS6object10ModuleInfo6__initZ' can not be 
used when making a shared object; recompile with -fPIC
/lib/../lib64/libgphobos2.a: error adding symbols: Bad value

I'm obviously compiling with -fPIC.

I've been googling this for hours straight and still don't know 
what to do, perhaps someone here could impart on me some 
knowledge?
Dec 29 2013
parent reply "Mineko" <uminekorox gmail.com> writes:
I also get another strange error I can't solve, whenever I 
compile something with GDC without the standard library 
(-nostdlib) I get this whenever I try to access the shared 
library. (like the above but without libgphobos, with nostdlib 
instead)

undefined symbol: _Dmodule_ref

Any ideas?
Dec 29 2013
parent reply "Dicebot" <public dicebot.lv> writes:
AFAIK shared libraries are not yet supported by GDC / LDC, at 
least not as supported as in DMD.
Dec 29 2013
parent "Mineko" <uminekorox gmail.com> writes:
On Sunday, 29 December 2013 at 16:06:51 UTC, Dicebot wrote:
 AFAIK shared libraries are not yet supported by GDC / LDC, at 
 least not as supported as in DMD.
Thank you, at least now I know I mainly wasted my time, and can now move on to other ideas. Although I got some interesting stuff working with GDC for the most part, but yeah, as you say, it's not nearly as supported as DMD.
Dec 29 2013