2009-09-22 115 views
2

我想用C语言编写一个使用GNU autotools的程序,但是我显然设置了错误,因为当configure运行时,它吐出来:Autoconf问题:“错误:C编译器无法创建可执行文件”

configure: error: C compiler cannot create executables 

如果我看在config.log,我看到:

configure:2846: checking for C compiler default output file name 
configure:2868: gcc conftest.c >&5 
conftest.c:3:25: warning: missing terminating " character 
conftest.c:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token 
configure: failed program was: 
| /* confdefs.h. */ 
| #define PACKAGE_NAME "Jackoff" 
| #define PACKAGE_TARNAME "jackoff 
|  http://github.com/enaeseth/jackoff" 
| #define PACKAGE_VERSION "0.1" 
| #define PACKAGE_STRING "Jackoff 0.1" 
| #define PACKAGE_BUGREPORT "Eric Naeseth <[email protected]>" 
| #define PACKAGE "jackoff 
|  http://github.com/enaeseth/jackoff" 
| #define VERSION "0.1" 
| /* end confdefs.h. */ 
| 
| int 
| main() 
| { 
| 
| ; 
| return 0; 
| } 

出于某种原因,Autoconf是一个生成一个无效的测试文件:应该是在该行被即将到来的只是一个分号什么?在Ubuntu 9.04和Mac OS X 10.6上构建失败的方式相同,所以这绝对是我的错,而不是环境。

回答

3

问题是在PACKAGE_TARNAME(和PACKAGE)中有一个换行符,它在configure.ac文件中设置。您应该查看包含的内容 - 修复它,然后重新生成configure脚本。

我的一个configure.ac脚本包含(靠近顶部):

AC_CONFIG_HEADER(config.h) 

PACKAGE="sqlcmd" 
VERSION="86.04" 

AC_MSG_RESULT([Configuring $PACKAGE version $VERSION]) 

AC_SUBST(PACKAGE) 
AC_SUBST(VERSION) 
0

PACKAGE_TARNAME不看没事。首先,它有一个嵌入的换行符,这是你的问题的直接原因。

0

您在configure.ac开始时有AC_INIT的额外参数。只要删除它。

相关问题