C compiler cannot create executables問題
阿新 • • 發佈:2019-01-03
今天在裝advancemame遊戲時遇到下面的問題,在網上搜索才知道是gcc沒有裝好,回想以前也有一些程式沒有裝好,是不是也是這個問題呢?於是試了一下以前一直沒有裝好的d4x,雖然現在熟悉了wget.雖然沒有裝上,不過情況有所好轉,跟以前報的錯誤不同了,應該是能裝了
原因一:
configure 過程中遇到C compiler cannot create executables的原因:
gcc編譯環境沒用配好, 直接apt-get install gcc libc6-dev
就可以解決
原因二:
可能你的環境變數被修改了
vi ~/.bashrc
最後可能的環境變數被改變。。。
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
#######下面的加#註釋掉
# export CC=arm-Linux-gcc
# export AR=arm-linux-ar
# export LD=arm-linux-ld
# export RANLIB=arm-linux-ranlib
# export STRIP=arm-linux-strip
vi /etc/profile
修改最後環境變數
PATH=$PATH:~/linuxarm-gcc/usr- 4.3.2/local/arm/4.3.2/bin/
###註釋掉下面
# export CC=arm-linux-gcc
# export AR=arm-linux-ar
# export LD=arm-linux-ld
# export RANLIB=arm-linux-ranlib
# export STRIP=arm-linux-strip
重啟下配置檔案
source /etc/profile
不行再開一工終端操作。
./configure
通過
OK
原因三:由於我們在編譯軟體之前,進行了export操作,改變了CFLAGS和LIBS的值
我們在編譯軟體的時候,是不是經常遇到下面的錯誤資訊呢?
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
有很多人建議重灌GCC,但是確無濟於事。
這個錯誤產生的原因其實很簡單: 由於我們在編譯軟體之前,進行了export操作,改變了CFLAGS和LIBS的值。
這個時候只要講這個值清空就可以了。
sh export LIBS=
sh export CFLAGS=