tcpdump mailing list archives

Re: [PATCH][RFC] Allow linking from custom staticlib.a instead of list of object files


From: Christian Bell <csbell () myri com>
Date: Mon, 11 Jan 2010 10:48:39 -0500


On Jan 8, 2010, at 7:22 PM, Guy Harris wrote:


On Jan 8, 2010, at 12:56 PM, Guy Harris wrote:

You might want to call it ARCHIVELIBS, by analogy to LIBS.

Another possibility, if the routines are in an installed library, would be to just add that library to LIBS. The shared libpcap will be linked with all the libraries in LIBS, so programs linked with the shared libpcap will pick up the shared versions of those libraries, and programs whose build procedures use the new-in-1.0.0 pcap-config script if it's available (top-of-tree tcpdump and Wireshark both do; I'll check whether Wireshark 1.2.x does, and, if not, look at backporting that) will, for a static build, link with the library if you pass --static to pcap-config.

Note that top-of-tree libpcap, on Linux systems that have libnl, will use routines from it unless you explicitly use --without-libnl, so it already requires additional libraries on at least some platforms.

You're right. To be quite honest, my main goal (as a vendor) is just to lower the barrier for users to link with a single library without worrying about extra dependencies (libs or search paths). Other vendors seem to use the ADDLOBJS method and while I think this helps ease things, I'm just uncomfortable about burning in object files by name in an external project.

If tcpdump/wireshark use the pkg-config method, it isn't the case for all packages out there and when there's extra dependencies, both libpcap.a and .so can fail in some odd way (missing -l or broken rpath). For example, just building findalldevstest requires LD_LIBRARY_PATH to be modified to run it out of the box if -Llib is not in a standard search path. I guess it could use pcap-config, but pcap-config is currently only built by the install rule.

I think the pkg-config method is an honest attempt to make the problem easier to solve but it doesn't plug all the holes -- relocatable rpms can't easily rewrite the rpath in the pkg-config and the admins we've encountered like to install external packages in non-standard locations.

Nevertheless, I'll proceed with only modifying LIBS= and seeing what the fallout is. If it turns out to be a hassle, we'll just modify how we build libpcap.so.

        . . christian

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: