CC 5.8 using stlport error
i get the following error: - please ellaborate - what is missing?
Undefinedfirst referenced
symbolin file
std::basic_istream<char,__type_0>&std::operator>><std::char_ traits><char> >(std::basic_istream<char,__type_0>&,unsigned char&) /sunos-5.10-CC/libDML_Inf.so
bool std::operator!=<char,std::char_traits><char>,std::allocator<char > >(const std::basic_string<__type_0,__type_1,__type_2>&,const __type_0*) /sunos-5.10-CC/libDML_Inf.so
std::basic_ostream<__type_0,__type_1>&std::operator<<<char,s td::char_traits><char>,std::allocator<char> >(std::basic_ostream<__type_0,__type_1>&,const std::basic_string<__type_0,__type_1,__type_2>&) Manager.o.sun10
std::basic_ostream<char,__type_0>&std::operator<<<std::char_ traits><char> >(std::basic_ostream<char,__type_0>&,const unsigned char*) /sunos-5.10-CC/libDML_Inf.so
ld: fatal: Symbol referencing errors. No output written to /sunos-5.10-CC/Cleaner
*** Error code 1
make: Fatal error: Command failed for target `/sunos-5.10-CC/Cleaner'
Current working directory src
*** Error code 1
command line
===============
CC -KPIC -mt -g -DNDEBUG -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -D__EXTENSIONS__ -I../inc -I../../ -I../ -I/ACE-5.5.0/ACE_wrappers -I//Include -I/app/oracle/oracle/product/10.2.0/db_1/rdbms/demo -I/u01/app/oracle/oracle/product/10.2.0/db_1/rdbms/public -I/u01/app/oracle/oracle/product/10.2.0/db_1/plsql/public -I/u01/app/oracle/oracle/product/10.2.0/db_1/network/public -I -I/opt/SUNWspro/prod/include/CC/stlport4-o CleanerProperties.o.sun10 -c CleanerProperties.cpp
Linking /Bin/sunos-5.10-CC/Cleaner ...
CC -o /Bin/sunos-5.10-CC/Cleaner -L -L/app/oracle/oracle/product/10.2.0/db_1 -xnolib -mt -compat=5 -library=stlport4,no%Cstd -lsocket -lstlport -lposix4 -lm -lc -lCrun -ldl -lnsl -lgen -lposix4 -ladm -lrt-L//Bin/sunos-5.10-CC -L/opt/SUNWspro/lib/stlport4 -L/Bin/sunos-5.10-CC -lDML_Inf -lCL.Common -lCL.CleanActions -lACE -lclntsh -lpthread \
Main.o.sun10 Manager.o.sun10 SysConf.o.sun10 CleanerProperties.o.sun10
[2266 byte] By [
eyalzm] at [2007-11-26 8:40:15]

# 1
The missing symbols are supposed to be in /usr/lib/libCstd.so.1
Probably you have not installed the required C++ Runtime Library patch that comes with the compiler. The patch must be installed on every computer that runs the compiler or that runs C++ programs compiled by the compiler.
The simplest way to get the patch is to run the Sun Studio installer, selecting only the Solaris patches.
Alternatively, you can download all current patches here:
http://developers.sun.com/prodtech/cc/downloads/patches/index.jsp
# 2
i use stlport and as i understand - both stl libraries (stlport and Cstd) cannot be merge at the same application
# 3
You are correct that you cannot mix the default libCstd with STLport in the same program.
Sun C++ uses the libCstd headers and links libCstd unless you tell it not to.
If you want to use the STLport that comes with Sun C++, you need to add the option
-library=stlport4
to every CC command line, compiling and linking. This option ensures you get the STLport headers in the compilations instead of the libCstd headers, and link libstlport instead of libCstd.
Never use -I, -l, or -L options that point into the compiler installation area.
Such options can prevent the right headers and libraries from being found. Use the approprite -library option instead. Refer to the C++ Users Guide that comes with the compiler for details.
It appears you are linking with Oracle. If you use C++ libraries from Oracle, you cannot use STLport, because the Oracle C++ binaries require libCstd.
# 4
so basically i'll have to move back to gcc where it works fine with oracle. are you sure that oracle uses only libCstd - here is an ldd - no libCstd is there
ldd libclntsh.so
libnnz10.so =>/u01/app/oracle/oracle/product/10.2.0/db_1/lib32/libnnz10.so
libkstat.so.1 => /usr/lib/libkstat.so.1
libnsl.so.1 =>/usr/lib/libnsl.so.1
libsocket.so.1 =>/usr/lib/libsocket.so.1
libgen.so.1 =>/usr/lib/libgen.so.1
libdl.so.1 =>/usr/lib/libdl.so.1
libsched.so.1 => /usr/lib/libsched.so.1
libaio.so.1 =>/usr/lib/libaio.so.1
librt.so.1 =>/usr/lib/librt.so.1
libm.so.2 =>/usr/lib/libm.so.2
libc.so.1 =>/usr/lib/libc.so.1
libmp.so.2 =>/usr/lib/libmp.so.2
libmd5.so.1 =>/usr/lib/libmd5.so.1
libscf.so.1 =>/usr/lib/libscf.so.1
libdoor.so.1 => /usr/lib/libdoor.so.1
libuutil.so.1 => /usr/lib/libuutil.so.1
/platform/SUNW,Sun-Fire-T200/lib/libc_psr.so.1
# 5
A small part of Oracle is written in C++. I believe that part uses libCstd. You should check with Oracle tech support. If I'm wrong, or if the part of Oracle you are using does not use C++, you can use STLport.
# 6
clamage45 wrote: "A small part of Oracle is written in C++. I believe that part uses libCstd. You should check with Oracle tech support. If I'm wrong, or if the part of Oracle you are using does not use C++, you can use STLport."
We use Oracle (OCI - libclntsh) extensively, and we use the bundled STLport with Studio 11. We have not seen any problems with this combination.
If you use OCCI (the C++ interface) you *may* run into problems, but plain OCI should be just fine.
You could also consider otl (otl.sf.net) if you absolutely need a C++ interface. It's header-only, and will work properly with the bundled STLport.
Michael
# 7
Thanks, u use OTL all the time - and got some problems with OCCI before so using native OCI only with otl as an OCI wrapper where it is feasible.Thanks for the important info - i nearly neglected the CC compiler for g++ which I used before.
# 8
can you provide with a CC command line for compile and link for i still face the problem of the first post - some symbols of std are missing.
# 9
No problem.
You need to be quite careful of how you're compiling - I see a number of things that are odd with your compile and link steps above. Specifically, you're specifying -library=stlport4 and also adding STLport to your link line and include lines.
From your compile and link lines posted above, you're using almost exactly the same third-party libraries as we are (ACE/TAO 5.5.x/1.5.x, Oracle 10g). However, I don't you specifying -DACE_HAS_STLPORT... did you really compile your ACE with stlport=1? You do need to do this...
Here are sample compile and link lines from in of my build logs. Note that I just let Sun Studio take care of what to include/exclude when I specify -library=stlport4, and I do NOT try to mess with MT defines. I also don't know why you're specifying -xnolib or compat=5. Note that I mimick what the ACE build system defines to ensure consistency, and that my copy of ACE was built with stlport=1 specified.
The general rule of thumb is to simplify your compile line as much as possible while having it do the right thing, then create a matching link line.
Anyway, here's the compile and link lines...
Michael
/opt/SUNWspro/bin/CC -o build/SunOS/sparc/32/sunpro/inline/libreprocess/so_ReprocessStream.o -c -mt -xtarget=ultra3 -xarch=v8plusa -xO5 -library=stlport4 -features=tmplife -features=tmplrefstatic -xtarget=ultra3 -xarch=v8plusa -KPIC -DACE_HAS_ACE_SVCCONF -DACE_HAS_ACE_TOKEN -DACE_HAS_EXCEPTIONS -DACE_HAS_STLPORT -DACE_NDEBUG -DACE_USE_RCSID=0 -DNDEBUG -DOFFICIAL_BUILD_NUMBER="\"7.1.0.20060714.001\"" -DSUN_CC_HAS_PVFC_BUG -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_NDEBUG -D__ACE_INLINE__ -I. -IDBAccess/include -IRatedCDR_Access/include -Ibuild/SunOS/sparc/32/sunpro/inline/idl -Ibuild/SunOS/sparc/32/sunpro/inline -I/swrepo/solaris_sparcv8/studio11/boost/1.32.0 -I/swrepo/solaris_sparcv8/studio11/acetao/5.5.1_1.5.1/TAO -I/swrepo/solaris_sparcv8/studio11/acetao/5.5.1_1.5.1/TAO/orbsvcs -I/swrepo/solaris_sparcv8/studio11/acetao/5.5.1_1.5.1 -I/opt/oracle/product/10.2.0.1/rdbms/public libreprocess/ReprocessStream.cpp
CC -o build/SunOS/sparc/32/sunpro/inline/Preprocess/BufferedInputFileReaderBVT -mt -library=stlport4 -features=tmplife -features=tmplrefstatic -znow -xtarget=ultra3 -xarch=v8plusa build/SunOS/sparc/32/sunpro/inline/Preprocess/BufferedInputFileReaderBVT.o -Lbuild/SunOS/sparc/32/sunpro/inline/Preprocess -Lbuild/SunOS/sparc/32/sunpro/inline/CDRStorage -Lbuild/SunOS/sparc/32/sunpro/inline/CDRConversion -Lbuild/SunOS/sparc/32/sunpro/inline/common -Lbuild/SunOS/sparc/32/sunpro/inline/idl -Lbuild/SunOS/sparc/32/sunpro/inline/ipa -Lbuild/SunOS/sparc/32/sunpro/inline/DBAccess -Lbuild/SunOS/sparc/32/sunpro/inline/excep -L/swrepo/solaris_sparcv8/studio11/boost/1.32.0/stage/lib -L/swrepo/solaris_sparcv8/studio11/acetao/5.5.1_1.5.1/lib -L/opt/oracle/product/10.2.0.1/lib32 -lumem -lpreprocess -lcdrstorage -lcdrconversion -lcommon -lipa -ldbaccess -lidl -lexcep -lTAO_PortableServer -lTAO_CosNaming -lTAO_AnyTypeCode -lTAO -lACE -lsocket -ldl -lnsl -lgen -lposix4 -ladm -lclntsh
# 10
Thanks for the usefull info - ACE was built with the stlport flag on.
other flags will be added and tested.
the -I for the stlport was for i otherwise got strage errors of /./iostream of the libCstd includes - which led me thinking the include path is not routed ok to the sltport library - so i helped the includes.
xnolib and other compat are part of my trying to succesfully build the system using Sun CC 5.8 compiler - i've also check ACE defines but still had many errors.
# 11
Hi,
You do realise that your compile line does not include -library=stlport4?
Give the following a try. If following this advice does not help, I'm out of ideas :-(
Michael
In the link line you posted, remove these flags:
-xnolib
-compat=5
,no%Cstd
-lstlport
-lc
-lCrun
-lpthread
-L/opt/SUNWspro/lib/stlport4
Add the -g flag (since you're using that with your compile)
This leaves you with:
CC -o /path/to/bin -mt -g -library=stlport4 -L/app/oracle/oracle/product/10.2.0/db_1 -L/Bin/sunos-5.10-CC -lDML_Inf -lCL.Common -lCL.CleanActions -lACE -lclntsh -lsocket -lposix4 -lm -ldl -lnsl -lgen -ladm -lrt
Now clean up your compile line so that it looks like this:
CC -c -mt -g -library=stlport4 -KPIC -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__ -I../inc -I../../ -I../ -I//Include -I/ACE-5.5.0/ACE_wrappers -I/opt/oracle/product/10.2.0.1/rdbms/public -o outputfile inputfile
Give that a try.
You may also want to look at why the following are being done (they're generally not needed):
-DNDEBUG with -g - logically these conflict.
-D_POSIX_PTHREAD_SEMANTICS - why? ACE does not need this. most code does not need this either.
-D__EXTENSIONS__ - are you *sure* you need this? Try without it.
Why all the paths to $ORACLE_HOME? Only $ORACLE_HOME/rdbms/public is needed in 10g.
# 12
I've fixed the compile and link command line - looks very similar to the one you've posted Michael.all code compiles , link and runs succesfully with all tests passed.Thanks for the great advices.