digitalmars.D - Linker not working under dmd
- Jonathan Marler (54/54) Apr 04 2014 I'm having a problem with the DMD compiler but it seems I can't
- Adam D. Ruppe (14/14) Apr 04 2014 I had this problem too with the new dmd version on a CentOS
- Adam D. Ruppe (7/7) Apr 04 2014 The link command on mine btw is:
- Mike Wey (4/16) Apr 05 2014 --
- Jonathan Marler (5/19) Apr 07 2014 Thanks so much for the help, it's good to know I'm not alone in
- Rafael (5/19) Oct 10 2014 Hi, Adam,
- Walter Bright (2/5) Apr 04 2014 If you run dmd with the -v switch, it will show the command it passes to...
- Nick Sabalausky (6/8) Oct 10 2014 digitalmars.D.bugs isn't intended for posting or for getting help, it's
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).
Apr 04 2014
I had this problem too with the new dmd version on a CentOS server. My solution was to link it manually. First, run your dmd command with -v at the end to get the verbose output. The last line it outputs will be the linking command. Copy/paste that and find where it does the -l:phobos2 or whatever it exactly looks like. Delete it and instead use plain -lphobos2, no weirdo colon. Then it should work. I changed my makefile to always compile and link separately on that box so I wouldn't have to worry about it later. (i also had to recompile phobos on that box because the libc was too old for the qsort_r druntime now uses. If you have that problem too, let me know and I'll tell you what I did.)
Apr 04 2014
The link command on mine btw is: gcc *.o -o content -m32 -L/home/user/dmd2/linux/bin32/../lib32 -Xlinker -- export-dynamic -lpq -lmhash -lcurl -lphobos2 -lpthread -lm -lrt The pq, mhash, and curl libraries are used by my application so you might not need those on your app. This is also a 32 bit program.
Apr 04 2014
On 04/05/2014 02:28 AM, Adam D. Ruppe wrote:I had this problem too with the new dmd version on a CentOS server. My solution was to link it manually. First, run your dmd command with -v at the end to get the verbose output. The last line it outputs will be the linking command. Copy/paste that and find where it does the -l:phobos2 or whatever it exactly looks like. Delete it and instead use plain -lphobos2, no weirdo colon. Then it should work. I changed my makefile to always compile and link separately on that box so I wouldn't have to worry about it later.Or add "-defaultlib=phobos2" to dmd.conf(i also had to recompile phobos on that box because the libc was too old for the qsort_r druntime now uses. If you have that problem too, let me know and I'll tell you what I did.)-- Mike Wey
Apr 05 2014
On Saturday, 5 April 2014 at 00:28:55 UTC, Adam D. Ruppe wrote:I had this problem too with the new dmd version on a CentOS server. My solution was to link it manually. First, run your dmd command with -v at the end to get the verbose output. The last line it outputs will be the linking command. Copy/paste that and find where it does the -l:phobos2 or whatever it exactly looks like. Delete it and instead use plain -lphobos2, no weirdo colon. Then it should work. I changed my makefile to always compile and link separately on that box so I wouldn't have to worry about it later. (i also had to recompile phobos on that box because the libc was too old for the qsort_r druntime now uses. If you have that problem too, let me know and I'll tell you what I did.)Thanks so much for the help, it's good to know I'm not alone in the D world. It's hard being the first one at my job to start using D but this language has almost all the things that I've been wanting from C/C++.
Apr 07 2014
On Saturday, 5 April 2014 at 00:28:55 UTC, Adam D. Ruppe wrote:I had this problem too with the new dmd version on a CentOS server. My solution was to link it manually. First, run your dmd command with -v at the end to get the verbose output. The last line it outputs will be the linking command. Copy/paste that and find where it does the -l:phobos2 or whatever it exactly looks like. Delete it and instead use plain -lphobos2, no weirdo colon. Then it should work. I changed my makefile to always compile and link separately on that box so I wouldn't have to worry about it later. (i also had to recompile phobos on that box because the libc was too old for the qsort_r druntime now uses. If you have that problem too, let me know and I'll tell you what I did.)Hi, Adam, I have old gstdlibc too (without qsort_r). Please, tell workaround to recompile phobos. Thanks in advance!
Oct 10 2014
On 4/4/2014 3:08 PM, Jonathan Marler wrote: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).If you run dmd with the -v switch, it will show the command it passes to the linker.
Apr 04 2014
On 04/04/2014 06:08 PM, Jonathan Marler wrote: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.digitalmars.D.bugs isn't intended for posting or for getting help, it's just a place that automatically mirrors issues/comments that get posted to the bugzilla issue tracker: https://issues.dlang.org/ Even though its name may suggest a more limited scope, digitalmars.D.learn is really for pretty much any general D-related help.
Oct 10 2014