Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在非标准位置构建gcc-4.3.4时出现问题_C_Linux_Gcc_Compiler Construction_Build - Fatal编程技术网

在非标准位置构建gcc-4.3.4时出现问题

在非标准位置构建gcc-4.3.4时出现问题,c,linux,gcc,compiler-construction,build,C,Linux,Gcc,Compiler Construction,Build,我需要在非标准位置(安装NFS)构建gcc-4.3.4。我配置了: ../gcc-4.3.4/configure --prefix={install dir} --with-gmp={install dir} --with-mpfr={install dir} --with-local-prefix={install dir} --disable-shared 我运行了make-j1。但我一直得到: checking for suffix of object files... configur

我需要在非标准位置(安装NFS)构建gcc-4.3.4。我配置了:

../gcc-4.3.4/configure --prefix={install dir} --with-gmp={install dir} --with-mpfr={install dir} --with-local-prefix={install dir} --disable-shared
我运行了
make-j1
。但我一直得到:

checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile
x86\u 64-unknown-linux-gnu/libgcc/config.log
中,我可以看到:

/home/panthdev/apps/gcc-4.3.4-compliant/compiler/objdir/./gcc/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory
libmpfr.so.1
{install dir}/lib
中。另外,如果我将
LD_LIBRARY_PATH
设置为
{install dir}/lib
,则它会找到
libmpfr.so.1
,但
config.log
会开始抱怨:

/tmp/cce9YhFK.s: Assembler messages:
/tmp/cce9YhFK.s:16: Error: bad register name `%rbp'
/tmp/cce9YhFK.s:18: Error: bad register name `%rsp'

在GCC 4.5.2配置脚本(我有可用的配置,但不是4.3.4)中,您可能应该尝试使用带有sysroot的
--而不是
--前缀的

,在大约4500行(共15.5K行)处,有一节:

rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if test "${ac_cv_objext+set}" = set; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compile") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; then :
  for ac_file in conftest.o conftest.obj conftest.*; do
  test -f "$ac_file" || continue;
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
       break;;
  esac
done
else
  $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot compute suffix of object files: cannot compile
See \`config.log' for more details." "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
rm-f conftest.$ac_ext
EXEXT=$ac\U cv\U EXEXEXT
ac_EXEXEXT=$EXEXEXT
{$as_echo“$as_me:${as_lineno-$lineno}:检查对象文件的后缀”>&5
$as_echo_n“检查对象文件的后缀…”>&6;}
如果测试“${ac_cv_objext+set}”=set;然后:
$as_echo_n“(缓存)”>&6
其他的

cat confdefs.h-据我所知,您有32位的binutils,而gcc正在尝试进行64位的构建。确保您的binutils和gcc具有相同的配置。

我总是使用--prefix和非标准位置构建gcc;这很有效。我不使用--with local prefix选项,但我不认为这是问题的一部分。我以前确实尝试过不使用--with local prefix。由于我事先在同一位置安装了mpfr、gmp和mpc,并且/usr/local实际上在机器上没有任何东西,因此我将该位置作为local-prefix。在这一阶段,我的最佳建议是:(1)复制配置脚本,(2)在错误消息后立即将其删除,(3)在“sh-x”下运行被攻击的脚本,以及(4)查看从节开始到结束的输出(最后100行左右输出)。也许这会告诉你出了什么问题。哦,还有另一个窍门:我发现在构建GCC时最好确保
--prefix
目录不存在;如果是,系统将计算实际路径(通过符号链接读取)并将实际路径嵌入可执行文件(即使您希望它使用指定的名称)。然而,这是处理过程中的一个更晚的阶段。哦,还有另一个技巧:如果您的shell与POSIX不太相似,那么您可能需要在环境中设置CONFIG_shell。我需要在Solaris上执行此操作,其中/bin/sh是一个相当普通的Bourne shell,并不足够。然而,在编译的后期,这也给我带来了问题——在配置Java、IIRC时。但是,如果您使用一个不寻常的shell(
zsh
maybe?),您可能需要将CONFIG_shell设置为bash或ksh。感谢您的回复。我终于把它造好了。PATH中的汇编程序和较新的gcc之间的兼容性存在一些问题。故事的寓意:在安装新的gcc时,不要相信您以前的binutils。