当我尝试为mips64交叉编译libperl时,为什么会出现语法错误?

问题描述:

我想跨编译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

我会转:

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

分为:

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

,然后用手运行编译命令,看看哪些订单确实包含语法错误。

这看起来像来自你的shell而不是编译器的错误。特别是因为gcc不会返回语法错误的“状态2”,但bash的确如此。发生这个问题是因为你已经为mips64交叉编译了一个名为./try的程序。你如何期待./Configure在你的主机上执行它? - 个人