Build libtool application with static linking to l

2019-09-05 17:29发布

问题:

I am working with an open-source application that uses libtool in its build process. I would like to statically link the local components of the application with the following intended benefits:

  • doesn't require libtool wrapper to launch
  • function calls aren't indirected by dynamic linking during debugging
  • avoid unintended dynamic linking to existing system-installed library

Is there a standard option to the build process that does this?

Due to dependencies on non-static system libraries I can't just use:

./configure LDFLAGS='-static'

回答1:

Yes, it can be done! Use the --disable-shared option.

For example:

./configure --enable-debug --disable-shared

Now the generated executable is a directly executable binary rather than a libtool script.

This has the added benefit of roughly halving the build time.



标签: libtool