2009-09-22 120 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的額外參數。只要刪除它。

相關問題