Re: shared library name resolution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike - EMAIL IGNORED wrote:

> On Fedora Core 4, I have some C++ code developed
> that I keep in a library.  Until recently, I used
> ar to generate a libXXX.a .  Now I have changed to:
> 
> TARGET = libXXX.so
> CPPFLAGS = -fPIC -DPIC -O3 -I.
> 
> $(TARGET): $(OBJ)
>    gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJ)
> 
> to create libXXX.so , and I noticed that some
> executables dropped in size by about a factor
> of 10. Good.
> 
> Now some of the code in my library depends on
> the realtime and openssl libraries so when
> utilizing these, I have always used:
> 
>     -l rt -l ssl
> 
> in my link lines.  But for code that did not depend
> on these capabilities, the corresponding -l were
> not required.
> 
> Now, on the contrary, find that these -l designations
> are required WHETHER OR NOT these capabilities are
> needed in the application. Otherwise I get unresolved
> names.
> 
> Is this to be expected with shared libraries?  Is
> there something I could do to my shared library to
> prevent it?

Avoid unresolved symbols in your shared library.  Instead of
linking -lrt -lssl in your apps, add -lrt -lssl when creating the library,
ie, instead of
gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJ)
do
gcc -shared $(CPPFLAGS) -o $(TARGET) $(OBJ) -lrt -lssl

-- Rex

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux