2014-09-12 99 views
0

我想跨編譯net-snmp爲mips64,爲了做到這一點,我需要libperl庫。我試着用下面的命令來配置libperl爲MIPS64:當我嘗試爲mips64交叉編譯libperl時,爲什麼會出現語法錯誤?

./Configure -Dcc=/home/toby/x-tools/mips64-n64-linux-gnu/bin/mips64-n64-linux-gnu-gcc -Dprefix=/home/toby/perl 

但我得到了以下錯誤:

Checking your choice of C compiler and flags for coherency... 
I've tried to compile and run the following simple program: 

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

I used the command: 

/home/toby/x-tools/mips64-n64-linux-gnu/bin/mips64-n64-linux-gnu-gcc -o try -O -I/usr/local/include try.c 
./try 

and I got the following output: 

./try: 1: Syntax error: "(" unexpected 
    The program compiled OK, but exited with status 2. 
(The supplied flags or libraries might be incorrect.) 

You have a problem. Shall I abort Configure [y] 

我怎樣才能解決這個問題?

+1

這看起來像你的外殼,而不是編譯器的錯誤。特別是因爲gcc不會返回語法錯誤的「狀態2」,但bash的確如此。發生這個問題是因爲你有**交叉編譯**一個叫做'。/ try'的程序用於mips64。你如何期望'./configure'在你的** host ** pc上執行它? – indiv 2014-09-12 21:58:24

+0

啊當然!謝謝。 – toocou 2014-09-15 08:31:38

+0

@indiv您應該將其作爲答案發布。 – ThisSuitIsBlackNot 2014-09-15 17:03:35

回答

0

我會轉:

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

分爲:

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

,然後用手運行編譯命令,看看哪些訂單確實包含語法錯誤。

0

這看起來像來自你的shell而不是編譯器的錯誤。特別是因爲gcc不會返回語法錯誤的「狀態2」,但bash的確如此。發生這個問題是因爲你已經爲mips64交叉編譯了一個名爲./try的程序。你如何期待./Configure在你的主機上執行它? - 個人

相關問題