This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16507] gcc_s not found when linking 64-bit C++
- From: "bfriesen at simple dot dallas dot tx dot us" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jul 2004 13:22:45 -0000
- Subject: [Bug c++/16507] gcc_s not found when linking 64-bit C++
- References: <20040713003639.16507.bfriesen@simple.dallas.tx.us>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bfriesen at simple dot dallas dot tx dot us 2004-07-13 13:22 -------
Subject: Re: gcc_s not found when linking 64-bit C++
On Tue, 13 Jul 2004, ebotcazou at gcc dot gnu dot org wrote:
>
> ------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-07-13 06:53 -------
>> Linking C++ programs fails due to either the wrong (32-bit) libgcc_s.so.1being
>> installed in the compiler's default directory
>
> I don't think so, the linker would have complained about ELF class mismatch.
>
>> or the linker search path not being specified correctly.
>
> Neither, I see -L/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1 and
> libgcc_s.so should be there because of --enable-version-specific-runtime-libs.
Right. I used a wrong command in my bug report, however, the actual
condition remains. Here is the good stuff:
blade:gcc/sparc64-sun-solaris2.9/3.4.1# pwd
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1
blade:gcc/sparc64-sun-solaris2.9/3.4.1# file libgcc_s.so.1
libgcc_s.so.1: ELF 32-bit MSB dynamic lib SPARC32PLUS Version 1, V8+
Required, dynamically linked, not stripped
> This suggests that the compiler was not properly installed, or maybe not
> installed at all. Please try again to issue "gmake install".
>
> [As a side note, specifying -mcpu=ultrasparc doesn't imply 32-bit mode.]
I have done another configure and build like:
% CC='gcc -m64' /home/bfriesen/src/gnu/gcc-3.4.1/configure
--prefix=/usr/local/sparc64 --program-suffix=-3.4.1 --enable-shared
--enable-threads --enable-version-specific-runtime-libs
--enable-languages=c,c++ --disable-nls sparc64-sun-solaris2.9
% gmake bootstrap
% gmake install
And when compiling a trivial C++ program I see this error:
% /usr/local/sparc64/bin/c++-3.4.1 -o exceptions exceptions.cpp
ld: fatal: library -lgcc_s: not found
ld: fatal: library -lgcc_s: not found
ld: fatal: File processing errors. No output written to exceptions
collect2: ld returned 1 exit status
The following shows the same thing as in my bug report. The linker
(Sun linker, not GNU) is not being provided with the right paths in
order to find the 64-bit libgcc_s.so:
% /usr/local/sparc64/bin/c++-3.4.1 -v -o exceptions exceptions.cpp
Reading specs from
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/specs
Configured with: /home/bfriesen/src/gnu/gcc-3.4.1/configure
--prefix=/usr/local/sparc64 --program-suffix=-3.4.1 --enable-shared
--enable-threads --enable-version-specific-runtime-libs
--enable-languages=c,c++ --disable-nls sparc64-sun-solaris2.9
Thread model: posix
gcc version 3.4.1
/usr/local/sparc64/libexec/gcc/sparc64-sun-solaris2.9/3.4.1/cc1plus
-quiet -v -D__arch64__ -D__sparcv9 exceptions.cpp -quiet -dumpbase
exceptions.cpp -mcpu=v9 -auxbase exceptions -version -o
/var/tmp//cclL77eN.s
ignoring nonexistent directory
"/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/../../../../sparc64-sun-solaris2.9/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/include/c++
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/include/c++/sparc64-sun-solaris2.9
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/include/c++/backward
/usr/local/include
/usr/local/sparc64/include
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/include
/usr/include
End of search list.
GNU C++ version 3.4.1 (sparc64-sun-solaris2.9)
compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=100 --param
ggc-min-heapsize=131072
/usr/ccs/bin/as -V -Qy -s -xarch=v9 -o /var/tmp//ccBepUPw.o
/var/tmp//cclL77eN.s
/usr/ccs/bin/as: Sun WorkShop 6 update 2 Compiler Common 6.2
Solaris_9_CBE 2001/04/02
/usr/local/sparc64/libexec/gcc/sparc64-sun-solaris2.9/3.4.1/collect2
-V -Y P,/usr/lib/sparcv9 -Qy -o exceptions
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/crt1.o
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/crti.o
/usr/ccs/lib/sparcv9/values-Xa.o
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/crtbegin.o
-L/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1
-L/usr/ccs/bin/sparcv9 -L/usr/ccs/bin -L/usr/ccs/lib/sparcv9
-L/usr/ccs/lib
-L/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/../../..
-L/lib/sparcv9 -L/usr/lib/sparcv9 /var/tmp//ccBepUPw.o -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc -lc
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/crtend.o
/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.381
ld: fatal: library -lgcc_s: not found
ld: fatal: library -lgcc_s: not found
ld: fatal: File processing errors. No output written to exceptions
collect2: ld returned 1 exit status
Note that this manually corrected link does work:
% /usr/local/sparc64/bin/c++-3.4.1
-L/usr/local/sparc64/lib/gcc/sparc64-sun-solaris2.9/3.4.1/sparcv9 -o
exceptions exceptions.cpp
So there is either a problem with the specs file, or the default
libgcc_s.so is expected to be 64-bit (but is not).
Bob
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us
http://www.simplesystems.org/users/bfriesen
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16507