Robert Clipsham wrote:
I've been wanting to try D2 properly for a while now, but as I use linux x86-64 I've had to resort to using a virtual machine, which is really off putting when I just want to play around with it. I've read multiple threads about getting dmd working with a multilib system, but I still can't get it working, here's what I've tried:

test.d:
import std.stdio;

void main()
{
        writeln( "Hello World!" );
}

% dmd -v test.d
-- snip --
gcc test.o -o test -m32 -Xlinker -L./../lib -lphobos2 -lpthread -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.so when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.a when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: cannot find -lpthread
collect2: ld returned 1 exit status
--- errorlevel 1

I have a 32 bit version of libpthread in /opt/lib32/lib, so I then tried:

% dmd test.d -L-L/opt/lib32/lib
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.so when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/../../../libpthread.a when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: cannot find -lpthread
collect2: ld returned 1 exit status
--- errorlevel 1

ld still seems to be trying to use the 64 bit version. Trying to link manually with gcc (some options tweaked):

% gcc test.o -o test -m32 -Xlinker -L./../lib -L/opt/lib32/lib -L/opt/lib32/usr/lib -lphobos2 -lpthread -lm /usr/bin/ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0
/usr/bin/ld: cannot find /lib/libpthread.so.0
collect2: ld returned 1 exit status

This seemed to get less errors than before. When I specified the path to libpthread manually it started complaining about libgcc. Using -v with the above command I found the linking command, then adapted that and tried manually again, but was left with the error:

/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008048c90

When editing the linking command I had to remove a selection of gcc libraries that I don't have 32 bit versions of, which could be the issue, however according to nm none of the other .o's or .a's that are meant to get linked contain _start. Does anyone have any idea how I can get dmd working with a multi lib x86-64 system? I'm using Arch Linux, if you could point me in the right direction to get the missing libraries or whatever's needed to get dmd working let me know, thanks.

Robert

Try typing:

  export LD_LIBRARY_PATH="/opt/lib32"

before compiling.

-Lars

Reply via email to