Building gccgo - /opt/gold/bin/ld: cannot find -lc

1,305 views
Skip to first unread message

Bob Hancock

unread,
Sep 16, 2011, 9:37:37 AM9/16/11
to golan...@googlegroups.com
make chugs along for a while and then abends with:

/opt/gold/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1

I have all the required dependencies at the correct levels.  I googled the error but did not find anything useful

Ian, any suggestions?

Ian Lance Taylor

unread,
Sep 16, 2011, 10:14:08 AM9/16/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

That's not much information, but I would guess that you are on a 64-bit
x86_64 system and that this is happening when building the 32-bit
version of libgcc_s.so and that you don't have the 32-bit libc
installed. If that is the problem, then the fix would be to either
install the 32-bit development libraries or to use --disable-multilib
when you run configure.

Ian

Bob Hancock

unread,
Sep 16, 2011, 10:39:14 AM9/16/11
to golan...@googlegroups.com
I wasn't sure how much of the output to supply, but I am on a 64-bit x86_64 system.  I used the commands from golang.org
mkdir objdir
cd objdir
../gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
make

After reading your reply:
make clean
 ../gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld --disable-multilib
make 

And I received the same error.  Any other suggestions or is there more data that I could supply to help?

Ian Lance Taylor

unread,
Sep 16, 2011, 11:05:46 AM9/16/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

What OS?

Show 10 or 20 lines of make output before and after the error.

Ian

Bob Hancock

unread,
Sep 16, 2011, 11:23:17 AM9/16/11
to golan...@googlegroups.com
OS is Ubuntu 11.04

/bin/bash ../../../gccgo/libgcc/../mkinstalldirs ../.././gcc
parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"; \
for file in $parts; do \
 rm -f ../.././gcc/$file; \
 /usr/bin/install -c -m 644 $file ../.././gcc/; \
 case $file in \
   *.a) \
     ranlib ../.././gcc/$file ;; \
 esac; \
done
{ /home/rhancock/objdir/./gcc/nm -pg  _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o getf2_s.o letf2_s.o eqtf2_s.o _divtc3_s.o _multc3_s.o _powitf2_s.o unwind-dw2_s.o unwind-dw2-fde-glibc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o; echo %%; \
 cat ../../../gccgo/libgcc/../gcc/libgcc-std.ver ../../../gccgo/libgcc/../gcc/config/i386/libgcc-glibc.ver  \
   | sed -e '/^[ ]*#/d' \
 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
   | /home/rhancock/objdir/./gcc/xgcc -B/home/rhancock/objdir/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector   -I. -I. -I../.././gcc -I../../../gccgo/libgcc -I../../../gccgo/libgcc/. -I../../../gccgo/libgcc/../gcc -I../../../gccgo/libgcc/../include -I../../../gccgo/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -E -xassembler-with-cpp -; \
} | gawk -f ../../../gccgo/libgcc/../gcc/mkmap-symver.awk   > tmp-libgcc.map
mv tmp-libgcc.map libgcc.map
# @multilib_flags@ is still needed because this may use
# /home/rhancock/objdir/./gcc/xgcc -B/home/rhancock/objdir/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    and -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector  directly.
# @multilib_dir@ is not really necessary, but sometimes it has
# more uses than just a directory name.
/bin/bash ../../../gccgo/libgcc/../mkinstalldirs .
/home/rhancock/objdir/./gcc/xgcc -B/home/rhancock/objdir/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o getf2_s.o letf2_s.o eqtf2_s.o _divtc3_s.o _multc3_s.o _powitf2_s.o unwind-dw2_s.o unwind-dw2-fde-glibc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/opt/gold/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/rhancock/objdir/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/rhancock/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/rhancock/objdir'
make: *** [all] Error 2

Ian Lance Taylor

unread,
Sep 16, 2011, 11:30:00 AM9/16/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> OS is Ubuntu 11.04

> /opt/gold/bin/ld: cannot find -lc

Do you have the file /usr/lib/libc.so? It normally comes from the
libc6-dev package (sudo apt-get install libc6-dev).

Ian

Bob Hancock

unread,
Sep 16, 2011, 12:18:51 PM9/16/11
to golan...@googlegroups.com
Yes, and apt-get reports "libc6-dev is already the newest version".

Ian Lance Taylor

unread,
Sep 16, 2011, 1:23:26 PM9/16/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> Yes, and apt-get reports "libc6-dev is already the newest version".

Does this work?

echo 'int main() { return 0; }' > foo.c
gcc -o foo foo.c -B /opt/gold/bin

If that works, tell us the output of this:

gcc -o foo foo.c -B /opt/gold/bin -Wl,-t

If that does not work, why can't gold find libc? How did you build
gold?

Ian

Bob Hancock

unread,
Sep 16, 2011, 1:41:14 PM9/16/11
to golan...@googlegroups.com
gcc -o foo foo.c -B /opt/gold/bin -Wl,-t gives me

opt/gold/bin/ld: mode elf_x86_64
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crt1.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crti.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtbegin.o
/tmp/ccCKkGwf.o
-lgcc_s (/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc_s.so)
/lib/x86_64-linux-gnu/libc.so.6
(/usr/lib/x86_64-linux-gnu/libc_nonshared.a)elf-init.oS
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
-lgcc_s (/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libgcc_s.so)
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtend.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crtn.o

So, it looks like it worked.

Ian Lance Taylor

unread,
Sep 16, 2011, 2:12:59 PM9/16/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

Hmmm, OK, that found libc.so via paths passed in from the gcc driver, so
that doesn't tell us much.

Did you build gold yourself? How did you configure it?

What is the output of

strings /opt/gold/bin/ld | grep /usr/lib

?

Ian

Bob Hancock

unread,
Sep 16, 2011, 10:23:49 PM9/16/11
to golan...@googlegroups.com
I built gold with the command on the website.

cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src login
[password is "anoncvs"]
cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src co binutils
mkdir binutils-objdir
cd binutils-objdir
../src/configure --enable-gold --prefix=/opt/gold
make
make install


strings /opt/gold/bin/ld | grep /usr/lib
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/libx32"); SEARCH_DIR("/opt/gold/libx32"); SEARCH_DIR("/usr/local/libx32"); SEARCH_DIR("/libx32"); SEARCH_DIR("/usr/libx32"); SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/i386-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib"); SEARCH_DIR("/opt/gold/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
/usr/lib/libc.so.1


Ian Lance Taylor

unread,
Sep 17, 2011, 12:52:35 AM9/17/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> I built gold with the command on the website.
>
> cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src login
> [password is "anoncvs"]
> cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src co binutils
> mkdir binutils-objdir
> cd binutils-objdir
> ../src/configure --enable-gold --prefix=/opt/gold
> make
> make install
>
>
>
> strings /opt/gold/bin/ld | grep /usr/lib
> SEARCH_DIR("/opt/gold/x86_64-unknown-linux-gnu/lib64");
> SEARCH_DIR("/opt/gold/lib64"); SEARCH_DIR("/usr/local/lib64");

That's not gold. I don't know what went wrong, because your configure
script should have built gold, but that is GNU ld.

Ian

Julian Phillips

unread,
Sep 17, 2011, 9:34:21 AM9/17/11
to Ian Lance Taylor, golan...@googlegroups.com

When I built binutils following the gccgo instructions I ended up with
ld, ld.bfd and ld.gold in my bin directory ...
ld and ld.bfd were hard links to the same binary.

jp3@wraith: bin>ls -li ld*
168185 -rwxr-xr-x 4 jp3 jp3 6597015 Sep 1 15:38 ld
168185 -rwxr-xr-x 4 jp3 jp3 6597015 Sep 1 15:38 ld.bfd
167607 -rwxr-xr-x 2 jp3 jp3 49445141 Sep 1 15:38 ld.gold

jp3@wraith: bin>./ld --version
GNU ld (GNU Binutils) 2.21.53.20110902
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.

jp3@wraith: bin>./ld.gold --version
GNU gold (GNU Binutils 2.21.53.20110902) 1.11
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.

When I build gccgo I pointed it at ld.gold ...

--
Julian

Ian Lance Taylor

unread,
Sep 18, 2011, 2:01:42 PM9/18/11
to Julian Phillips, golan...@googlegroups.com
Julian Phillips <jul...@quantumfyre.co.uk> writes:

> When I built binutils following the gccgo instructions I ended up with
> ld, ld.bfd and ld.gold in my bin directory ...
> ld and ld.bfd were hard links to the same binary.

Hmmmm, looks like --enable-gold has changed so that it just installs
gold as ld.gold. You now need to use --enable-gold=default to get it to
be installed as ld. I will update the Go docs accordingly.

Ian

Bob Hancock

unread,
Sep 19, 2011, 1:45:00 PM9/19/11
to golan...@googlegroups.com
>That's not gold.  I don't know what went wrong, because your configure

>script should have built gold, but that is GNU ld.

So, I decided to start from scratch.

sudo apt-get remove binutils
rm -rf /opt/gold
rm -rf ~/binutils-objdir
rm -rf ~/objdir

sudo apt-get install linux-headers-2.6.38-8 2.6.38-8.42
sudo apt-get install gcc
sudo apt-get install g++

cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src login
[password is "anoncvs"]
cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src co binutils
mkdir binutils-objdir
cd binutils-objdir
../src/configure --enable-gold=default  --prefix=/opt/gold
make
make install

svn checkout svn://gcc.gnu.org/svn/gcc/branches/gccgo gccgo
mkdir objdir
cd objdir
../gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
make

....

opt/gold/bin/ld: error: cannot find -lc
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/rhancock/objdir/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/rhancock/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/rhancock/objdir'
make: *** [all] Error 2

strings /opt/gold/bin/ld | grep /usr/lib
/usr/lib/libc.so.1
/usr/lib/ld.so.1
/usr/lib/sparcv9/ld.so.1
/usr/lib

Any other suggestions?  Is there something else I can remove?  I don't mind starting from square one, I'd really like to get this installed.

Ian Lance Taylor

unread,
Sep 19, 2011, 3:01:13 PM9/19/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> opt/gold/bin/ld: error: cannot find -lc
> collect2: error: ld returned 1 exit status
> make[3]: *** [libgcc_s.so] Error 1

I have to admit that I am stumped by this. I cannot recall seeing any
similar report on a system where the file /usr/lib/libc.so exists.
There is probably a simple explanation but without being able to see
your system I don't know what it could be.

Can you send the contents of /usr/lib/libc.so? It should be a short
text file.

From a previous e-mail, the command which failed was:

/home/rhancock/objdir/./gcc/xgcc -B/home/rhancock/objdir/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o getf2_s.o letf2_s.o eqtf2_s.o _divtc3_s.o _multc3_s.o _powitf2_s.o unwind-dw2_s.o unwind-dw2-fde-glibc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so

run in the directory

/home/rhancock/objdir/x86_64-unknown-linux-gnu/libgcc

Please try running that some command with the additional option

-Wl,--verbose,-t

and send the output.

Ian

Bob Hancock

unread,
Sep 19, 2011, 3:20:57 PM9/19/11
to golan...@googlegroups.com
sudo find / -name libc.so
[sudo] password for rhancock: 
/usr/lib32/libc.so
/usr/lib/x86_64-linux-gnu/libc.so
 
Nothing in /usr/lib.  Do I need to make a link?

Here are the results with -Wl,--verbose,-t as command line switches.

/opt/gold/bin/ld: Attempt to open /usr/lib/../lib64/crti.o succeeded
/usr/lib/../lib64/crti.o
/opt/gold/bin/ld: Attempt to open /home/rhancock/objdir/./gcc/crtbeginS.o succeeded
/home/rhancock/objdir/./gcc/crtbeginS.o
/opt/gold/bin/ld: Attempt to open _muldi3_s.o succeeded
_muldi3_s.o
/opt/gold/bin/ld: Attempt to open _negdi2_s.o succeeded
_negdi2_s.o
/opt/gold/bin/ld: Attempt to open _lshrdi3_s.o succeeded
_lshrdi3_s.o
/opt/gold/bin/ld: Attempt to open _ashldi3_s.o succeeded
_ashldi3_s.o
/opt/gold/bin/ld: Attempt to open _ashrdi3_s.o succeeded
_ashrdi3_s.o
/opt/gold/bin/ld: Attempt to open _cmpdi2_s.o succeeded
_cmpdi2_s.o
/opt/gold/bin/ld: Attempt to open _ucmpdi2_s.o succeeded
_ucmpdi2_s.o
/opt/gold/bin/ld: Attempt to open _clear_cache_s.o succeeded
_clear_cache_s.o
/opt/gold/bin/ld: Attempt to open _enable_execute_stack_s.o succeeded
_enable_execute_stack_s.o
/opt/gold/bin/ld: Attempt to open _trampoline_s.o succeeded
_trampoline_s.o
/opt/gold/bin/ld: Attempt to open __main_s.o succeeded
__main_s.o
/opt/gold/bin/ld: Attempt to open _absvsi2_s.o succeeded
_absvsi2_s.o
/opt/gold/bin/ld: Attempt to open _absvdi2_s.o succeeded
_absvdi2_s.o
/opt/gold/bin/ld: Attempt to open _addvsi3_s.o succeeded
_addvsi3_s.o
/opt/gold/bin/ld: Attempt to open _addvdi3_s.o succeeded
_addvdi3_s.o
/opt/gold/bin/ld: Attempt to open _subvsi3_s.o succeeded
_subvsi3_s.o
/opt/gold/bin/ld: Attempt to open _subvdi3_s.o succeeded
_subvdi3_s.o
/opt/gold/bin/ld: Attempt to open _mulvsi3_s.o succeeded
_mulvsi3_s.o
/opt/gold/bin/ld: Attempt to open _mulvdi3_s.o succeeded
_mulvdi3_s.o
/opt/gold/bin/ld: Attempt to open _negvsi2_s.o succeeded
_negvsi2_s.o
/opt/gold/bin/ld: Attempt to open _negvdi2_s.o succeeded
_negvdi2_s.o
/opt/gold/bin/ld: Attempt to open _ctors_s.o succeeded
_ctors_s.o
/opt/gold/bin/ld: Attempt to open _ffssi2_s.o succeeded
_ffssi2_s.o
/opt/gold/bin/ld: Attempt to open _ffsdi2_s.o succeeded
_ffsdi2_s.o
/opt/gold/bin/ld: Attempt to open _clz_s.o succeeded
_clz_s.o
/opt/gold/bin/ld: Attempt to open _clzsi2_s.o succeeded
_clzsi2_s.o
/opt/gold/bin/ld: Attempt to open _clzdi2_s.o succeeded
_clzdi2_s.o
/opt/gold/bin/ld: Attempt to open _ctzsi2_s.o succeeded
_ctzsi2_s.o
/opt/gold/bin/ld: Attempt to open _ctzdi2_s.o succeeded
_ctzdi2_s.o
/opt/gold/bin/ld: Attempt to open _popcount_tab_s.o succeeded
_popcount_tab_s.o
/opt/gold/bin/ld: Attempt to open _popcountsi2_s.o succeeded
_popcountsi2_s.o
/opt/gold/bin/ld: Attempt to open _popcountdi2_s.o succeeded
_popcountdi2_s.o
/opt/gold/bin/ld: Attempt to open _paritysi2_s.o succeeded
_paritysi2_s.o
/opt/gold/bin/ld: Attempt to open _paritydi2_s.o succeeded
_paritydi2_s.o
/opt/gold/bin/ld: Attempt to open _powisf2_s.o succeeded
_powisf2_s.o
/opt/gold/bin/ld: Attempt to open _powidf2_s.o succeeded
_powidf2_s.o
/opt/gold/bin/ld: Attempt to open _powixf2_s.o succeeded
_powixf2_s.o
/opt/gold/bin/ld: Attempt to open _mulsc3_s.o succeeded
_mulsc3_s.o
/opt/gold/bin/ld: Attempt to open _muldc3_s.o succeeded
_muldc3_s.o
/opt/gold/bin/ld: Attempt to open _mulxc3_s.o succeeded
_mulxc3_s.o
/opt/gold/bin/ld: Attempt to open _divsc3_s.o succeeded
_divsc3_s.o
/opt/gold/bin/ld: Attempt to open _divdc3_s.o succeeded
_divdc3_s.o
/opt/gold/bin/ld: Attempt to open _divxc3_s.o succeeded
_divxc3_s.o
/opt/gold/bin/ld: Attempt to open _bswapsi2_s.o succeeded
_bswapsi2_s.o
/opt/gold/bin/ld: Attempt to open _bswapdi2_s.o succeeded
_bswapdi2_s.o
/opt/gold/bin/ld: Attempt to open _fixunssfsi_s.o succeeded
_fixunssfsi_s.o
/opt/gold/bin/ld: Attempt to open _fixunsdfsi_s.o succeeded
_fixunsdfsi_s.o
/opt/gold/bin/ld: Attempt to open _fixunsxfsi_s.o succeeded
_fixunsxfsi_s.o
/opt/gold/bin/ld: Attempt to open _fixsfdi_s.o succeeded
_fixsfdi_s.o
/opt/gold/bin/ld: Attempt to open _fixdfdi_s.o succeeded
_fixdfdi_s.o
/opt/gold/bin/ld: Attempt to open _fixxfdi_s.o succeeded
_fixxfdi_s.o
/opt/gold/bin/ld: Attempt to open _fixunssfdi_s.o succeeded
_fixunssfdi_s.o
/opt/gold/bin/ld: Attempt to open _fixunsdfdi_s.o succeeded
_fixunsdfdi_s.o
/opt/gold/bin/ld: Attempt to open _fixunsxfdi_s.o succeeded
_fixunsxfdi_s.o
/opt/gold/bin/ld: Attempt to open _floatdisf_s.o succeeded
_floatdisf_s.o
/opt/gold/bin/ld: Attempt to open _floatdidf_s.o succeeded
_floatdidf_s.o
/opt/gold/bin/ld: Attempt to open _floatdixf_s.o succeeded
_floatdixf_s.o
/opt/gold/bin/ld: Attempt to open _floatundisf_s.o succeeded
_floatundisf_s.o
/opt/gold/bin/ld: Attempt to open _floatundidf_s.o succeeded
_floatundidf_s.o
/opt/gold/bin/ld: Attempt to open _floatundixf_s.o succeeded
_floatundixf_s.o
/opt/gold/bin/ld: Attempt to open _divdi3_s.o succeeded
_divdi3_s.o
/opt/gold/bin/ld: Attempt to open _moddi3_s.o succeeded
_moddi3_s.o
/opt/gold/bin/ld: Attempt to open _udivdi3_s.o succeeded
_udivdi3_s.o
/opt/gold/bin/ld: Attempt to open _umoddi3_s.o succeeded
_umoddi3_s.o
/opt/gold/bin/ld: Attempt to open _udiv_w_sdiv_s.o succeeded
_udiv_w_sdiv_s.o
/opt/gold/bin/ld: Attempt to open _udivmoddi4_s.o succeeded
_udivmoddi4_s.o
/opt/gold/bin/ld: Attempt to open addtf3_s.o succeeded
addtf3_s.o
/opt/gold/bin/ld: Attempt to open divtf3_s.o succeeded
divtf3_s.o
/opt/gold/bin/ld: Attempt to open multf3_s.o succeeded
multf3_s.o
/opt/gold/bin/ld: Attempt to open negtf2_s.o succeeded
negtf2_s.o
/opt/gold/bin/ld: Attempt to open subtf3_s.o succeeded
subtf3_s.o
/opt/gold/bin/ld: Attempt to open unordtf2_s.o succeeded
unordtf2_s.o
/opt/gold/bin/ld: Attempt to open fixtfsi_s.o succeeded
fixtfsi_s.o
/opt/gold/bin/ld: Attempt to open fixunstfsi_s.o succeeded
fixunstfsi_s.o
/opt/gold/bin/ld: Attempt to open floatsitf_s.o succeeded
floatsitf_s.o
/opt/gold/bin/ld: Attempt to open floatunsitf_s.o succeeded
floatunsitf_s.o
/opt/gold/bin/ld: Attempt to open fixtfdi_s.o succeeded
fixtfdi_s.o
/opt/gold/bin/ld: Attempt to open fixunstfdi_s.o succeeded
fixunstfdi_s.o
/opt/gold/bin/ld: Attempt to open floatditf_s.o succeeded
floatditf_s.o
/opt/gold/bin/ld: Attempt to open floatunditf_s.o succeeded
floatunditf_s.o
/opt/gold/bin/ld: Attempt to open fixtfti_s.o succeeded
fixtfti_s.o
/opt/gold/bin/ld: Attempt to open fixunstfti_s.o succeeded
fixunstfti_s.o
/opt/gold/bin/ld: Attempt to open floattitf_s.o succeeded
floattitf_s.o
/opt/gold/bin/ld: Attempt to open floatuntitf_s.o succeeded
floatuntitf_s.o
/opt/gold/bin/ld: Attempt to open extendsftf2_s.o succeeded
extendsftf2_s.o
/opt/gold/bin/ld: Attempt to open extenddftf2_s.o succeeded
extenddftf2_s.o
/opt/gold/bin/ld: Attempt to open extendxftf2_s.o succeeded
extendxftf2_s.o
/opt/gold/bin/ld: Attempt to open trunctfsf2_s.o succeeded
trunctfsf2_s.o
/opt/gold/bin/ld: Attempt to open trunctfdf2_s.o succeeded
trunctfdf2_s.o
/opt/gold/bin/ld: Attempt to open trunctfxf2_s.o succeeded
trunctfxf2_s.o
/opt/gold/bin/ld: Attempt to open getf2_s.o succeeded
getf2_s.o
/opt/gold/bin/ld: Attempt to open letf2_s.o succeeded
letf2_s.o
/opt/gold/bin/ld: Attempt to open eqtf2_s.o succeeded
eqtf2_s.o
/opt/gold/bin/ld: Attempt to open _divtc3_s.o succeeded
_divtc3_s.o
/opt/gold/bin/ld: Attempt to open _multc3_s.o succeeded
_multc3_s.o
/opt/gold/bin/ld: Attempt to open _powitf2_s.o succeeded
_powitf2_s.o
/opt/gold/bin/ld: Attempt to open unwind-dw2_s.o succeeded
unwind-dw2_s.o
/opt/gold/bin/ld: Attempt to open unwind-dw2-fde-glibc_s.o succeeded
unwind-dw2-fde-glibc_s.o
/opt/gold/bin/ld: Attempt to open unwind-sjlj_s.o succeeded
unwind-sjlj_s.o
/opt/gold/bin/ld: Attempt to open gthr-gnat_s.o succeeded
gthr-gnat_s.o
/opt/gold/bin/ld: Attempt to open unwind-c_s.o succeeded
unwind-c_s.o
/opt/gold/bin/ld: Attempt to open emutls_s.o succeeded
emutls_s.o
/opt/gold/bin/ld: Attempt to open /home/rhancock/objdir/./gcc/crtendS.o succeeded
/opt/gold/bin/ld: Attempt to open /usr/lib/../lib64/crtn.o succeeded
/opt/gold/bin/ld: Attempt to open /home/rhancock/objdir/./gcc/libc.so failed
/opt/gold/bin/ld: Attempt to open /home/rhancock/objdir/./gcc/libc.a failed
/opt/gold/bin/ld: Attempt to open ./libc.so failed
/opt/gold/bin/ld: Attempt to open ./libc.a failed
/opt/gold/bin/ld: Attempt to open /lib/../lib64/libc.so failed
/opt/gold/bin/ld: Attempt to open /lib/../lib64/libc.a failed
/opt/gold/bin/ld: Attempt to open /usr/lib/../lib64/libc.so failed
/opt/gold/bin/ld: Attempt to open /usr/lib/../lib64/libc.a failed
/opt/gold/bin/ld: Attempt to open /lib/libc.so failed
/opt/gold/bin/ld: Attempt to open /lib/libc.a failed
/opt/gold/bin/ld: Attempt to open /usr/lib/libc.so failed
/opt/gold/bin/ld: Attempt to open /usr/lib/libc.a failed
/opt/gold/bin/ld: error: cannot find -lc
/home/rhancock/objdir/./gcc/crtendS.o
/usr/lib/../lib64/crtn.o

ron minnich

unread,
Sep 19, 2011, 3:27:02 PM9/19/11
to golan...@googlegroups.com
Every time I've had to deal with this sort of ld nonsense, strace has
belped a lot. You might want to give it a go.

ron

Rob 'Commander' Pike

unread,
Sep 19, 2011, 3:39:35 PM9/19/11
to ron minnich, golan...@googlegroups.com

On Sep 19, 2011, at 12:27 PM, ron minnich wrote:

> strace has belped

This reminds me of our old PROM burner that turned on way day and displayed:

RELF TEST PASSED

-rob

Ian Lance Taylor

unread,
Sep 19, 2011, 3:46:37 PM9/19/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> sudo find / -name libc.so
> [sudo] password for rhancock:
> /usr/lib32/libc.so
> /usr/lib/x86_64-linux-gnu/libc.so
>
> Nothing in /usr/lib. Do I need to make a link?

Argh, this is because Debian or Ubuntu has decided to change the
standard library locations and gcc has not caught up. Their version of
gcc presumably has the necessary patches.

I'm not entirely sure, but I suspect this is the patch:

http://patch-tracker.debian.org/patch/series/view/gcc-4.6/4.6.1-4/gcc-multiarch-trunk.diff

Or, as you say, add a symlink from the files in
/usr/lib/x86_64-linux-gnu to /usr/lib.

Ian

Bob Hancock

unread,
Sep 19, 2011, 6:19:54 PM9/19/11
to golan...@googlegroups.com
I tried the patch with -p1 since it affects several files in the directory, but it did not like that.  So, I tried
patch < gcc-multiarch-trunk.diff

And it seemed to take.
make distclearn
../gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
make

This produced the same error referring to libc.so.

I then created a symlink.
cd /usr/lib/x86_64-linux-gnu 
ln -s libc.so /usr/lib/libc.so.6


make distclean
../gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
make

This got me past the original error.  However, there is now an error for libgcc_s.so

/bin/bash ../../../gccgo/libgcc/../mkinstalldirs .
/home/rhancock/objdir/./gcc/xgcc -B/home/rhancock/objdir/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o getf2_s.o letf2_s.o eqtf2_s.o _divtc3_s.o _multc3_s.o _powitf2_s.o unwind-dw2_s.o unwind-dw2-fde-glibc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/opt/gold/bin/ld: error: cannot find -lc
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1

So, 
cd /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4
ls -la libgcc*
-rw-r--r-- 1 root root 3047508 2011-04-18 10:26 libgcc.a
-rw-r--r-- 1 root root   53250 2011-04-18 10:26 libgcc_eh.a
lrwxrwxrwx 1 root root      14 2011-09-18 23:49 libgcc_s_32.so -> 32/libgcc_s.so
lrwxrwxrwx 1 root root      35 2011-09-18 22:18 libgcc_s.so -> /lib/x86_64-linux-gnu/libgcc_s.so.1

Seeing that libgcc_s.so already had a symlink, I tried

cd /lib/x86_64-linux-gnu
sudo ln -n libgcc_s.so.1 /usr/lib/libgcc_s.so

to make a symlink in /usr/lib

make distclean
./gccgo/configure --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
make

And I still get the error message above.  

Is it looking for another libgcc_s.so?

Ian Lance Taylor

unread,
Sep 19, 2011, 6:31:53 PM9/19/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> I then created a symlink.
> cd /usr/lib/x86_64-linux-gnu
> ln -s libc.so /usr/lib/libc.so.6

It needs to be named /usr/lib/libc.so, not /usr/lib/libc.so.6. For
libc, the trailing .6 implies a shared library, a large binary file.
The plain libc.so is a small text file.

> Is it looking for another libgcc_s.so?

It's looking for libc.so. It's trying to build a new libgcc_s.so in
your working directory.

Another gcc patch that is said to fix this problem is
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01649.html .

Ian

Bob Hancock

unread,
Sep 19, 2011, 9:11:48 PM9/19/11
to golan...@googlegroups.com

>It needs to be named /usr/lib/libc.so, not /usr/lib/libc.so.6.  For

l>ibc, the trailing .6 implies a shared library, a large binary file.


>The plain libc.so is a small text file.

That's a dope slap for me, I overlooked the 6.  However, I deleted the original symlink and then created

cd /usr/lib/x86_64-linux-gnu 

ln -s libc.so /usr/lib/libc.so

And the result during make is:

/opt/gold/bin/ld: error: cannot open /usr/lib/../lib64/libc.so: Too many levels of symbolic links

collect2: error: ld returned 1 exit status

Yet:
sudo find / -name libc.so
[sudo] password for rhancock: 
/usr/lib32/libc.so
/usr/lib/libc.so
/usr/lib/x86_64-linux-gnu/libc.so

Shows only these three, and /usr/lib/libc.so is a symlink to /usr/lib/x86_64-linux-gnu/libc.so
ls -la libc.so
lrwxrwxrwx 1 root root 7 2011-09-19 20:28 libc.so -> libc.so

If I remove this symbolic link, we are back to the original error that is stated earlier in the thread.

The error with the symlink states: /opt/gold/bin/ld: error: cannot open /usr/lib/../lib64/libc.so: Too many levels of symbolic links
but there is no lib64 under /usr/lib.  Is it looking for another path other than /usr/lib/libc.so?

There is a standard multiarch package for Ubuntu 11.04 that was installed before I started any of this, but it obviously does not apply to gcc.

I tried the patch, but a lot of the hunks were rejected.

rhancock@rhancock-X201:~/gccgo/gcc$ patch < ./multiarch.diff
patching file fragments.texi
Hunk #1 FAILED at 128.
1 out of 1 hunk FAILED -- saving rejects to file fragments.texi.rej
patching file invoke.texi
Hunk #1 FAILED at 5937.
1 out of 1 hunk FAILED -- saving rejects to file invoke.texi.rej
patching file install.texi
Hunk #1 FAILED at 1028.
1 out of 1 hunk FAILED -- saving rejects to file install.texi.rej
patching file incpath.c
Hunk #1 FAILED at 150.
Hunk #2 FAILED at 195.
2 out of 2 hunks FAILED -- saving rejects to file incpath.c.rej
patching file gcc.c
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 1147.
Hunk #2 FAILED at 2072.
Hunk #3 FAILED at 2089.
Hunk #4 FAILED at 2102.
Hunk #5 succeeded at 2163 (offset 23 lines).
Hunk #6 FAILED at 3248.
Hunk #7 succeeded at 4930 (offset 29 lines).
Hunk #8 succeeded at 6599 (offset 72 lines).
Hunk #9 FAILED at 7511.
Hunk #10 FAILED at 7576.
7 out of 10 hunks FAILED -- saving rejects to file gcc.c.rej
patching file genmultilib
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 succeeded at 75 with fuzz 2 (offset 2 lines).
Hunk #2 FAILED at 123.
Hunk #3 FAILED at 224.
Hunk #4 FAILED at 231.
Hunk #5 FAILED at 316.
4 out of 5 hunks FAILED -- saving rejects to file genmultilib.rej
patching file configure.ac
Hunk #1 succeeded at 639 with fuzz 2 (offset 28 lines).
patching file cppdefault.c
Hunk #1 FAILED at 64.
Hunk #2 FAILED at 95.
2 out of 2 hunks FAILED -- saving rejects to file cppdefault.c.rej
patching file cppdefault.h
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 FAILED at 43.
1 out of 1 hunk FAILED -- saving rejects to file cppdefault.h.rej
patching file common.opt
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 succeeded at 337 with fuzz 2 (offset -8 lines).
Hunk #2 succeeded at 2203 with fuzz 2 (offset -31 lines).
Hunk #3 FAILED at 2295.
1 out of 3 hunks FAILED -- saving rejects to file common.opt.rej
patching file config.gcc
Hunk #1 FAILED at 1315.
1 out of 1 hunk FAILED -- saving rejects to file config.gcc.rej
patching file Makefile.in
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] y
Hunk #1 succeeded at 360 with fuzz 2 (offset 10 lines).
Hunk #2 FAILED at 1946.
1 out of 2 hunks FAILED -- saving rejects to file Makefile.in.rej
patching file t-linux
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file t-linux.rej
patching file t-linux64
Hunk #1 FAILED at 7.
1 out of 1 hunk FAILED -- saving rejects to file t-linux64.rej
patching file t-linux64
Hunk #1 FAILED at 26.
1 out of 1 hunk FAILED -- saving rejects to file t-linux64.rej
patching file t-linux
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file t-linux.rej
patching file t-kfreebsd
patching file t-gnu
patching file t-linux
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file t-linux.rej
patching file t-linux64
Hunk #1 FAILED at 34.
1 out of 1 hunk FAILED -- saving rejects to file t-linux64.rej
patching file t-glibc
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file t-glibc.rej
patching file t-linux
Hunk #1 FAILED at 21.
1 out of 1 hunk FAILED -- saving rejects to file t-linux.rej
patching file t-linux64
Hunk #1 FAILED at 33.
1 out of 1 hunk FAILED -- saving rejects to file t-linux64.rej
patching file t-linux-eabi
Hunk #1 FAILED at 28.
1 out of 1 hunk FAILED -- saving rejects to file t-linux-eabi.rej
patching file t-linux
Hunk #1 FAILED at 35.
1 out of 1 hunk FAILED -- saving rejects to file t-linux.rej
patching file t-linux64
Hunk #1 FAILED at 22.
1 out of 1 hunk FAILED -- saving rejects to file t-linux64.rej

This is one of the rejection files:
rhancock@rhancock-X201:~/gccgo/gcc$ more ./t-linux64.rej 
--- t-linux64 (revision 177846)
+++ t-linux64 (working copy)
@@ -7,4 +7,5 @@
 
 MULTILIB_OPTIONS = m64/m31
 MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
+MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
--- t-linux64 (revision 177846)
+++ t-linux64 (working copy)
@@ -26,7 +26,8 @@
 
 MULTILIB_OPTIONS = m64/m32
 MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:sparc64-linux-gnu)
+MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:sparc-linux-gnu)
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
--- t-linux64 (revision 177846)
+++ t-linux64 (working copy)
@@ -34,8 +34,8 @@
 comma=,
 MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
 MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
-MULTILIB_OSDIRNAMES = m64=../lib64
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
+MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
 MULTILIB_OSDIRNAMES+= mx32=../libx32
 
 LIBGCC = stmp-multilib
--- t-linux64 (revision 177846)
+++ t-linux64 (working copy)
@@ -33,5 +33,7 @@
 MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
 MULTILIB_EXCEPTIONS     = m64/msoft-float
 MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
+MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+MULTILIB_OSDIRNAMES    += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
+MULTILIB_OSDIRNAMES    += nof
 MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
--- t-linux64 (revision 177846)
+++ t-linux64 (working copy)
@@ -22,6 +22,10 @@
 else
 MULTILIB_DIRNAMES = n32 32 64
 endif
-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
+MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(arch)))),el)
+MULTILIB_OSDIRNAMES = \
+ ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32) \
+ ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu) \
+ ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64)
 
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o

What is the logical next step?

Is there anyone else in this group who has successfully built gccgo with Ubuntu 11.04?

Ian Lance Taylor

unread,
Sep 20, 2011, 1:31:24 AM9/20/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> The error with the symlink states: /opt/gold/bin/ld: error: cannot open
> /usr/lib/../lib64/libc.so: Too many levels of symbolic links
> but there is no lib64 under /usr/lib. Is it looking for another path other
> than /usr/lib/libc.so?

Note the /../. Is there is a /usr/lib64/libc.so?

I'm sorry for all this trouble. It is quite annoying that Debian chose
to make this unilateral change to library locations that had worked fine
for everybody for many years.

Ian

Bob Hancock

unread,
Sep 20, 2011, 9:03:09 AM9/20/11
to golan...@googlegroups.com
I appreciate your concern and all your help.  Not much you can do when Debian takes its own path.

These are all the libc.so files on my system.

rhancock@rhancock-X201:~/toolbox$ sudo find / -name libc.so
[sudo] password for rhancock: 
/usr/lib32/libc.so
/usr/lib/libc.so
/usr/lib/x86_64-linux-gnu/libc.so

These are the lib64 directories.
rhancock@rhancock-X201:~/toolbox$ sudo find / -type d -name lib64
/usr/src/linux-headers-2.6.38-8/arch/sh/lib64
/usr/src/linux-headers-2.6.38-11/arch/sh/lib64
/usr/src/linux-headers-2.6.38-10/arch/sh/lib64

Ian Lance Taylor

unread,
Sep 20, 2011, 9:26:41 AM9/20/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

From your earlier report it sounds like gcc is looking for
/usr/lib64/libc.so as well. Perhaps there should be a symlink in /usr
from lib64 -> x86_64-linux-gnu.

Ian

Bob Hancock

unread,
Sep 20, 2011, 10:18:25 AM9/20/11
to golan...@googlegroups.com
This got me much farther in the build.

rhancock@rhancock-X201:/usr/lib64$ file -b libc.so
symbolic link to `/usr/lib/x86_64-linux-gnu/libc.so'

Now the error involves Pthreads.  Is it looking for a lib?

...
checking for int_least32_t... yes
checking for int_fast32_t... yes
checking for uint64_t... yes
checking what to include in gstdint.h... stdint.h (already complete)
configure: error: Pthreads are required to build libgomp
make[2]: *** [configure-stage1-target-libgomp] Error 1

Ian Lance Taylor

unread,
Sep 20, 2011, 11:40:25 AM9/20/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

Most likely you need to set up a symlink for libpthread.so just as you
did for libc.so. libpthread.so should also be a small text file. You
may also need one for libdl.so; libdl.so is a binary, not a text file.

Ian

Bob Hancock

unread,
Sep 20, 2011, 1:27:00 PM9/20/11
to golan...@googlegroups.com
I created some other symlinks and below is the latest error after 60 minutes of building on my laptop.  Is there a finite list of symlinks that I can make or is the only way to try them one at a time?  

I've listed the output of the latest error below, followed by the step I've take to get to this point.

/home/rhancock/objdir/./prev-gcc/xgcc -B/home/rhancock/objdir/./prev-gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -c   -g -O2 -gtoggle -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gccgo/gcc -I../../gccgo/gcc/. -I../../gccgo/gcc/../include -I../../gccgo/gcc/../libcpp/include  -I../../gccgo/gcc/../libdecnumber -I../../gccgo/gcc/../libdecnumber/bid -I../libdecnumber    cc1-checksum.c -o cc1-checksum.o
/home/rhancock/objdir/./prev-gcc/xgcc -B/home/rhancock/objdir/./prev-gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include      -g -O2 -gtoggle -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o cc1 c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o i386-c.o default-c.o \
 cc1-checksum.o main.o tree-browser.o libbackend.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lmpc -lmpfr -lgmp -rdynamic -ldl  -L../zlib -lz
/opt/gold/bin/ld: error: cannot find -lmpc
libbackend.a(builtins.o):builtins.c:function do_mpc_arg1: error: undefined reference to 'mpc_init2'
libbackend.a(builtins.o):builtins.c:function do_mpc_arg1: error: undefined reference to 'mpc_clear'
libbackend.a(builtins.o):builtins.c:function do_mpc_arg2: error: undefined reference to 'mpc_init2'
libbackend.a(builtins.o):builtins.c:function do_mpc_arg2: error: undefined reference to 'mpc_init2'
libbackend.a(builtins.o):builtins.c:function do_mpc_arg2: error: undefined reference to 'mpc_clear'
libbackend.a(builtins.o):builtins.c:function do_mpc_arg2: error: undefined reference to 'mpc_clear'
libbackend.a(builtins.o):builtins.c:function fold_builtin_2: error: undefined reference to 'mpc_pow'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_sqrt'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_sinh'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_sin'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_acosh'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_acos'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_tanh'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_tan'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_log'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_atanh'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_atan'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_asinh'
libbackend.a(builtins.o):builtins.c:function fold_builtin_n: error: undefined reference to 'mpc_asin'
libbackend.a(builtins.o):builtins.c:function fold_builtin_ccos: error: undefined reference to 'mpc_cos'
libbackend.a(builtins.o):builtins.c:function fold_builtin_ccos: error: undefined reference to 'mpc_cosh'
libbackend.a(builtins.o):builtins.c:function fold_builtin_cexp: error: undefined reference to 'mpc_exp'
libbackend.a(fold-const.o):fold-const.c:function const_binop: error: undefined reference to 'mpc_div'
libbackend.a(fold-const.o):fold-const.c:function const_binop: error: undefined reference to 'mpc_mul'
libbackend.a(toplev.o):toplev.c:function print_version: error: undefined reference to 'mpc_get_version'
libbackend.a(toplev.o):toplev.c:function print_version: error: undefined reference to 'mpc_get_version'
collect2: error: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/home/rhancock/objdir/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/rhancock/objdir'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/rhancock/objdir'
make: *** [all] Error 2

real 60m28.935s
user 53m59.250s
sys 2m12.100s

The steps so far:

Build binutils

cd ~

cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src login
[password is "anoncvs"]
cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src co binutils
mkdir binutils-objdir
cd binutils-objdir
../src/configure  --enable-gold=default  --prefix=/opt/gold
make
make install

Create symlinks

cd /usr/lib64
sudo ln -s /usr/lib/x86_64-linux-gnu/libc.so libc.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libpthread.so libpthread.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libdl.so  libdl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libm.so libm.so

Build gccgo
cd ~

Ian Lance Taylor

unread,
Sep 20, 2011, 1:50:23 PM9/20/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> -lmpc -lmpfr -lgmp -rdynamic -ldl -L../zlib -lz
> /opt/gold/bin/ld: error: cannot find -lmpc

Current gcc requires some additional libraries: mpc, mpfr, and gmp. It
looks like you have mpfr and gmp. You also need mpc. It may be in the
libmpc-dev package. Then you may need symlinks for those three
libraries, or you may not, I don't know. The linker didn't complain
about missing -lmpfr or -lgmp, so you may not need symlinks for those.
In any case, that should be all you need, I hope.

Ian

Bob Hancock

unread,
Sep 20, 2011, 4:39:58 PM9/20/11
to golan...@googlegroups.com
Eureka!  The build completed and installed.  I'm going to try to duplicate the process on another machine tomorrow, and I will post the results.

Last question, when specifying LD_LIBRARY_PATH does MACHINE a string like "amd64"?  To what does VERSION refer?

Thanks for all your help. The support has been awesome.  

The building of the compiler will be part of a presentation for the New York City GTUG at the end of the month.  I hope I can provide the members with a set of instructions that will work for everyone.

Ian Lance Taylor

unread,
Sep 20, 2011, 4:54:16 PM9/20/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> Eureka! The build completed and installed. I'm going to try to duplicate
> the process on another machine tomorrow, and I will post the results.

Cool!

> Last question, when specifying LD_LIBRARY_PATH does MACHINE a string like "amd64"?
> To what does VERSION refer?

MACHINE is something like x86_64-unknown-linux-gnu. VERSION is the
version of gcc, something like 4.7.0.

To put it another way, MACHINE is what gcc (or gccgo) -v prints after
"Target:". VERSION is what it prints immediately after "version".

Ian

Bob Hancock

unread,
Sep 20, 2011, 5:18:12 PM9/20/11
to golan...@googlegroups.com
That worked.  

One last caveat.  You need an additional symlink to run a compiled program.

sudo ln -s /usr/local/lib64/libgo.so.0 libgo.so.0


Bob Hancock

unread,
Sep 21, 2011, 2:59:00 PM9/21/11
to golan...@googlegroups.com
I installed Ubunut 11.04 on a new system and then attempted to install gccgo, but I can't get binutils to build on this system.  I don't have more time to spend with this right now; I need to get back to the Go work.

This is how far I got.
sudo apt-get install bison gawk gcc libc6-dev make
sudo apt-get install binutils-dev textinfo flex libmpc-dev



cd /usr/lib64
sudo ln -s /usr/lib/x86_64-linux-gnu/libc.so libc.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libpthread.so libpthread.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libdl.so  libdl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libm.so libm.so
sudo ln -s /usr/local/lib64/libgo.so.0 libgo.so.0

Build binutils

cd ~
cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src login
[password is "anoncvs"]
cvs -z 9 -d :pserver:ano...@sourceware.org:/cvs/src co binutils
mkdir binutils-objdir
cd binutils-objdir
../src/configure  --enable-gold=default  --prefix=/opt/gold
make

config.status: creating po/POTFILES config.status: creating po/Makefile make[2]: Entering directory `/home/rhancock/binutils-objdir/binutils' if [ -r sysinfo.c ]; then \ gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -Wno-error sysinfo.c ; \ else \ gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -Wno-error ../../src/binutils/sysinfo.c ; \ fi if [ -r syslex.c ]; then \ gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -Wno-error syslex.c ; \ else \ gcc -c -I. -I../../src/binutils -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -Wno-error ../../src/binutils/syslex.c ;\ fi syslex.c:1:1: warning: return type defaults to ‘int’ syslex.c:1:1: warning: function declaration isn’t a prototype gcc -g -O2 -o sysinfo sysinfo.o syslex.o syslex.o: In function `main': /home/rhancock/binutils-objdir/binutils/syslex.c:1: multiple definition of `main' sysinfo.o:/home/rhancock/binutils-objdir/binutils/sysinfo.y:409: first defined here sysinfo.o: In function `yyparse': sysinfo.c:(.text+0x3e9): undefined reference to `yylex' collect2: ld returned 1 exit status make[2]: *** [sysinfo] Error 1 make[2]: Leaving directory `/home/rhancock/binutils-objdir/binutils' make[1]: *** [all-binutils] Error 2 make[1]: Leaving directory `/home/rhancock/binutils-objdir' make: *** [all] Error 2


Ian Lance Taylor

unread,
Sep 21, 2011, 3:56:59 PM9/21/11
to golan...@googlegroups.com
Bob Hancock <hancock...@gmail.com> writes:

> sysinfo.o:/home/rhancock/binutils-objdir/binutils/sysinfo.y:409: first
> defined here sysinfo.o: In function `yyparse': sysinfo.c:(.text+0x3e9):
> undefined reference to `yylex' collect2: ld returned 1 exit status make[2]:
> *** [sysinfo] Error 1 make[2]: Leaving directory

I think this error normally means that you need to install the flex
package, and then start over with a fresh directory.

Ian

Bob Hancock

unread,
Sep 21, 2011, 4:22:41 PM9/21/11
to Ian Lance Taylor, golan...@googlegroups.com
I couldn't find this information with a Google search.  

I had not installed flex before I ran it the first time.  I did not know that I would need to start with a fresh directory.  On to building gccgo.

Bob Hancock

unread,
Sep 22, 2011, 7:21:37 PM9/22/11
to golan...@googlegroups.com
This should close out the thread.  I've built the compiler on another system with a fresh install of Ubunut 11.04 64-bit.  Here are the steps.


Thanks to Ian for all the incredible help.
Reply all
Reply to author
Forward
0 new messages