> Greg wrote:
>> Hi all. For starters, uname -a:
>> SunOS sol 5.10 Generic_137111-08 sun4u sparc SUNW,Sun-Fire-880
>>
>> Something about my makefile and/or my environment is broken. When I
>> compile this program:
>>
>> #include <iostream>
>> main(){std::cout << "Hello\n";}
>>
>> with
>>
>> g++ -O1 simple.cpp -o simple
>>
>> then ldd -r simple:
>>
>> libstdc++.so.6 => /opt/csw/lib/libstdc++.so.6
>> libm.so.2 => /usr/lib/libm.so.2
>> libgcc_s.so.1 => /opt/csw/lib/libgcc_s.so.1
>> libc.so.1 => /usr/lib/libc.so.1
>> libm.so.1 => /usr/lib/libm.so.1
>> symbol not found:
>> _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
>> (simple)
>>
>> This unresolved symbol prevents the app from running. Any suggestions
>> would be welcome.
>
>
> Don't use the blastwave versions of libstdc++
Why not ?
Works perfectly for me.
thus :
32-bit test first
$ env | sort
CC=/opt/csw/gcc4/bin/gcc
COLUMNS=80
CPPFLAGS=-I/opt/csw/include
CXX=/opt/csw/gcc4/bin/g++
EDITOR=/usr/xpg4/bin/vi
HOME=/home/dclarke
LANG=C
LC_ALL=C
LC_MESSAGES=en_US.UTF-8
LD_OPTIONS=-R/opt/csw/lib/$ISALIST:/opt/csw/lib
-L/opt/csw/lib/$ISALIST:/opt/csw/lib
LINES=24
LOGNAME=dclarke
MAIL=/usr/mail/dclarke
PATH=/opt/csw/gcc4/bin:/opt/csw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/sbin:/bin:/usr/sbin:/usr/dt/bin:/usr/openwin/bin
PWD=/export/medusa/dclarke/build/test
SHELL=/usr/xpg4/bin/sh
SRC=/export/medusa/src
TERM=vt100
TZ=GMT0
USER=dclarke
_=/usr/xpg4/bin/env
$ cat locale.cpp
#include <iostream>
#include <locale>
int main(int argc, char* argv[])
{
try
{
std::ios::sync_with_stdio(false);
std::locale loc(argc > 1 ? argv[1] : "");
std::cout << loc.name() << std::endl;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
$ which g++
/opt/csw/gcc4/bin/g++
$ g++ --version
g++ (GCC) 4.3.4
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ -v -march=i386 -mno-mmx -mno-sse -malign-double
-mpreferred-stack-boundary=8 -m32 -o locale locale.cpp
Using built-in specs.
Target: i386-pc-solaris2.10
Configured with: /export/medusa/dclarke/build/GCC/gcc-4.3.4/configure
--build=i386-pc-solaris2.10 --with-gnu-as --with-as=/opt/csw/bin/gas
--without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-cpu-32=i386
--with-cpu-64=opteron --with-arch-32=i386 --with-arch-64=opteron
--enable-stage1-languages=c --enable-nls --with-libiconv-prefix=/opt/csw
--enable-threads=posix --prefix=/opt/csw/gcc4 --with-local-prefix=/opt/csw
--enable-shared --enable-multilib --with-included-gettext
--with-system-zlib --with-gmp=/opt/csw --with-mpfr=/opt/csw
--enable-languages=c,c++,objc,fortran --enable-bootstrap
Thread model: posix
gcc version 4.3.4 (GCC)
COLLECT_GCC_OPTIONS='-v' '-march=i386' '-mno-mmx' '-mno-sse'
'-malign-double' '-mpreferred-stack-boundary=8' '-m32' '-o' 'locale'
'-shared-libgcc'
/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/cc1plus -quiet -v
locale.cpp -quiet -dumpbase locale.cpp -march=i386 -mno-mmx -mno-sse
-malign-double -mpreferred-stack-boundary=8 -m32 -auxbase locale -version
-o /var/tmp//ccNX7QA5.s
ignoring nonexistent directory
"/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../i386-pc-solaris2.10/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4/i386-pc-solaris2.10
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4/backward
/opt/csw/include
/opt/csw/gcc4/include
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/include
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/include-fixed
/usr/include
End of search list.
GNU C++ (GCC) version 4.3.4 (i386-pc-solaris2.10)
compiled by GNU C version 4.3.4, GMP version 4.3.1, MPFR version
2.4.2-rc1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 2391afcbd74102e31e90cbdd9a392f33
COLLECT_GCC_OPTIONS='-v' '-march=i386' '-mno-mmx' '-mno-sse'
'-malign-double' '-mpreferred-stack-boundary=8' '-m32' '-o' 'locale'
'-shared-libgcc'
/opt/csw/bin/gas -v -V -Qy --32 -s -o /var/tmp//cc31Tklj.o
/var/tmp//ccNX7QA5.s
GNU assembler version 2.19.1 (i386-pc-solaris2.8) using BFD version (GNU
Binutils) 2.19.1
COMPILER_PATH=/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-march=i386' '-mno-mmx' '-mno-sse'
'-malign-double' '-mpreferred-stack-boundary=8' '-m32' '-o' 'locale'
'-shared-libgcc'
/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/collect2 -V -Y
P,/usr/ccs/lib:/usr/lib -Qy -o locale /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/values-Xa.o
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/crtbegin.o
-L/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4
-L/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../..
/var/tmp//cc31Tklj.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/crtend.o /usr/lib/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.496
$
$ /usr/ccs/bin/mcs -p locale
locale:
@(#)SunOS 5.10 Generic January 2005
@(#)SunOS 5.10 Generic January 2005
@(#)SunOS 5.10 Generic January 2005
GCC: (GNU) 4.3.4
GCC: (GNU) 4.3.4
GCC: (GNU) 4.3.4
@(#)SunOS 5.10 Generic January 2005
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.496
$
$ ldd locale
libstdc++.so.6 => /opt/csw/lib/i386/libstdc++.so.6
libm.so.2 => /lib/libm.so.2
libgcc_s.so.1 => /opt/csw/lib/i386/libgcc_s.so.1
libc.so.1 => /lib/libc.so.1
$ elfdump locale | grep PATH
[6] RUNPATH 0x3b3
/opt/csw/lib/$ISALIST:/opt/csw/lib
[7] RPATH 0x3b3
/opt/csw/lib/$ISALIST:/opt/csw/lib
$
$ ./locale POSIX
C
$ ./locale C
C
Here comes a nice GCC bug, sorry, not my fault this time :-)
$ locale -a | grep ca
ca
ca_ES
ca_ES.ISO8859-1
ca_ES.ISO8859-15
ca_es.iso8859...@euro
ca_ES.UTF-8
$ ./locale ca_ES.ISO8859-1
locale::facet::_S_create_c_locale name not valid
Let's try 64-bit you say ?
$ cat hello.cpp
#include <iostream>
int main()
{
std::cout << "Hello, world!\n";
}
$ g++ -v -march=opteron -malign-double -mpreferred-stack-boundary=8 -m64
-o hello hello.cpp
Using built-in specs.
Target: i386-pc-solaris2.10
Configured with: /export/medusa/dclarke/build/GCC/gcc-4.3.4/configure
--build=i386-pc-solaris2.10 --with-gnu-as --with-as=/opt/csw/bin/gas
--without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-cpu-32=i386
--with-cpu-64=opteron --with-arch-32=i386 --with-arch-64=opteron
--enable-stage1-languages=c --enable-nls --with-libiconv-prefix=/opt/csw
--enable-threads=posix --prefix=/opt/csw/gcc4 --with-local-prefix=/opt/csw
--enable-shared --enable-multilib --with-included-gettext
--with-system-zlib --with-gmp=/opt/csw --with-mpfr=/opt/csw
--enable-languages=c,c++,objc,fortran --enable-bootstrap
Thread model: posix
gcc version 4.3.4 (GCC)
COLLECT_GCC_OPTIONS='-v' '-march=opteron' '-malign-double'
'-mpreferred-stack-boundary=8' '-m64' '-o' 'hello' '-shared-libgcc'
/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/cc1plus -quiet -v
-imultilib amd64 hello.cpp -quiet -dumpbase hello.cpp -march=opteron
-malign-double -mpreferred-stack-boundary=8 -m64 -auxbase hello -version
-o /var/tmp//ccA8vNrk.s
ignoring nonexistent directory
"/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../i386-pc-solaris2.10/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4/i386-pc-solaris2.10/amd64
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../../include/c++/4.3.4/backward
/opt/csw/include
/opt/csw/gcc4/include
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/include
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/include-fixed
/usr/include
End of search list.
GNU C++ (GCC) version 4.3.4 (i386-pc-solaris2.10)
compiled by GNU C version 4.3.4, GMP version 4.3.1, MPFR version
2.4.2-rc1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 2391afcbd74102e31e90cbdd9a392f33
COLLECT_GCC_OPTIONS='-v' '-march=opteron' '-malign-double'
'-mpreferred-stack-boundary=8' '-m64' '-o' 'hello' '-shared-libgcc'
/opt/csw/bin/gas -v -V -Qy --64 -s -o /var/tmp//ccmS8p7M.o
/var/tmp//ccA8vNrk.s
GNU assembler version 2.19.1 (i386-pc-solaris2.8) using BFD version (GNU
Binutils) 2.19.1
COMPILER_PATH=/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/amd64/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../amd64/:/lib/amd64/:/usr/lib/amd64/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/:/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-march=opteron' '-malign-double'
'-mpreferred-stack-boundary=8' '-m64' '-o' 'hello' '-shared-libgcc'
/opt/csw/gcc4/libexec/gcc/i386-pc-solaris2.10/4.3.4/collect2 -V -Y
P,/lib/64:/usr/lib/64 -Qy -o hello /usr/lib/amd64/crt1.o
/usr/lib/amd64/crti.o /usr/lib/amd64/values-Xa.o
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/amd64/crtbegin.o
-L/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/amd64
-L/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../../amd64
-L/lib/amd64 -L/usr/lib/amd64
-L/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4
-L/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/../../..
/var/tmp//ccmS8p7M.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/opt/csw/gcc4/lib/gcc/i386-pc-solaris2.10/4.3.4/amd64/crtend.o
/usr/lib/amd64/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.496
$
$ file hello
hello: ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, not
stripped, no debugging information available
$ ldd hello
libstdc++.so.6 => /opt/csw/lib/amd64/libstdc++.so.6
libm.so.2 => /lib/64/libm.so.2
libgcc_s.so.1 => /opt/csw/lib/amd64/libgcc_s.so.1
libc.so.1 => /lib/64/libc.so.1
$
$ elfdump hello | grep PATH
[6] RUNPATH 0x1d8
/opt/csw/lib/$ISALIST:/opt/csw/lib
[7] RPATH 0x1d8
/opt/csw/lib/$ISALIST:/opt/csw/lib
$
$ ./hello
Hello, world!
So what/where is the problem ?
--
Dennis Clarke
[email protected] <- Email related to the open source Solaris
[email protected] <- Email related to open source for Solaris
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code