From mboxrd@z Thu Jan 1 00:00:00 1970 From: Larry McQueary To: gcc@gnu.org Subject: FAQ answer regarding dynamic linking Date: Tue, 27 Aug 2002 11:34:00 -0000 Message-id: <3D6BC5D6.5010702@attbi.com> X-SW-Source: 2002-08/msg01767.html Hi, I do not understand the answer to the following FAQ entry: http://gcc.gnu.org/faq.html#rpath Rather, it would be fairer to say that I don't understand how exactly to IMPLEMENT the answer. I am running Solaris 2.8 and successfully built gcc-3.2 using the "bootstrap-lean" target. It built successfully from start to finish, however, make check failed miserably for libstdc++-v3. Further, I could compile, but not run, a simple helloworld program: #include int main(void) { printf("Hello, World!\n"); } Compiles cleanly using g++ -o helloworld helloworld.cpp But I get a seg fault when attempting to run helloworld. Here's the output from gdb: gdb helloworld core GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.8"... Core was generated by `./helloworld'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/local/lib/libstdc++.so.5...done. Loaded symbols for /usr/local/lib/libstdc++.so.5 Reading symbols from /usr/lib/libm.so.1...done. Loaded symbols for /usr/lib/libm.so.1 Reading symbols from /usr/local/lib/libgcc_s.so.1...done. Loaded symbols for /usr/local/lib/libgcc_s.so.1 Reading symbols from /usr/lib/libc.so.1...done. Loaded symbols for /usr/lib/libc.so.1 Reading symbols from /usr/lib/libdl.so.1...done. Loaded symbols for /usr/lib/libdl.so.1 Reading symbols from /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1...done. Loaded symbols for /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1 #0 __register_frame_info_bases (begin=0xff2b0000, ob=0xff2b0000, tbase=0x0, dbase=0x0) at ../../gcc-3.2/gcc/unwind-dw2-fde.c:83 83 ob->tbase = tbase; Here's the output from c++ -v c++ -v -g -o helloworld helloworld.cpp Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/specs Configured with: ../gcc-3.2/configure --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld Thread model: posix gcc version 3.2 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__PRAGMA_REDEFINE_EXTNAME -D__sparc -D__sun -D__unix -Asystem=unix -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__WCHAR_TYPE__=long int -D__WINT_TYPE__=long int -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc helloworld.cpp -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase helloworld.cpp -g -version -o /var/tmp//cccCWJLF.s GNU CPP version 3.2 (cpplib) (sparc ELF) GNU C++ version 3.2 (sparc-sun-solaris2.8) compiled by GNU C version 3.2. ignoring nonexistent directory "NONE/include" ignoring nonexistent directory "/usr/local/sparc-sun-solaris2.8/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include/c++/3.2 /usr/local/include/c++/3.2/sparc-sun-solaris2.8 /usr/local/include/c++/3.2/backward /usr/local/include /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/include /usr/include End of search list. /usr/local/bin/as -V -Qy -s -o /var/tmp//ccyGzP5i.o /var/tmp//cccCWJLF.s GNU assembler version 2.13 (sparc-sun-solaris2.8) using BFD version 2.13 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o helloworld /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crt1.o /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crti.o /usr/ccs/lib/values-Xa.o /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtbegin.o -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2 -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/../../../../sparc-sun-solaris2.8/lib -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/../../.. /var/tmp//ccyGzP5i.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lc /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtend.o /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtn.o GNU ld version 2.13 Supported emulations: elf32_sparc elf64_sparc On referring to the FAQ, I found the entry above and added "-R/usr/local/lib" to "*link:" in the gcc specs file. However, when I run g++ to build my little helloworld program, I still get the same results as before (seg fault/core dump). Can you help by giving me more specific instructions on how to solve this problem or what to add to the -R? What is the preferred solution here? Thanks, Larry McQueary