This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: string link problems with gcc3.2.1
- From: LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com>
- To: Todd Dukes <Todd dot Dukes at motorola dot com>
- Cc: gcc-help at gcc dot gnu dot org, todd dot dukes at motorola dot com
- Date: 23 Jan 2003 12:37:31 -0800
- Subject: Re: string link problems with gcc3.2.1
- References: <200301232033.h0NKX3x29804@shadow.somerset.sps.mot.com>
Todd Dukes <Todd.Dukes@motorola.com> writes:
> I build binutils-2.13.2 and gcc-3.2.1 using on Sparc Solaris
> the following commands.
>
> bash-2.03$ uname -a
> SunOS shadow.somerset.sps.mot.com 5.8 Generic_108528-11 sun4u sparc SUNW,Ultra-60
>
> bash-2.03$ mkdir binutils-obj
> bash-2.03$ cd binutils-obj
> bash-2.03$ ../binutils-2.13.2/configure --prefix=/local/tdukes/gcc-3.2.1-64 --enable-64-bit-bfd
> bash-2.03$ make check
> bash-2.03$ make install
>
> bash-2.03$ mkdir gcc-obj
> bash-2.03$ cd gcc-obj/
> bash-2.03$ ../gcc-3.2.1/configure --prefix=/local/tdukes/gcc-3.2.1-64/ --enable-threads --with-gnu-as --with-as=/local/tdukes/gcc-3.2.1-64/bin/as --with-gnu-ld --with-ld=/local/tdukes/gcc-3.2.1-64/bin/ld sparc-sun-solaris2.8
>
> bash-2.03$ make bootstrap
>
> after a long long time (several hours) this completed.
>
> bash-2.03$ make install
>
> after a long long time (almost two hours) this completed.
>
>
> When I try to compile a simple C++ program that only defines
> a string and returns, it won't link:
>
> bash-2.03$ cat str-test2.C
> #include <string>
>
> using namespace std;
> int main()
> {
> basic_string<char, std::char_traits<char>, std::allocator<char> > s;
> return 0;
> }
>
> bash-2.03$ which g++
> /local/tdukes/gcc-3.2.1-64/bin/g++
> bash-2.03$ g++ -o str-test2 str-test2.C
> /tmp/cccTAoYH.o: In function `main':
> /tmp/cccTAoYH.o(.text+0xe8): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string[in-charge]()'
> /tmp/cccTAoYH.o(.text+0xf4): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
> /tmp/cccTAoYH.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> collect2: ld returned 1 exit status
> bash-2.03$
>
> Does anyone have an idea what is going on?
Do you have /usr/local/tdukes/lib ($(prefix)/lib) in your
LD_LIBRARY_PATH, or in your system-specific library search path?
Try:
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/tdukes/lib"
and run the program again. Also, read up on your system's dynamic
linker. I think 'man ld.so.1' is the place to start for solaris.