LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   C Program doesn't run on openwrt Backfire 10.03 (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/c-program-doesnt-run-on-openwrt-backfire-10-03-a-884145/)

iteam 06-02-2011 09:34 AM

C Program doesn't run on openwrt Backfire 10.03
 
Hi all,
We are trying to compile a helloworld package writted in C and downloaded from the following tutorial: http://manoftoday.wordpress.com/2007...m-for-openwrt/

We have the RouterStation Pro with Backfire 10.03 from the link: http://downloads.openwrt.org/backfir...sysupgrade.bin

root@OpenWrt:~# uname -a

Linux OpenWrt 2.6.32.10 #20 Tue Apr 6 15:01:26 CEST 2010 mips GNU/Linux


The cross-compilation of the package is done selecting:
Target System (Atheros AR71xx/AR7240/AR913x)
Target Profile (Ubiquiti RouterStation Pro)
The other parameters are set by default

The helloworld C package (.ipk) is correctly compiled, copied to the routerstation pro and installed on it, but when we try to run the program we get:
root@OpenWrt:~# helloworld

/bin/helloworld: line 1: syntax error: unexpected "("

Any idea?

David1357 06-02-2011 01:29 PM

Quote:

Originally Posted by iteam (Post 4374128)
root@OpenWrt:~# helloworld
/bin/helloworld: line 1: syntax error: unexpected "("
Any idea?

That error typically occurs when you try to execute an x86 binary on an ARM system. It appears that the "cross-compilation" part of your process did not perform as advertised.

iteam 06-03-2011 08:24 AM

I run the file command in two binaries, one original from Backfire, and my helloword to see the differences, and you are right, the cross-compiling doesn't work. Any idea to fix this?

Quote:

root@OpenWrt:/bin# file helloworld

helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.15, dynamically linked (uses shared libs), corrupted section header size

root@OpenWrt:/bin# file opkg

opkg: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), corrupted section header size


David1357 06-06-2011 12:51 PM

Quote:

Originally Posted by iteam (Post 4375096)
Any idea to fix this?

Did you follow the instructions to create "helloworld_1_mipsel.ipk"?


All times are GMT -5. The time now is 10:12 AM.