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

So, after I launched libtool and pulled out the libfoo.lo and foo.o file from my library source, how can I convert the libfoo.lo file to a regular Linux library like libfoo.so.1.0.0 , so I can install and link to it in my target system?

+3
c ++ autotools autoconf libtool
Dec 31 '09 at 15:45
source share
1 answer

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

libtool is just a simple shell for gcc, ln ar, and ranlib, which is needed to create libraries. All he does is run gcc, adding the necessary parameters to make sure your static and shared libraries are created correctly.

When compiling, libtool inserts the -fPIC tag to provide the necessary generation of position-independent code required for shared libraries. .O files are regular object files that can be archived into a static .a file. .Lo files are object files with position-independent code that can now be associated with a .so file.

When linking, libtool will start ar to create a static library or ln to link object files to the shared .so library.

libtool can also install the library as needed using -mode = install.

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

Remember that when creating an executable file, there are always two steps, compilation and linking.

+7
Dec 31 '09 at 16:08
source share
— -



All Articles