Hi:
The link-editor's default library behavior is to link shared libraries.
The command line option is -Bdynamic but you don't need to specify it.
In order to link in an archive library, you need to use the -Bstatic option.
These options work like a toggle switch.  -Bstatic will affect all 
libraries
that come after it on the command line until turned off with the 
-Bdynamic option.

eg:

-Wl,--whole-archive -Bstatic -lapr-1 -laprutil-1 -Bdynamic -lexpat 
-Wl,--no-whole-archive




On 09/15/09 09:23 AM, Yura Vishnevskiy wrote:
> Dear All,
> I'm new to OpenSolaris and trying to compile my program with gcc (gcc version 
> 3.4.3 (csl-sol210-3_4-20050802)). But I'm unable to link the program with 
> static libraries. Here is the corresponding linker flags:
> -Wl,--whole-archive -lapr-1 -laprutil-1 -lexpat -Wl,--no-whole-archive
>
> I have my own libapr-1.a, libaprutil-1.a and libexpat.a and use -L switches 
> to point gcc where the are. 
>
> But the resulting executable depends on shared libraries:
>       libapr-1.so.0 =>         (file not found)
>       libaprutil-1.so.0 =>     (file not found)
>       libexpat.so.0 =>         /usr/lib/libexpat.so.0
>
> How to use static libraries?
>   

-- 
Rich Barker, Software Support Engineer 
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.opensolaris.org/pipermail/tools-linking/attachments/20090915/296cc375/attachment.html>

Reply via email to