Search code examples
autoconflibtool

Autoconf, Libtool shared and static library


I am using autoconf gnu tools to build my product. It generates both the shared as well as static library for any library where *.la is mentioned. The issue is if you use .la to link your binary in Makefile.am. It links with the dynamic library but when you use ldd to the binary, it says "not a dynamic executable" although it links with shared library. I proved it by removing the shared library after the binary is built and then tried to run the binary. It didn't find the shared library and couldn't run. Another question is how to put library in a specified location using Makefile.am direction ?


Solution

  • Looks like you run ldd on the wrapper scripts created by libtool. They are used to link uninstalled libraries with uninstalled executables. Real binaries are placed in .libs directory.

    You can install a lib to some specific place in this way

    mylibrary_LTLIBRARIES = libmylibrary.la
    mylibrarydir = ${libdir}/my_plugins/