How to install and use libtool shared library (.lo files)?

房东的猫 提交于 2019-12-03 21:34:39

From the outputs mentioned in the question, it looks like you ran libtool with --mode=compile mode. You will need to run libtool again with --mode=link to produce .a and .so libraries.

libtool is just a simple wrapper for gcc, ln ar and ranlib which is needed to produce libraries. All it does is run gcc adding the necessary options to ensure that your static and shared libraries are created correctly.

When compiling libtool inserts the -fPIC tag to ensure the necessary generation of position independent code needed for shared libraries. The .o files are normal object files that can be archived into a static .a file. The .lo files are object files with position independent code which can now be linked into a .so file.

When linking libtool will run ar to create a static library or ln to link the objects files into a .so shared library.

libtool also can install the library when desired using the --mode=install.

See http://www.gnu.org/software/libtool/manual/libtool.html for more info.

Please remember that when building an executable there are always two stages, compiling and linking.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!