Ali Çehreli wrote: > Jonathan M Davis wrote: >> With gcc, you can pass it the -static flag and it will statically link >> everything. Normally, with dmd (on linux at least), it dynamically links >> all of the C/C++ libraries that it uses. So, if I run ldd (well, ldd32 >> technically) on one of my programs I get: >> >> linux-gate.so.1 => (0xf7794000) >> libpthread.so.0 => /lib32/libpthread.so.0 (0xf7756000) >> libm.so.6 => /lib32/libm.so.6 (0xf7730000) >> libc.so.6 => /lib32/libc.so.6 (0xf75ea000) >> /lib32/ld-linux.so.2 (0xf7795000) >> >> If it were gcc and -static had been used, you'd get >> >> not a dynamic executable >> >> I'd like to be able to do the equivalent of -static with dmd so that my >> dmd- generated binaries don't have to link against any of the C/C++ >> libraries on my system. Is there a way to do that? I can't see any. >> Certainly, none of dmd's options appear to give that kind of >> functionality. So, if there is a way to do it, I'd like to know how. Does >> anyone here know how? >> >> - Jonathan M Davis > > A friend hit the same problem recently and I was able to achieve it by > performing the linking step with gcc. > > 1) Compile with dmd: > > dmd -c deneme.d -ofdeneme.o > > 2) Link with gcc: > > gcc deneme.o -static -o deneme ~/dmd/linux/lib/libphobos2.a -lpthread > > Worked with my simple test application. > > Ali
Thanks! That seems to have done the trick. It's a pity that it doesn't appear to be doable with dmd directly though. I should probably create an issue for it on the bug tracker. - Jonathan M Davis
