2015-07-20 43 views
0
創建可執行文件

我試圖編譯來源Xdebug的,但我成爲這個輸出:C編譯器不能在openSUSE

[email protected]:~/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

那麼,如何解決這個問題,當我的編譯器不工作?

+0

您是否安裝了GCC編譯器? –

+0

當然!cc和gcc都是這樣,它與Zypper模式「C/C++ Development」一起發貨。 – fobo66

回答

0

解決!

我剛剛重新安裝了glibc-devel正確的架構。

如何做到這一點:

  1. 轉到YaST中
  2. 選擇 「軟件管理」 工具
  3. 在搜索字段中鍵入glibc
  4. 馬克包更新glibcglibc-devel(點擊複選框)
  5. 選擇glibc
  6. 點擊第e底部的「版本」選項卡
  7. 選擇具有正確架構的版本,例如2.19-16.15.1-x86_64
  8. 選擇glibc-devel包並做6,7它
  9. 點擊「接受」
  10. 等待安裝
  11. 年底關閉窗口

這個編譯後應能正常工作。

這是類似Windows的方法,這就是爲什麼它吮吸:)原因

當有人知道如何從終端做到這一點,寫答案這裏。

1

嘗試編譯一些簡單的代碼用gcc

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

與命令

gcc -o simple simple.c 

是否會有這樣的「未找到命令」錯誤,然後再GCC不位於環境中的路徑。

也確保GCC可以找到標準頭文件(如stdio.h中和等)

+0

奇怪。有一個gcc的輸出:'gcc -o simple simple.c 來自/usr/include/features.h:402:0, 的文件來自/usr/include/stdio.h:27, from simple.c :1: /usr/include/gnu/stubs.h:10:27:致命錯誤:GNU /存根-64.h:Неттакогофайлаиликаталога #包括 ^ 編譯終止.' – fobo66

+0

啊,試試安裝glibc-devel :) –

+0

它已經安裝好了,但是對於i686架構。 – fobo66

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 看來連接越來越需要它其中的64位所需要的OBJ文件的32位版本。嘗試將LD_LIBRARY_PATH環境變量設置爲來自/ usr/lib64的適當路徑,然後重新編譯。

+0

爲什麼'/ usr/lib64'中不需要64位'crt1.o'等文件。也許,我在錯誤的位置搜索? – fobo66

+0

'/ usr/lib *'中是否沒有名爲'crt1.o'的文件?如果沒有,那麼你的系統可能缺少'glibc-devel'軟件包。您可以使用命令'rpm -qa |檢查它們是否實際安裝grep glibc'。如果未安裝,請嘗試安裝'glibc-devel'軟件包。 – aks

+0

它已經安裝,但爲i686架構。我如何重新安裝x86-64? – fobo66