我正在开发一个将与GNU autoconf/automake一起分发的项目,我有一组调用awk脚本的bash脚本.我希望bash脚本最终在$ PATH中,但不是awk脚本.我该如何将这些插入到项目中?它们应该与其他二进制文件一起使用吗?
另外,有没有办法在安装后确定文件的最终位置?我认为/ usr/local/bin并不总是可执行文件结束的地方......
我知道如何构建项目或如何使用autoconf创建库.
我想要实现的是生成一个静态库并使用该库在单个configure/make/make install运行中构建项目.
我想将一些源文件放入库中,其余的要使用这个库进行编译.
如何修改makefile.am文件和configure.ac以使其正常工作?
在一个项目中,我有两个noinst_PROGRAM定义.其中一个工作正常,但另一个给我以下消息:
/home/altern8/workspaces/4355/libgdata/test/.libs/lt-gdatacalendar:符号查找错误:/home/altern8/workspaces/4355/libgdata/test/.libs/lt-gdatacalendar:undefined symbol:_ZN5gdata7service7ServiceD1Ev
我一直在浏览我的Makefile.am文件,我找不到任何我错过的东西.应用程序正确编译所以我猜这意味着头文件被正确找到但由于某种原因我gdata::service::Service没有被包含在src/libgdata.la库中.
我的假设可能是正确的吗?src/libgdata.la库中定义的其他类似乎可用."make"的输出显示正在正确编译Service.cc文件...我应该查看哪些指针以确定它是否包含在最终库中?
编辑:
我已经能够根据目前为止提供的答案进一步调试这一点.
析构函数在Service.cc中定义.如果我在析构文件中给析构函数一个正文,那么一切正常.
// In Service.h
~Service() {}
// In Service.cc
// Service::~Service() {}
Run Code Online (Sandbox Code Playgroud)
既然析构函数"有效",我会遇到Service.cc中定义的其他未找到的方法.
使用@ ephemient的方法,它看起来像这些符号实际上被包含在库中.或者我输错了输出?
000000e0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_
000000a0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_b
./src/.libs/libgdata.a
000240d0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_
00024090 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_b
000240d0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_
00024090 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_b
./src/.libs/libgdata.so
00000080 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_
00000070 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_b
./src//gdata/service/libgdata__gdata_service_la-Service.o
000000e0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_
000000a0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_b
./src//gdata/service/.libs/libgdata__gdata_service.a
000000e0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_
000000a0 T _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_b
./src//gdata/service/.libs/libgdata__gdata_service_la-Service.o
Run Code Online (Sandbox Code Playgroud)
我的src/Makefile.am看起来像这样:
SUBDIRS = gdata
lib_LTLIBRARIES = libgdata.la
libgdata_la_SOURCES =
libgdata_la_LIBADD = \
gdata/client/libgdata_gdata_client.la …Run Code Online (Sandbox Code Playgroud) 这一直困扰着我多年,但我一直忽视它,就像我怀疑其他人一样.
AM_INIT_AUTOMAKE([dist-bzip2])
AC_PROG_CC
AC_PROG_LIBTOOL
AC_C_INLINE
AM_PROG_CC_C_O
Run Code Online (Sandbox Code Playgroud)
有了上面的configure.ac文件,configure会去找我一个C编译器,但接下来继续:
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for …Run Code Online (Sandbox Code Playgroud) 我正在编写一个小型库,并希望使用带有automake 1.11的autotools来访问它.唯一有趣的结果是库libfoo.so.
我为库编写了一个单元测试,我希望在make过程中或运行时执行make check.我不想让单元测试出现$PREFIX/foo/bin/.
我如何实现这些目标?
我正在尝试在 automake 中执行此操作
platform=$(uname)
ifeq ($(platform), Darwin)
stmt = ...
else
stmt1 = ...
endif
Run Code Online (Sandbox Code Playgroud)
但我得到
错误:没有如果
错误:endif 没有 if
我究竟做错了什么?
要查看我要执行的操作,请参见以下内容:
我的问题是如何在我的Makefile.am中有条件地设置AM_CPPFLAGS或my_lib_la_CPPFLAGS。这样在运行configure时是否设置了正确的CPPFLAGS?
目前,我正在做一些影响以下方面的事情:
lib_xml_wrapper_la_CPPFLAGS = -I../../
UNAME_S = $(shell uname -s)
UNAME_P = $(shell uname -p)
ifeq ($(UNAME_S),Linux)
lib_xml_wrapper_la_CPPFLAGS += -DLINUX
ifeq ($(UNAME_P),x86_64)
lib_xml_wrapper_la_CPPFLAGS += -D AMD64
endif
ifeq ($(UNAME_P),x86_64)
lib_xml_wrapper_la_CPPFLAGS += -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/
endif
ifneq ($(filter %86,$(UNAME_P)),)
lib_xml_wrapper_la_CPPFLAGS += -I../../../external/xerces-c-3.1.1-x86-linux-gcc-3.4/include/
endif
ifneq ($(filter arm%,$(UNAME_P)),)
lib_xml_wrapper_la_CPPFLAGS +=
endif
endif
ifeq ($(UNAME_S),Darwin)
lib_xml_wrapper_la_CPPFLAGS += -DOSX
ifneq ($(filter %86,$(UNAME_P)),)
lib_xml_wrapper_la_CPPFLAGS += -I../../../external/xerces-c-3.1.1-x86-macosx-gcc-3.4/include/
endif
ifneq ($(filter arm%,$(UNAME_P)),)
lib_xml_wrapper_la_CPPFLAGS +=
endif
endif
Run Code Online (Sandbox Code Playgroud)
这似乎在Makefile.am中不起作用。我收到以下错误:
xml_wrapper/Makefile.am:26: error: endif without if
xml_wrapper/Makefile.am:35: error: endif without if
automake: warnings …Run Code Online (Sandbox Code Playgroud) 我已经阅读了CFLAGS 和 CPPFLAGS之间的区别。但是我的 Makefile.am 目前同时使用 DEFS 和 CPPFLAGS,我不确定其中的区别。
DEFS += -DLOCALEDIR=\"$(localedir)\" -DDATADIR=\"$(datadir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
Run Code Online (Sandbox Code Playgroud)
和:
src_foo_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_builddir)/src \
-DDATADIR='"$(datadir)"' \
-DMODULEDIR='"$(moduledir)"' \
-DLIBEXECDIR='"$(libexecdir)"'
Run Code Online (Sandbox Code Playgroud)
CPPFLAGS 和 DEFS 似乎都使用该选项创建定义-D。那么有什么区别。我可以删除DEFS并添加缺少的定义(PKGDATADIR和LOCALEDIR)CPPFLAGS吗?
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/aclocal/README
/usr/local/share/aclocal is not writable.
You can try again using: brew link automake
Run Code Online (Sandbox Code Playgroud)
当我再次尝试时,它显示相同的错误.
我想在C预处理器样式中传递一个常量,但是使用Python脚本.
这个常量已经AC_DEFINE在我的configure.ac文件中声明并在我的C程序中使用,现在我也需要将它传递给Python脚本.
我试图用我的一个自定义的目标Makefile.am与sed预处理呼叫我的Python脚本特定符号,但它似乎肮脏的编码给我.
我怎样才能做到这一点?