Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fixes #176

Merged
merged 2 commits into from Mar 5, 2017
Merged

Build fixes #176

merged 2 commits into from Mar 5, 2017

Conversation

tpetazzoni
Copy link
Contributor

No description provided.

VPATH is a mechanism used to allow out-of-tree build, not to use source
code from a different directory. For this purpose, one should simply use
the "subdir-objects" AUTOMAKE_OPTIONS, and reference the source code of
the sub-directory in the <prog>_SOURCES variable.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Using AC_CHECK_LIB() doesn't work properly for static linking, because
it doesn't return information on transitive dependencies of
libraries. For example, if library A internally uses library B, then
with dynamic linking, doing -lA is sufficient. However, with static
linking, one must do -lA -lB, and AC_CHECK_LIB() will only give the -lA
information. This for example causes a build failure when building
sngrep statically with openssl enabled:

checking for SSL_new in -lssl... no
configure: error:  You need to have libssl installed to compile sngrep

due to undefined symbols in the OpenSSL library.

The proper solution for this is to discover the library using
pkg-config, because pkg-config properly returns the list of necessary
libraries, as it understands the concept of "list of libraries needed
when dynamic linking" and "list of libraries needed for static linking".

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
@Kaian
Copy link
Member

Kaian commented Mar 5, 2017

Hi @tpetazzoni

Thanks for the PR and the awesome explanation of the changes.
Do you think that would be a good idea to replace also the rest of AC_CHECK_LIB macos? I think gnutls will at least suffer from the same problem.

Thanks again as this PR not only improves the code; I have learnt something so It also improves myself!

@tpetazzoni
Copy link
Contributor Author

Yes, whenever pkg-config files are provided by libraries, I believe using pkg-config is better.

Sadly, one library that causes a problem when static linking is libpcap, but it doesn't install a .pc file, so pkg-config cannot be used.

@Kaian Kaian merged commit 2563b01 into irontec:master Mar 5, 2017
@Kaian
Copy link
Member

Kaian commented Mar 5, 2017

Ok, I'll give it a try tomorrow replacing some of the other libraries and test under a couple of different distributions :-)

@Kaian Kaian mentioned this pull request Mar 30, 2017
Kaian added a commit that referenced this pull request Apr 3, 2017
PKG_CHECK_MODULES macro is installed in pkg-config package which is not present
in all installations. While it has its advantes, we must check if it's available
to support legacy configurations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants