2010-11-20 129 views
1

我試圖爲我的mips平臺編譯libSDL-1.2.14。
但它沒有成功。爲MIPS平臺交叉編譯libSDL時出現的問題

這些是我嘗試了步驟:

  1. 出口PATH = /選擇/ MIPS-4.3/bin中:$ PATH
  2. 走到libSDL-1.2.14源文件夾內。
  3. 給予了 「的./configure前綴=的/ usr /本地/ SDL_Lib主機= MIPS-Linux的GNU」
  4. 執行的 「make」 命令

這是接收到的錯誤:

cc1: warning: include location "/usr/include" is unsafe for cross-compilation
./src/audio/dma/SDL_dmaaudio.c: In function 'DMA_WaitAudio': ./src/audio/dma/SDL_dmaaudio.c:167: error: can't find a register in class 'COP3_REGS' while reloading 'asm'
./src/audio/dma/SDL_dmaaudio.c:167: error: 'asm' operand has impossible constraints make: * [build/SDL_dmaaudio.lo] Error 1

,但後來不給下面的命令重新生成文件:

  1. 使清潔
  2. ./configure --prefix =/usr/local/SDL_Lib --host = mips-linux-gnu CPPFLAGS = -I/opt/mips-4.3/mips-linux-gnu/libc/usr/include/
  3. make

注意:/opt/mips-4.3/mips-linux-gnu/libc/usr/include/ - 這是您可以找到mips平臺的select.h文件的路徑。它包含宏FD_ZERO和FD_SET的定義。

我仍然收到同樣的錯誤。

cc1: warning: include location "/usr/include" is unsafe for cross-compilation
./src/audio/dma/SDL_dmaaudio.c: In function 'DMA_WaitAudio':
./src/audio/dma/SDL_dmaaudio.c:167: error: can't find a register in class 'COP3_REGS' while reloading 'asm'
./src/audio/dma/SDL_dmaaudio.c:167: error: 'asm' operand has impossible constraints make: * [build/SDL_dmaaudio.lo] Error 1

請幫助我一些有價值的指針。

感謝,

+0

關於「/ usr/include」警告,通常在沒有訪問系統頭文件的情況下從chroot環境進行交叉編譯通常更容易。 – ninjalj 2010-11-20 12:30:18

回答

2

首先,不要將路徑設置交叉編譯器爲您的PATH的第一部分,將其設置爲最後:

export PATH=$PATH:<path to cross-compiler> 

它的安全這樣。其次,運行./configure --help以獲取所有選項。什麼是錯誤訊息會說,如果它是聰明如下:

  1. 你試圖交叉編譯,因爲你設置--host標誌
  2. 但你不改變任何對於在哪裏可以找到其他的選擇包括和目標環境庫
  3. 我將使用/ usr/include目錄默認
  4. 但是,這對於主機系統時,交叉編譯
這將無法正常工作

檢查其他配置e需要設置的選項,以告訴configure腳本在何處查找.h文件(包括)以及目標庫。這些通常與您下載的交叉編譯器一起提供。此外,在運行配置之前,您應該將CROSS_COMPILE環境變量設置爲交叉編譯器前綴。前綴是交叉編譯器中gcc之前的部分,假設您使用GCC作爲交叉編譯器。