bind10 configure fails to find botan library

Spain, Dr. Jeffry A. spainj at countryday.net
Wed Nov 30 04:03:39 UTC 2011


I believe I have gained an understanding of this. See “man ld” and the following statement under the description of the “-l” option: “The linker will search an archive only once, at the location where it is specified on the command line.  If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive.  However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again.”

In the command:
configure:15903: g++ -o conftest -g -O2 -I/usr/include   -L/usr/lib -lbotan -Wl,-Bsymbolic-functions conftest.cpp  >&5
the parameter -lbotan appears before the parameter conftest.cpp on the command line. Therefore the libbotan.so library is searched for undefined symbols before any symbols are defined in conftest.cpp, and so none are found. When conftest.cpp is eventually compiled and linked, libbotan.so is not searched again, and the symbols remain undefined.

To verify this, I created a test file “botantest.cpp” based on the botan test code in config.log as follows:
#include <botan/botan.h>
#include <botan/hash.h>
int
main ()
{
        using namespace Botan;
        LibraryInitializer::initialize();
        HashFunction *h = get_hash("MD5");
        return 0;
}

Compiling it with the command:
g++ -o botantest -I/usr/include -L/usr/lib -lbotan botantest.cpp
generates the two undefined reference errors previously posted.

However, changing the command to:
g++ -o botantest -I/usr/include -L/usr/lib botantest.cpp -lbotan
causes it to execute with no errors.

I looked at the configure script, and it appears that the function ac_fn_cxx_try_link is what is relevant to this problem. I confess to not having been able to figure out exactly how that works.

Jeffry A. Spain
Network Administrator
Cincinnati Country Day School


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind10-users/attachments/20111130/81f94b48/attachment.html>


More information about the bind10-users mailing list