我熟悉if VAR_NAME, whereVAR_NAME由 configure.ac 中的 AM_CONDITIONAL 子句定义。
Makefile.am 中是否有相应的“如果未定义”结构?
我有一个用autotools构建的C++软件系统.对于其功能的一小部分,我的系统使用闭源预构建二进制文件:AMPL.我是他们软件的免费学生版.假设我在C++代码中调用的AMPL二进制文件的名称是ampl-student.我通过system(...)调用在我的代码中运行它.
当运行"make install"时,我想与我编译的C++代码的二进制文件一起ampl-student移动/usr/bin.我应该在Makefile.am中添加哪些内容ampl-student.我应该将它添加到bin_PROGRAMS变量吗?
一个相关的问题是我应该甚至把ampl-student在/usr/bin.是否有更适合"辅助二进制"的地方?
我认为这通常是一个坏主意,因为将预先构建的二进制文件与代码一起分发并不能保证二进制文件将在最终用户的计算机上运行.但在这种情况下,用户群非常小,我碰巧知道他们都使用相同的系统配置.因此,我们实际上使用deb软件包来保持每个人都对软件系统的新版本进行更新.
编辑1:我应该强调,问题首先是要求ampl-student在autotools使用的Makefile.am文件中指定的位置.
我的项目要求libxml2使用自动工具来检查依赖关系并安装相同的依赖关系.我声明在configure.ac中使用以下宏的依赖性
echo -n "checking if libxml2 is present... "
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.19],
[echo "yes (features requiring libxml2 enabled)" AC_DEFINE(HAVE_LIB_XML, 1, [define if libxml2 is present])],
[echo "no"] )
Run Code Online (Sandbox Code Playgroud)
宏按照需要工作GNU/Linux.
但不知何故,它失败Solaris了以下错误
checking if libxml2 is present... ./configure: line 11586: syntax error near unexpected token `LIBXML2,'
./configure: line 11586: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.19,'
Run Code Online (Sandbox Code Playgroud)
谷歌搜索解决方案,他们中的大多数抱怨pkg-config没有安装.但是在我的测试机器中实际安装了它,通过执行以下命令来检查它.
bash-3.00# pkg-config libxml-2.0 --modversion
2.6.23
Run Code Online (Sandbox Code Playgroud)
一些建议会受到欢迎.
我对 autoconf 有点问题,我知道您可以使用 configure.ac 向 configure.h 添加一些定义,但是有没有办法做这样的事情:
在我的一个标题中,我有
#ifndef SIZE
#define SIZE 4
#endif
Run Code Online (Sandbox Code Playgroud)
现在我想要一个选项,如果我调用
./configure
Run Code Online (Sandbox Code Playgroud)
它创建 makefile 并且大小为 4,但是当有人这样做时
./configure --block-size=num
Run Code Online (Sandbox Code Playgroud)
SIZE 将设置为 num,最好我想在没有 config.h 的情况下执行此操作,我只是希望他向 makefile 添加一些内容,因此将调用编译
-DSIZE=num
Run Code Online (Sandbox Code Playgroud) 我已经从源代码编译单声道并安装了--prefix=/opt/mono-2.8.2.
现在我想用这个当前的单声道安装monodevelop.我见过./configure --helpmonodevelop.但是没有找到任何可以设置单声道安装路径的开关.
我的问题是如何在安装mono时安装monodevelop /opt/mono-2.8.2
更新1:
检查一些./configure命令文档后,我想我必须将PKG_CONFIG_PATH全局变量更改为路径,以便它包含我的自定义单声道安装目录.
我的automake/autoconf有问题.我将首先向您展示我的源代码树的布局:
src
------ arch
---------- avr
-------------- i2c.c
------- sys
------ ----- thread.c
现在我的问题.完全编译arch/avr/i2c.c和sys/thread.c并不难.但我真正想要的是部分编译我的所有子目录(使用gcc -c),然后将所有对象从一个子目录链接起来(ld -r),并在编译所有子目录时制作这些子目录文件的程序.这是可能的,如果是的话,怎么样?
格雷茨,米歇尔
我正在尝试构建一个XCode项目,并在尝试构建时遇到以下错误:
...
Building for x86_64 i386 armv7 armv7s arm64
Building libssh2 for iphonesimulator7.1 x86_64
Please stand by...
/Users/jordanforeman/dev/ios/MyProject/objective-git/External/libssh2-ios/bin/iphonesimulator7.1-x86_64.sdk/build-libssh2.log
Command /bin/sh failed with exit code 1
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/jordanforeman/Library/Developer/Xcode/DerivedData/MyProject-azifgvrunekkgmagzghrrvpdathe/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphoneos/libssh2-iOS.build/Script-6A3C609117D5963700382DFF.sh
(1 failure)
Run Code Online (Sandbox Code Playgroud)
看一看,build-libssh2.log我看到以下内容:
aclocal: error: aclocal: file '/usr/local/share/aclocal/pkg.m4' does not exist
autoheader: error: AC_CONFIG_HEADERS not found in configure.ac
cp: src/libssh2_config.h.in: No such file or directory
configure.ac:5: error: possibly undefined macro: AM_CONFIG_HEADER
If this token and others are legitimate, please use …Run Code Online (Sandbox Code Playgroud) 嗨,我是Linux的初学者,我正准备在32位机器上运行的Linux 12.04上安装Yara(yara-3.2.0).
在我尝试使用./configure命令配置导致此错误之前,这一切都很好:
checking for SHA256_Final in -lcrypto... yes
./configure: line 12735: syntax error near unexpected token `newline'
./configure: line 12735: `ACX_PTHREAD('
Run Code Online (Sandbox Code Playgroud)
我一直在寻找解决这个问题,但没有什么好事发生.有人会帮助我指出我能做些什么来解决错误吗?在先进的感谢,任何帮助将真的很感激.
我要创建一个静态库(它不是创建一个动态的一个选项),我有在使用这个静态库中的函数timer_create从time.h例如是这样的:
somelib.h:
#include <time.h>
int do_something(void);
Run Code Online (Sandbox Code Playgroud)
somelib.c:
int do_something(void){
timer_t timer;
struct sigevent sevp;
sevp.sigev_notify = SIGEV_SIGNAL;
sevp.sigev_signo = SIGRTMIN;
sevp.sigev_value.sival_ptr = NULL;
int ret = timer_create(CLOCK_MONOTONIC, &sevp, &timer);
timer_delete(timer);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
代码实际上是没有意义的,只是在那里有必要链接librt来说明我的问题,如下:
编译somelib.c后:
gcc -c -o somelib.o somelib.c -lrt
Run Code Online (Sandbox Code Playgroud)
并创建静态库:
ar rcs somelib.a somelib.o
Run Code Online (Sandbox Code Playgroud)
链接它时出现以下错误:
gcc -o someexec someexec.c -lrt ./somelib.a
Run Code Online (Sandbox Code Playgroud)
收益:
somelib.c:(.text+0x30): undefined reference to `timer_create'
somelib.c:(.text+0x44): undefined reference to `timer_destroy'
Run Code Online (Sandbox Code Playgroud)
这是我的问题的最小例子.我不确定是否可以解决这个问题,因为我的理解是,静态库必须知道librt在创建时的位置,因为它是动态的,所以如果没有链接到静态则不可能librt的版本.我仍然不经常使用静态库,所以我想知道是否有办法做这样的事情.
编译器版本:gcc 4.8.1没有设置其他标志.
我正在构建一个C automake项目。运行“ aclocal”显示以下错误。
$ aclocal
' is already registered with AC_CONFIG_FILES./usr/src/ports/autoconf2.5/autoconf2.5-2.69-3.noarch/src/autoconf-2.69/lib/autoconf/status.m4:288: AC_CONFIG_FILES is
expanded from...
configure.ac:890: the top level
autom4te-2.69: /usr/bin/m4 failed with exit status: 1
aclocal-1.15: error: echo failed with exit status: 1
Run Code Online (Sandbox Code Playgroud)
我在Windows 10上使用Cygwin。
从886行到结尾,configure.ac具有以下内容。
# ----------------------------------------------------------------------
# Create output files
#
echo $SLIM_VERSION > VERSION
AC_OUTPUT(Makefile \
src/Makefile \
src/genconfig \
src/verifier/Makefile \
src/utility/Makefile \
src/test/Makefile \
lib/Makefile \
ext/Makefile \
test/Makefile \
test/system_check/Makefile \
third_party/Makefile \
third_party/zdelta-2.1/Makefile \
third_party/google-perftools-1.8.3/Makefile \
third_party/google-perftools-1.8.3/src/google/tcmalloc.h \
third_party/google-perftools-1.8.3/src/windows/google/tcmalloc.h \
doc/Makefile \ …Run Code Online (Sandbox Code Playgroud)