LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 06-02-2011, 09:34 AM   #1
iteam
LQ Newbie
 
Registered: Jun 2011
Posts: 8

Rep: Reputation: Disabled
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?
 
Old 06-02-2011, 01:29 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by iteam View Post
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.
 
Old 06-03-2011, 08:24 AM   #3
iteam
LQ Newbie
 
Registered: Jun 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
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
 
Old 06-06-2011, 12:51 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by iteam View Post
Any idea to fix this?
Did you follow the instructions to create "helloworld_1_mipsel.ipk"?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I cross-compile a program for my openwrt router? kevinx17910 Linux - Newbie 6 11-17-2010 02:07 PM
How to cross-compile a program for openwrt router? kevinx17910 Programming 5 11-16-2010 06:57 AM
Program doesn't run properly on boot KenPem Programming 8 12-27-2007 04:42 PM
KDE g++ program doesn't run test.cpp richikiki Programming 6 03-17-2006 02:47 PM
Newbie: Gimp 2.0 Program doesn't run! asburyguy Linux - Software 4 04-05-2004 09:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 03:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration