Thank you for your quick help, that was it.

I do (or at least I'm trying to do) hobbyist D programming as you guys, that's why I come here to cry at Sunday evening. :)

Ok, I'm almost there. It builds with DUB/DMD, I can allocate stuff on the heap, so far so good. But if I invoke:

dub --compiler=gdc

then I got:

Performing main compilation...
dub build "node-d-sample" --arch=x86_64 --compiler=gdc "--build=release" Building package node-d-sample in /home/gabor/sandbox/node-d-sample/ Building node-d-sample ~master configuration "library", build type release.
Running gdc...
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/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 /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-release-linux.posix-x86_64-gdc_2065-33A38D9D3DC714C1501A18C957A2B35B/ node-d-sample dynamicLibrary
Error executing command build: gdc failed with exit code 1.

Exit code 2
Build complete -- 1 error, 0 warnings

or:

dub --compiler=ldmd2

then I got:

Performing main compilation...
dub build "node-d-sample" --arch=x86_64 --compiler=ldmd2 "--build=release" The determined compiler type "ldc" doesn't match the expected type "dmd". This will probably result in build errors. Building package node-d-sample in /home/gabor/sandbox/node-d-sample/ Building node-d-sample ~master configuration "library", build type release.
Running ldmd2...
/usr/bin/ld: /home/gabor/dev/ldc2-0.15.0-beta1-linux-x86_64/bin/../lib/libdruntime-ldc.a(eh.o): relocation R_X86_64_32 against `.rodata..str1' can not be used when making a shared object; recompile with -fPIC /home/gabor/dev/ldc2-0.15.0-beta1-linux-x86_64/bin/../lib/libdruntime-ldc.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1
FAIL .dub/build/library-release-linux.posix-x86_64-ldc_2066-212B345732639D80C27025028ED586A2/ node-d-sample dynamicLibrary
Error executing command build: ldmd2 failed with exit code 1.

Exit code 2
Build complete -- 1 error, 0 warnings

It seems DUB somehow eats dflags away for non DMD compilers. How the hell should I prevent this happen? Thanks.

Reply via email to