www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: ld issues again

reply Brian Myers <tarkawebfoot gmail.com> writes:
Hello all,

Thanx for the assistance rendered before. I've removed all my previous
installation attempt and installed
D 2.0 under Ubuntu with the one click installer. Now when compiling I get the
following, which is
different from what I was getting before:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib32/libphobos2.a(getopt_714_340.o):
`_D3std6getopt10optionCharw' accessed both as normal and thread local symbol
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib32/libphobos2.a: could not
read symbols: Success
collect2: ld returned 1 exit status
--errorlevel 1

I edited my dmd.conf because it seems to be trying to find libphobos2.a in the
lib32 directory, and I
think it needs to find it in the lib64 directory. Don't know what the getopt
error is about. Here is my
dmd.conf:


[Environment]

DFLAGS= -I/usr/include/d/dmd/phobos -I/usr/include/d/dmd/druntime/import
-L-L/usr/lib64 -L-
L/usr/lib32 -L--no-warn-search-mismatch -L--export-dynamic -L-lrt

Should I change the -L-L to just /usr/lib since that's linked to /usr/lib64?

Thanx again

Brian
May 15 2011
next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On 2011-05-15 22:39, Brian Myers wrote:
 Hello all,
 
 Thanx for the assistance rendered before. I've removed all my previous
 installation attempt and installed D 2.0 under Ubuntu with the one click
 installer. Now when compiling I get the following, which is different from
 what I was getting before:
 
 /usr/bin/ld:
 /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib32/libphobos2.a(getopt_
 714_340.o): `_D3std6getopt10optionCharw' accessed both as normal and thread
 local symbol
 /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib32/libphobos2.a: could
 not read symbols: Success collect2: ld returned 1 exit status
 --errorlevel 1
 
 I edited my dmd.conf because it seems to be trying to find libphobos2.a in
 the lib32 directory, and I think it needs to find it in the lib64
 directory. Don't know what the getopt error is about. Here is my dmd.conf:
 
 
 [Environment]
 
 DFLAGS= -I/usr/include/d/dmd/phobos -I/usr/include/d/dmd/druntime/import
 -L-L/usr/lib64 -L- L/usr/lib32 -L--no-warn-search-mismatch
 -L--export-dynamic -L-lrt
 
 Should I change the -L-L to just /usr/lib since that's linked to
 /usr/lib64?
dmd.conf specifically puts both the 32 and 64-bit lib directories on its path so that it can build for both 32 and 64-bit. And if /usr/lib is a symlink to /usr/lib64, then it doesn't matter which of the two is on your path. They're the same. Since ld is grabbing libphobos2.a from lib32, dmd obviously thinks that you're building a 32-bit executable. Now, if you've installed dmd as a 64-bit executable, that's a bit odd, since it should default to building 64- bit executables. That would seem to indicate that you're building with -m32 (or you installed 2.052 instead of 2.053, and 2.052 didn't have a 64-bit executable, and it defaulted to -m32). Regardless, ld is not complaining that lib32/libphobos2.a is not for the right architecture, so it definitely looks like you're trying to build a 32-bit executable. Now, why that isn't working, I don't know. It looks like something funny is going on with std.getopt. It could be that there's a problem with the libphobos2.a file which your program ran into and others haven't. Or it could just be that your libphobos2.a file is corrupted. In any case, the folders for both the lib32 and lib64 versions of libphobos2.a should be in your DFLAGS. dmd/ld will grab the correct version of libphobos2.a depending on whether you're building a 32 or 64-bit executable. So, that shouldn't be the problem. It sounds more like something is wrong with your libphobos2.a file. - Jonathan M Davis
May 15 2011
prev sibling parent Daniel Gibson <metalcaedes gmail.com> writes:
Am 16.05.2011 07:39, schrieb Brian Myers:
 Hello all,
 
 Thanx for the assistance rendered before. I've removed all my previous
installation attempt and installed
 D 2.0 under Ubuntu with the one click installer. Now when compiling I get the
following, which is
 different from what I was getting before:
 
 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib32/libphobos2.a(getopt_714_340.o):
 `_D3std6getopt10optionCharw' accessed both as normal and thread local symbol
 /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib32/libphobos2.a: could not
read symbols: Success
 collect2: ld returned 1 exit status
 --errorlevel 1
 
 I edited my dmd.conf because it seems to be trying to find libphobos2.a in the
lib32 directory, and I
 think it needs to find it in the lib64 directory. Don't know what the getopt
error is about. Here is my
 dmd.conf:
 
 
 [Environment]
 
 DFLAGS= -I/usr/include/d/dmd/phobos -I/usr/include/d/dmd/druntime/import
-L-L/usr/lib64 -L-
 L/usr/lib32 -L--no-warn-search-mismatch -L--export-dynamic -L-lrt
 
 Should I change the -L-L to just /usr/lib since that's linked to /usr/lib64?
 
 Thanx again
 
 Brian
What Version of Ubuntu are you using (10.10 (maverick), 11.04(natty), ...)? The 32bit (i386) or 64bit (amd64) version of that distribution? What's the output of "uname -a"? What's the output of "ls -ld /usr/lib*"? Did you compile with -m32 or -m64 (if none of these try them)? Cheers, - Daniel
May 15 2011