我正在为我的项目使用GNU autotools(包括automake!).我想知道是否可以使用libtool创建静态库和共享库?或者声明是否分开?这会是:
LT_INIT(shared static)
Run Code Online (Sandbox Code Playgroud)
工作?
所以我有一些dlopen用于加载库的代码,我希望它能在bluegene系统上运行,但是我没有一个蓝色基因来测试,我从来没有直接使用它.bluegene支持ltdl.h,还是使用其他东西?如果是这样,它有什么用?
我有一个用libtool构建的大型c ++项目.问题是eclipse不会运行libtool生成的脚本,而且我得到一个"程序不是可识别的可执行文件".错误信息.我该如何使用eclipse调试器?我目前正在使用kdevelop3作为编辑器并使用洞察力进行调试..这太可怕了.
我也许可以在项目目录的./libs中运行实际的可执行文件,但是我必须手动设置LD_LIBRARY_PATH和类似的东西......必须有更好的方法来这样做.
任何帮助,将不胜感激!
我想构建一个使用GNU Autotools使用ZipArchive的共享库,但我遇到了这个问题:
Warning: linker path does not have real file for library -lziparch. I have the capability to make that library automatically link in when you link to this library. But I can only do this if you have a shared version of the library, which you do not appear to have because I did check the linker path looking for a file starting with libziparch and none of the candidates passed a file format test using a file magic. …
我将在Windows中使用NetCDF,我认为它必须用MinGW编译,因为我的主程序和所有其他库已经用MinGW编译.
但是当我使用MinGW(gcc版本4.6.2)时.我收到一些错误消息:
Making all in liblib
make[2]: Entering directory `/c/Users/ylylyl/Documents/CB/NETCDF/netcdf-4.2.1.1/liblib'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c -o libnetcdf_la-stub.lo `test -f 'stub.c' ||echo './'`stub.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c stub.c -DDLL_EXPORT -DPIC -o .libs/libnetcdf_la-stub.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I../include -DDLL_NETCDF -DDLL_EXPORT -g -O2 -MT libnetcdf_la-stub.lo -MD -MP -MF .deps/libnetcdf_la-stub.Tpo -c stub.c -o …Run Code Online (Sandbox Code Playgroud) 使用autotools创建以下库:
Makefile.am:
lib_LTLIBRARIES = libandi.la
libandi_la_SOURCES = $(SMILE_SOURCES)
libandi_la_CPPFLAGS = $(SMILE_CPPFLAGS)
libandi_la_LIBADD = $(SMILE_LIBS)
libandi_la_LDFLAGS = -no-undefined
///////////////////////////////////////////////////////////////////////////
/////////This will be gone since I want to use libandi in android project
///////////////////////////////////////////////////////////////////////////
bin_PROGRAMS = AndiExtract
AndiExtract_SOURCES = src/AndiExtract.cpp
AndiExtract_CPPFLAGS = $(Andi_CPPFLAGS)
AndiExtract_LDADD = $(Andi_LIBS) -libandi -->I need this linker in android
//////////////////////////
///////////////////////////////////////////////////////////////////////////
Run Code Online (Sandbox Code Playgroud)
我可以用android ndk编译它,所以这不是问题.
但是我如何链接到libtool库libandi.la?在android.mk文件中?它甚至可能吗?我在网上搜索时找不到答案.谢谢.
当使用autoreconf与automake与libtool构建和安装我的申请,我总是警告" 的libtool:警告:xxx.la尚未安装在/用户/ local/lib目录 "和" libtool的:警告:请记住运行"的libtool --finish/usr/local/lib ".我已经尝试了很多方法,例如清理项目,并使用make clean重新配置,但仍然无法摆脱警告.这是我尝试过的:
./configure
make clean
make
make install prefix=~/Software/
Run Code Online (Sandbox Code Playgroud)
这里是我的一部分configure.ac,涉及到automake和libtool.
AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror])
LT_INIT([dlopen])
Run Code Online (Sandbox Code Playgroud)
为什么会发出这些警告,我该如何摆脱它们呢?
我目前正在开发一个依赖于递归automake进行构建的C++项目.我想构建一个共享库,并Makefile.am在库的src目录中看起来像
# ...
# Library name
lib_LTLIBRARIES = libadapter-@MY_API_VERSION@.la
# Sources
libadapter_@MY_API_VERSION@_la_SOURCES = \
$(top_builddir)/src/sourceA.cpp \
$(top_builddir)/src/sourceB.cpp
# ...
Run Code Online (Sandbox Code Playgroud)
自1.14版本,automake的问题时,警告subdir-objects未指定的选项AM_INIT_AUTOMAKE中configure.ac.但是,添加该subdir-objects选项似乎打破了构建过程,make抱怨丢失的.Plo文件.我已经在网上搜索了遇到类似问题的人,但没有找到任何合理的提示,如何在不将项目更改为非递归项的情况下解决问题.任何帮助是极大的赞赏.
编辑:
更深入地探讨这个问题,我注意到./configure创建了一个目录,名称$(top_builddir)在库的当前源目录下面,该目录包含.Plo构建库所需的所有文件.在Makefile,但是,我发现.Plo我的库源当量(sourceA.cpp和sourceB.cpp在本例中)由前缀include $(top_builddir)/src/$(DEPDIR)/和$(top_builddir)被定义为一个变量的相对(即,路径../../../src/.deps/).现在很清楚为什么make找不到.Plo文件,因为它搜索错误的目录.这看起来像bug #16375的可能重复.任何解决方法?
编辑2:
在网络上进一步挖掘,揭示了另外两个线程来解决这个问题:#1327和automake-bug.一个已知的解决方法似乎是将--disable-dependency-tracking选项传递给./configure.至少对我来说它有效.
我尝试在centOS 7中编译库时遇到错误,我尝试重新安装libtool但它没有帮助.以下是错误
+ autoreconf --install
configure.ac:32: warning: macro 'AM_PROG_LIBTOOL' not found in library
configure.ac:32: error: possibly undefined macro: AM_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
Run Code Online (Sandbox Code Playgroud)