I'm not sure if this is the default behavior for the ld command, but it does not seem to be looking in /usr/local/lib for shared libraries.
I was trying to compile the latest version of Kanatest from svn. The autorgen.sh script seems to exit without too much trouble:
$ ./autogen.sh
checking for autoconf >= 2.61... found
checking for automake >= 1.8.5... found
checking for configure.ac... found
checking for Makefile.am... found
generate configure script... automake-1.14: warnings are treated as errors
po/Makefile.am:2: warning: wildcard ../src/*.c ../src/*.h: non-POSIX variable name
po/Makefile.am:2: (probably a GNU make extension)
po/Makefile.am:20: warning: '%'-style pattern rules are a GNU make extension
po/Makefile.am:23: warning: '%'-style pattern rules are a GNU make extension
src/Makefile.am:2: warning: ':='-style assignments are not portable
src/Makefile.am:2: warning: shell if test -e .svn; then echo -DREV=\"`LC_ALL=C svn info | sed -n '/^Rev/p'| sed -e 's/^Revision:\ //'`\"; fi;: non-POSIX variable name
src/Makefile.am:2: (probably a GNU make extension)
done
I don't think the GNU warnings are related, but I don't know for sure.
Trying to run the generated configure script results in the linker failing to find libxml2.so:
...
...
checking pkg-config is at least version 0.9.0... yes
checking for GTK... yes
checking for xml2-config... yes
checking for xmlNewDoc in -lxml2... no
configure: error: You do not appear to have libxml2 installed.
config.log:
...
...
configure:4135: checking for xml2-config
configure:4151: found /usr/local/bin/xml2-config
configure:4163: result: yes
configure:4179: checking for xmlNewDoc in -lxml2
configure:4204: cc -o conftest -g -O2 conftest.c -lxml2 >&5
/usr/bin/ld: cannot find -lxml2
cc: error: linker command failed with exit code 1 (use -v to see invocation)
configure:4204: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Kanatest"
| #define PACKAGE_TARNAME "kanatest"
| #define PACKAGE_VERSION "0.4.10"
| #define PACKAGE_STRING "Kanatest 0.4.10"
| #define PACKAGE_BUGREPORT "pasp@users.sf.net"
| #define PACKAGE_URL ""
| #define PACKAGE "kanatest"
| #define VERSION "0.4.10"
| /* end confdefs.h. */
|
| /* Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
| char xmlNewDoc ();
| int
| main ()
| {
| return xmlNewDoc ();
| ;
| return 0;
| }
configure:4213: result: no
configure:4223: error: You do not appear to have libxml2 installed.
Running the ld command on its own has the same result:
$ ld -lxml2
ld: cannot find -lxml2
libxml2.so is located in /usr/local/lib:
$ ls /usr/local/lib | grep -i libxml2
libxml2.a
libxml2.so
libxml2.so.2
libxml2.so.2.9.2
I have to add LDFLAGS="-L/usr/local/lib" to the configure line for it to work.
Am I mistaken in thinking that /usr/local/lib is a standard directory for linking to shared libraries in FreeBSD? Or is this pkgconf related?
$ pkgconf --list-all | grep -i xml
libxml-2.0 libXML - libXML library version2.
expat expat - expat XML parser
xml2po xml2po - Tool for translating XML documents
libxml++-2.6 libxml++ - C++ wrapper for libxml
libplist libplist - A library to handle Apple Property Lists whereas they are binary or XML
QtXmlPatterns Qtxmlpatterns - Qtxmlpatterns Library
QtXml Qtxml - Qtxml Library
Qt5Xml Qt5 Xml - Qt Xml module