Thread overview
Shared library ld issue?
Dec 29, 2013
Mineko
Dec 29, 2013
Mineko
Dec 29, 2013
Dicebot
Dec 29, 2013
Mineko
December 29, 2013
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?
December 29, 2013
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?
December 29, 2013
AFAIK shared libraries are not yet supported by GDC / LDC, at least not as supported as in DMD.
December 29, 2013
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.