rlwrap安装Invalid configuration `x86_64-unknown-linux-':问题解决



今天在安装rlwrap的过程中出现如下报错,具体信息如下:

1
2
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:

1
2
3
4
[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命令运行过程中是那条命令引起错误:

1
2
3
4
5
6
7
8
9
10
11
12
[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"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 -xtools/config.guess来查看脚本执行情况,然后比对正常运行和出现错误脚本的情况:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[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就行。

1
[root@vm-1 ~] # yum install -y gcc

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:23 天前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐