rlwrap安裝Invalid configuration `x86_64-unknown-linux-':問題解決

今天在安裝rlwrap的過程中出現如下報錯,具體信息如下:

checking build system type... Invalid configuration `x86_64-unknown-linux-': machine `x86_64-unknown-linux' not recognized
configure: error: /bin/sh tools/config.sub x86_64-unknown-linux- failed

先交代下系統環境,系統爲RedHat 5.3 64bit:

[root@vm-1 rlwrap-0.37]# uname -a
Linux vm-1 2.6.18-128.el5xen #1 SMP Wed Dec 17 12:01:40 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
[root@vm-1 rlwrap-0.37]# getconf LONG_BIT
64

首先查看configure命令運行過程中是那條命令引起錯誤:

[root@szmlvm29-54 ~]# nohup sh -x ./configure && vim nohup
......
+ printf %s 'checking build system type... '
checking build system type... + test '' = set
+ ac_build_alias=
+ test x = x
++ /bin/sh tools/config.guess
+ ac_build_alias=x86_64-unknown-linux-
+ test xx86_64-unknown-linux- = x
++ /bin/sh tools/config.sub x86_64-unknown-linux-
Invalid configuration `x86_64-unknown-linux-': machine `x86_64-unknown-linux' not recognized
......

可以看到引起condifure出現錯誤的原因是由於變量ac_build_alias值引起的,再查看configure腳本的內容發現ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"

2205 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
[root@vm-1 rlwrap-0.37]# vim configure
......
2206 $as_echo_n "checking build system type... " >&6; }
2207 if test "${ac_cv_build+set}" = set; then :
2208   $as_echo_n "(cached) " >&6
2209 else
2210   ac_build_alias=$build_alias
2211 test "x$ac_build_alias" = x &&
2212   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
2213 test "x$ac_build_alias" = x &&
2214   as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
2215 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
2216   as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
2217
2218 fi
......

再綜合兩者得知,實際就是/bin/sh tools/config.guess這個腳本執行出現問題,通過腳本sh -x tools/config.guess來查看腳本執行情況,然後比對正常運行和出現錯誤腳本的情況:

[root@vm-1 tools]# sh -x ./config.guess
......出現錯誤
++ test x = x
++ CC_FOR_BUILD=no_compiler_found
++ set_cc_for_build=
+ cat
++ no_compiler_found -E /tmp/cgb13341/dummy.c
++ grep LIBC=
++ sed -e 's: ::g'
+ eval
+ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ echo x86_64-unknown-linux-
x86_64-unknown-linux-
+ exit
......
正常情況
......
++ test xcc = x
++ set_cc_for_build=
+ cat
++ cc -E /tmp/cgm24262/dummy.c
++ grep LIBC=
++ sed -e 's: ::g'
+ eval LIBC=gnu
++ LIBC=gnu
+ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ echo x86_64-unknown-linux-gnu
x86_64-unknown-linux-gnu
+ exit
......

如上通過以上分析可以發現,出現這個故障其實就是因爲系統命令cc不存在引起的,解決方法就是安裝gcc就行。

[root@vm-1 ~]# yum install -y gcc
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章