Re: [Worshop 6] Problem linking a static lib which includes another static lib.

From: Paul LAURENT (laurent_paul_at_com.invalid.yahoo)
Date: 03/26/04


Date: 26 Mar 2004 20:13:25 GMT

As far as I am concerned, a question about C++ linking is not off-topic in
this forum.

I already had a look at the forum you talk about and did not find any reply
=> that's why I am posting here.

Thanks to the person who can help me.

--------------------------------------------------------------------

I am working under Solaris 2.8 and compiling/linking C++ code using
SUN Workshop 6.

I have to use a static lib provided by an external company.
The lib is installed in :

    /soft/external_company/lib/libfoo.a

I need to build a static lib "mylib.a" which need the "libfoo.a"
functionnalities. My link command is :

   CC -xar -o mylib.a myobj1.o myobj2.o -L/soft/external_company/lib
-Bstatic -lfoo

=> When I do "nm -A mylib.a", I can see that all the symbol defined in
"libfoo.a" are undefined in "mylib.a"

Removing the "-lfoo" link option gives the same result => it seems
that the provided static lib "libfoo.a" can not be linked to my
project.
(of course, if I try to link "mylib.a" to make an executable, I will
get all the undefined symbol errors)

If I try to make a shared library using the following command :

   CC -G -o mylib.so myobj1.o myobj2.o -L/soft/external_company/lib
-Bdynamic -lfoo

It works perfectly !
But that is not what I was asked to do.

Can anyone give me the right command line for statically linking
successfully ?

Thanks in advance.

--------------------------------------------------------------------

Christopher Benson-Manica <ataru@nospam.cyberspace.org> wrote in
news:c41a19$ddj$1@chessie.cirr.com:

> forfun <for.fun@laposte.net> spoke thus:
>
>> I am working under Solaris 2.8 and compiling/linking C++ code using
>> SUN Workshop 6.
>
>> I need to build a static lib "mylib.a" which need the "libfoo.a"
>> functionnalities. My link command is :
>
>> (other stuff snipped)
>
> Your post is off-topic for comp.lang.c++. Please visit
>
> http://www.slack.net/~shiva/welcome.txt
> http://www.parashift.com/c++-faq-lite/
>
> for posting guidelines and frequently asked questions. Thank you.
>



Relevant Pages


Loading