Linker not working under dmd

Jonathan Marler johnnymarler at gmail.com
Fri Apr 4 15:08:30 PDT 2014


I'm having a problem with the DMD compiler but it seems I can't 
post to the digitalmars.D.bugs thread for help, so I'm posting 
here.

I'm getting the "/usr/bin/ld: cannot find -l:libphobos2.a" error 
when I run dmd.  I've looked at all the threads and tried 
everything but nothing seems to have worked.

I downloaded dmd.2.065.0.zip to a redhat 64bit machine and 
followed the installation instructions from 
http://dlang.org/dmd-linux.html:
     Unzip the archive into your home directory. It will create a 
~/dmd directory with all the files in it. All the tools are 
command line tools, which means they are run from a console 
window.
     Copy dmd.conf to /etc:
     cp dmd2/linux/bin/dmd.conf /etc
     Put dmd2/linux/bin on your PATH, or copy the linux 
executables to /usr/local/bin
     Copy the library to /usr/lib:
     cp dmd2/linux/lib/libphobos2.a /usr/lib

I tried this with both the lib32 binaries and the lib64 binaries. 
  After I copied the dmd.conf to the /etc path I added the 
absolute paths to the arguments like so:
     [Environment32]
     DFLAGS=-I/root/dmd2/src/phobos 
-I/root/dmd2/src/druntime/import -L-L/root/dmd2/linux/lib32 
-L--export-dynamic

     [Environment64]
     DFLAGS=-I/root/dmd2/src/phobos 
-I/root/dmd2/src/druntime/import -L-L/root/dmd2/linux/lib64 
-L--export-dynamic

I know the dmd.conf file is working because when I change this 
file I see the results when I run dmd.  However no matter what I 
do I never get past the same error message:

/usr/bin/ld: cannot find -l:libphobos2.a
collect2: ld returned 1 exit status
--- errorlevel 1


I've tried:

1. Setting LD_LIBRARY_PATH
2. Copying the libphobos2.a file to /lib, /usr/lib, 
/usr/local/lib (the last one is the default in /etc/ld.so.conf)
3. Changing dmd.conf -L-L argument any which way I can (added a 
colon, a space, tried other option letters)

After nothing worked I tried just changing my path instead.

export PATH=/root/dmd2/linux/bin64:$PATH

It then used the dmd.conf file in the unzipped directory (instead 
of the one in /etc/dmd.conf) but it still didn't find 
libphobos2.a.

I feel like I've tried everything, I'm at my wits end with this.

I'm running as root, the lib files are veiwable by everyone so 
that's not the problem.

I tried running ld on the .o file created by dmd, but I'm not 
sure what arguments dmd uses, if someone knows could you provide 
me with the arguments and I can try running ld along (without 
dmd).


More information about the Digitalmars-d mailing list