Linking a GCC-compiled library using Sun Workshop

Linking a GCC-compiled library using Sun Workshop

Post by Matt Hatch » Fri, 06 Sep 2002 00:02:55



I'm having problems linking an .a type static library archive using
Sun Workshop 5.0 under Solaris 2.6.

The archive was built with GCC (unfortunately I do not know which
version - is there a way to determine this from the archive?). If I
build an executable with CC using only the archive on its own then it
links fine, however if I include any other .c or .o files that
reference any of the functions contained within the archive then they
are not found and I receive symbol referencing errors.

My reason for using Sun Workshop is that I need also to link in some
C++ libraries compiled with WS5.0, and because of the name mangling
differences I can't use gcc to link them.

I am not able to recompile either of the libraries, so my simple
questions are: should this combination be possible? is there an
obscure link flag that I need to set? can someone suggest a
solution?!?!?!

Thanks in advance for your assistance,

Matt Hatcher.

 
 
 

Linking a GCC-compiled library using Sun Workshop

Post by Thomas Deh » Fri, 06 Sep 2002 03:07:42



> I'm having problems linking an .a type static library archive using
> Sun Workshop 5.0 under Solaris 2.6.

> The archive was built with GCC (unfortunately I do not know which
> version - is there a way to determine this from the archive?). If I
> build an executable with CC using only the archive on its own then it
> links fine, however if I include any other .c or .o files that
> reference any of the functions contained within the archive then they
> are not found and I receive symbol referencing errors.

> My reason for using Sun Workshop is that I need also to link in some
> C++ libraries compiled with WS5.0, and because of the name mangling
> differences I can't use gcc to link them.

> I am not able to recompile either of the libraries, so my simple
> questions are: should this combination be possible?

Mixing objects generated with different
vendors' C++ compilers is almost impossible.
Even if you get this to link, you will probably see
unexpected runtime behaviour.

Thomas

 
 
 

Linking a GCC-compiled library using Sun Workshop

Post by Mark Mentova » Fri, 06 Sep 2002 04:46:34



> The archive was built with GCC (unfortunately I do not know which
> version - is there a way to determine this from the archive?)

strings xxx.a | grep ^GCC

Mark

 
 
 

1. Using the OTL oracle library with Sun Workshop 5.0

Hi,

I'm a fairly new developer to Sun Workshop 5.0 (long time Windows developer,
sorry, just got smart <g>). I'm trying to use the OTL oracle library from
http://www.geocities.com/skuchin/otl/home.htm which looks really useful, but
it won't compile under Sun's Workshop 5.0 C++ compiler. I've emailed the
auther and he has tried to help me out, but says it works under the 6.0
compiler as that has a more complete STL implementation. Has anyone used
this libray and if so, what was your experience with it and did anyone get
it to compile under Workshop 5.0 C++?

Thanks,
Doug Farrell

2. nfs access problem...

3. HOW CAN I LINK libg++ LIBRARY TO COMPILE C++ CODES UNDER GCC?

4. gcal examples for appointments

5. Static/Shared Library linking using Linux gcc

6. cc: Language F not recognized --huh?

7. : Linking X libraries using 'gcc' in Linux?

8. LILO hangs with "02 02 02..." message

9. how can i compile shared library using gcc?

10. Using a library compiled with gcc ...

11. Duplicate symbol warnings when compiling shared library using gcc

12. Performance problems in reading shared libraries in Sun Workshop debug (dbx) V5.0

13. Sun Workshop 5.0, linking with libC and libCrun