Solaris Compiler CC - list linking problem from .c file

It is not the clear way to do but we are using STL list and map in C code and compiling with CC(Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-11 2002/10/31).

Compilation goes through fine and creates library say libuacore.a

we also have C++ code which links the library.

But while linking we get following set of undefined reference in libuacore.a

Value expected for flag '-I' for '/usr/TOOLS/COM/SUNWspro6.2/SUNWspro/bin/../WS6

U2/bin/ccfe'.

Undefinedfirst referenced

symbolin file

void std::list<unsigned,std::allocator><unsigned> >::__deallocate_buffers() ../..

/../../build/../protocols/sipadaptor/sipua/libs/libuacore.a(uacore_usermsgproc. o

)

__rwstd::__rb_tree<const char*,std::pair><const char*const,unsigned>,__rwstd::__s elect1st<std::pair><const char*const,unsigned>,const char*>,std::less<const char*

>,std::allocator<std::pair><const char*const,unsigned> > >::iterator

>__rwstd::__r

b_tree<const char*,std::pair><const char*const,unsigned>,__rwstd::__select1st<std

::pair><const char*const,unsigned>,const char*>,std::less<const char*>,std::alloc ator<std::pair><const char*const,unsigned> > >::find(const char*const&)const ../.

./../../build/../protocols/sipadaptor/sipua/libs/libuacore.a(uacore_remotemsgpr o

c.o)

we did some experiments with compiler flags, but didnt help.

Can anyone please help me out as soon as possible?

Thanks,

Bhavik

Message was edited by:

bhavikac

[1664 byte] By [bhavikac] at [2007-11-26 11:49:50]
# 1
Could you show command line options used to:1. compile C++ code for libuacore.a2. compile C++ code links the library
Atanasyan at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

1. compile C++ code for libuacore.a

.c files are compiled with following command line

CC -v -c -g -xs

2. compile C++ code links the library

while linking with libuacore.a

CC -lsocket -lnsl -DTHREAD=MULTI -mt -dalign -xarch=v8plus -L/opt/SUNWspro/WS6/lib/rw7 -L/opt/SUNWspro/WS6/lib/ -L/usr/local/ssl/lib/

bhavikac at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
It is imperative to see command line that was used to produce libuacore.a; also, this warning message (Value expected for flag '-I' for ...) looks suspicious since I don't see any -I's in your compilation line. Did this warning appear during your experiments or it is still there?
MaximKartashev at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

When you work with Sun C++ you should never explicitly point to compiler include files and compiler library. Compiler do it automatically. Use -library=<library_name> command line option when you compile and link. For actual values for <library_name> look at documentation.

Run the command you use to link with libuacore.a with -dryrun command line flag. This allows to see full list of options supplied to ccfe.

Atanasyan at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

I suspect you are using "ar" and not CC to build the .a library. Template instances created by your program will not be included in the .a unless you use

CC -xar ...

to build the .a library. Refer to the C++ Users Guide chapter on building libraries for more details.

BTW, the compiler you are using is End Of Life, and little support is available for it.

You should upgrade to Sun Studio 11, which is free for all uses. You can get it here:

http://developers.sun.com/sunstudio/

Among the many advantages of upgrading:

1. faster compiling

2. programs that run faster

3. support for modern processors

4. dramatically improved tools, like the debugger and performance analyzer

5. no more template cache

clamage45 at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

It seems like you are using RogueWave Standard library with C++ native Standard library.

Please disable the Roguewave Standard library while building RogueWave.

Rebuild your roguewave source after disable the "Roguewave Standard library " and link with your application. It could be resolve your problem

-Riaj

koresha@123 at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7
Thanks clamage45,It works !!!!!my duke to you :)Thanks to Atanasyanand MaximKartashevtoo..
bhavikac at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 8

> It seems like you are using RogueWave Standard

> library with C++ native Standard library.

I did not see any evidence of such a problem.

The default Sun C++ standard library, libCstd, was developed originally by Rogue Wave, and the internals (and copyright notices) show that heritage.

But the command lines as shown indicate that the compiler's own libCstd is being used, not a 3rd-party add-on.

But you are correct that you can't mix two different version of the C++ Standard Library in one program. The global symbol names will be the same -- the one defined by the C++ Standard, but the size and shape of types and objects will be different, as will other implementation details.

clamage45 at 2007-7-7 12:03:33 > top of Java-index,Development Tools,Solaris and Linux Development Tools...