0

I'm trying to cross compile net-snmp for mips64, and in order to do that I need the libperl library. I tried to configure libperl for mips64 using the following command:

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

But I got the following error:

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]

How can I fix this?

ThisSuitIsBlackNot
  • 23,492
  • 9
  • 63
  • 110
toocou
  • 11
  • 2
  • 1
    That looks like an error from your shell and not the compiler. Particularly because gcc doesn't return "status 2" for a syntax error, but bash does. The problem happens because you have **cross compiled** a program called `./try` for mips64. How do you expect `./Configure` to execute it on your **host** pc? – indiv Sep 12 '14 at 21:58
  • @indiv You should post that as an answer. – ThisSuitIsBlackNot Sep 15 '14 at 17:03
  • Unfortunately I don't know the answer to the "How can I fix this", question. The answer depends a lot on libperl, but typically you run configure scripts with your host environment and then `make` with `CC` and other variables set to your cross compiler. I'd certainly appreciate if @toocou self-answers the question with details after figuring it out. – indiv Sep 15 '14 at 17:19

2 Answers2

0

I'd turn:

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

Into:

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

And then run the compile command by hand to see which line really contains the syntax error.

Len Jaffe
  • 3,442
  • 1
  • 21
  • 28
0

That looks like an error from your shell and not the compiler. Particularly because gcc doesn't return "status 2" for a syntax error, but bash does. The problem happens because you have cross compiled a program called ./try for mips64. How do you expect ./Configure to execute it on your host pc? – indiv

toocou
  • 11
  • 2