C编译器无法在OpenSUSE上创建可执行文件

时间:2015-07-20 07:37:56

标签: c linux gcc opensuse

我试图从源代码编译xdebug,但我成为了这个输出:

fobo66@linux-3z16:~/xdebug-2.3.3> ./configure
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... no
configure: error: in `/home/fobo66/xdebug-2.3.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

There is my config.log.

我发现了可能的错误:

  

/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file '/usr/lib/crt1.o' is incompatible with i386:x86-64 output /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file '/usr/lib/crti.o' is incompatible with i386:x86-64 output /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file '/usr/lib/crtn.o' is incompatible with i386:x86-64 output /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: dynamic STT_GNU_IFUNC symbol 'strcmp' with pointer equality in '/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie

那么,当我的编译器无法正常工作时如何解决这个问题呢?

3 个答案:

答案 0 :(得分:1)

尝试用gcc编译一些简单的代码

#include <stdio.h>
int main () { printf("hello world\n"); return 0; }

使用命令

gcc -o simple simple.c

如果出现“未找到命令”这样的错误,则gcc不在环境路径中。

还要确保gcc可以找到标准头文件(如stdio.h和e.t.c)

答案 1 :(得分:1)

/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file '/usr/lib/crt1.o' is incompatible with i386:x86-64 output 似乎链接器需要32位版本的所需ob​​j文件,它需要64位。尝试将LD_LIBRARY_PATH环境变量设置为/ usr / lib64中的相应路径,然后重新编译。

答案 2 :(得分:0)

解决!

我只是使用正确的架构重新安装glibc-devel

怎么做:

  1. 转到YaST
  2. 选择&#34;软件管理&#34;工具
  3. 在搜索字段中输入glibc
  4. 将软件包glibcglibc-devel标记为更新(单击复选框)
  5. 选择glibc
  6. 点击&#34;版本&#34;底部的标签
  7. 选择具有正确架构的版本,例如2.19-16.15.1-x86_64
  8. 选择glibc-devel包并为其执行6和7
  9. 点击&#34;接受&#34;
  10. 等待安装结束
  11. 关闭窗口
  12. 此编译后应该正常工作。

    这是类似Windows的方法,这就是为什么它很糟糕的原因:)

    如果有人知道如何从终端进行,请在此处写下答案。