Autoconf 问题:“错误:C 编译器无法创建可执行文件”
我正在尝试使用 GNU 自动工具构建一个用 C 编写的程序,但显然我设置错误,因为当 configure
运行时,它会输出:
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 上构建也会以同样的方式失败,所以这绝对是我的错,而不是环境的错。
I'm trying to build a program I've written in C using GNU autotools, but I evidently have it set up wrong because when configure
runs, it spits out:
configure: error: C compiler cannot create executables
If I look in config.log
, I see:
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;
| }
For some reason, autoconf is generating an invalid test file: what should be on that line that is coming up as just an semicolon? The build fails in the same way on Ubuntu 9.04 and Mac OS X 10.6, so this is definitely my fault, not the environment's.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
问题在于
PACKAGE_TARNAME
(和PACKAGE
)中有一个换行符,它是在configure.ac
文件中设置的。您应该查看其中包含的内容 - 修复它,然后重新生成configure
脚本。我的configure.ac 脚本之一包含(靠近顶部):
The trouble is that there is a newline in the
PACKAGE_TARNAME
(andPACKAGE
), which is set in theconfigure.ac
file. You should look at what that contains - fix it, and regenerate theconfigure
script.One of my configure.ac scripts contains (near the top):
看起来问题出在“
jackoff http://github.com/ 中的换行符中enaeseth/jackoff
”。检查一下。It looks like the problem is in a new-line character in "
jackoff http://github.com/enaeseth/jackoff
". Check that.PACKAGE_TARNAME
看起来不太对劲。一方面,它有一个嵌入的换行符,这是导致问题的直接原因。PACKAGE_TARNAME
doesn't look at all right. For one thing, it has an embedded newline, which is the direct cause of your problem.在
configure.ac
的开头有一个额外的AC_INIT
参数。只需将其删除即可。You have an extra argument for
AC_INIT
at the beginning of yourconfigure.ac
. Just remove it.