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

时间:2014-09-12 14:41:15

标签: c perl cross-compiling configure mips64

我正在尝试为mips64交叉编译net-snmp,为了做到这一点,我需要libperl库。我尝试使用以下命令为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]

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

我转过来:

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

分为:

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

然后手动运行compile命令以查看哪一行确实包含语法错误。

答案 1 :(得分:0)

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

相关问题