Linux libtool 的 .la 文件有什么用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1238035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are libtool's .la file for?
提问by chappar
What are libtool's .la
files for? How are they used with a shared object?
libtool 的.la
文件有什么用?它们如何与共享对象一起使用?
采纳答案by Artyom
It is a textual file that includes a description of the library.
它是一个包含库描述的文本文件。
It allows libtool
to create platform-independent names.
它允许libtool
创建与平台无关的名称。
For example, libfoo
goes to:
例如,libfoo
转到:
Under Linux:
在 Linux 下:
/lib/libfoo.so # Symlink to shared object
/lib/libfoo.so.1 # Symlink to shared object
/lib/libfoo.so.1.0.1 # Shared object
/lib/libfoo.a # Static library
/lib/libfoo.la # 'libtool' library
Under Cygwin:
在Cygwin 下:
/lib/libfoo.dll.a # Import library
/lib/libfoo.a # Static library
/lib/libfoo.la # libtool library
/bin/cygfoo_1.dll # DLL
Under Windows MinGW:
在 Windows MinGW 下:
/lib/libfoo.dll.a # Import library
/lib/libfoo.a # Static library
/lib/libfoo.la # 'libtool' library
/bin/foo_1.dll # DLL
So libfoo.la
is the only file that is preserved between platforms by libtool
allowing to understand what happens with:
libfoo.la
通过libtool
允许了解以下情况发生的情况,在平台之间保留的唯一文件也是如此:
- Library dependencies
- Actual file names
- Library version and revision
- 库依赖
- 实际文件名
- 库版本和修订
Without depending on a specific platform implementation of libraries.
不依赖于库的特定平台实现。
回答by Thomas Leonard
According to http://blog.flameeyes.eu/2008/04/14/what-about-those-la-files, they're needed to handle dependencies. But using pkg-config may be a better option:
根据http://blog.flameeyes.eu/2008/04/14/what-about-those-la-files,它们需要处理依赖项。但是使用 pkg-config 可能是更好的选择:
In a perfect world, every static library needing dependencies would have its own .pc file for pkg-config, and every package trying to statically link to that library would be using pkg-config --static to get the libraries to link to.
在完美的世界中,每个需要依赖项的静态库都有自己的 pkg-config .pc 文件,并且每个试图静态链接到该库的包都将使用 pkg-config --static 来获取要链接的库。
回答by Rak
I found very good explanation about .la files here http://openbooks.sourceforge.net/books/wga/dealing-with-libraries.html
我在这里找到了关于 .la 文件的很好的解释 http://openbooks.sourceforge.net/books/wga/dealing-with-libraries.html
Summary (The way I understood): Because libtool deals with static and dynamic libraries internally (through --diable-shared or --disable-static) it creates a wrapper on the library files it builds. They are treated as binary library files with in libtool supported environment.
总结(我理解的方式):因为 libtool 在内部处理静态和动态库(通过 --diable-shared 或 --disable-static),它在它构建的库文件上创建了一个包装器。在 libtool 支持的环境中,它们被视为二进制库文件。