Autoconf 问题:“错误:C 编译器无法创建可执行文件”

发布于 2024-08-05 06:43:12 字数 1206 浏览 6 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

安穩 2024-08-12 06:43:12

问题在于 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)

The trouble is that there is a newline in the PACKAGE_TARNAME (and PACKAGE), which is set in the configure.ac file. You should look at what that contains - fix it, and regenerate the configure script.

One of my configure.ac scripts contains (near the top):

AC_CONFIG_HEADER(config.h)

PACKAGE="sqlcmd"
VERSION="86.04"

AC_MSG_RESULT([Configuring $PACKAGE version $VERSION])

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
浅笑轻吟梦一曲 2024-08-12 06:43:12

看起来问题出在“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.

格子衫的從容 2024-08-12 06:43:12

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.

呆萌少年 2024-08-12 06:43:12

configure.ac 的开头有一个额外的 AC_INIT 参数。只需将其删除即可。

You have an extra argument for AC_INIT at the beginning of your configure.ac. Just remove it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文