OpenWrt Forum Archive

Topic: Unable to crosscompile a program for Kamikaze on WRT54GL

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I have a WRT54GL with OpenWrt Kamikaze 8.09 r 14511 installed.
I compiled a simple HelloWorld Program with Ubuntu on my laptop.
I tried the compilers from two SDKs:
1.) OpenWrt-SDK-atheros-2.6-for-Linux-i686.tar.bz2
2.)from http://downloads.openwrt.org/whiterussi … -1.tar.bz2

I compiled it like that:

root@OpenWrt:~#staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc -o helloworld helloworld.c

and then I copied helloworld to my router.
When I tried to execute it (./helloworld), I got this error (with both SDKs):

./helloworld: line 1 : syntax erorr "(" unexpected

Can somebody help me?

I guess it is because the compiler I used is outdated. However, I can't find an SDK for Kamikaze.

So can you tell me what I did wrong or, if my compiler is really outdated, tell me where I can get a new one?

regards

(Last edited by miranda on 3 Sep 2009, 17:00)

hi,

it works now! smile

regards

Hello Miranda,

Glad to see that you've got it to work.  I had difficulties when I started, and so constructed the following Makefile  (specific project actions omitted) to provide all the definitions I needed on my Mac:

LINKSYSDIR      = ../../linksys

ARCH            = mipsel
STAGING         = /Volumes/openwrt/staging_dir
MIPSEL          = $(STAGING)/mipsel
TOOLCHAIN       = $(STAGING)/toolchain-mipsel_gcc3.4.6
BIN             = $(TOOLCHAIN)/bin

INCLUDES        = -I$(TOOLCHAIN)/include -I$(MIPSEL)/usr/include -I$(INCDIR)
CFLAGS          += -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time

CC              = $(BIN)/mipsel-linux-uclibc-gcc
AR              = $(BIN)/mipsel-linux-uclibc-ar
RANLIB          = $(BIN)/mipsel-linux-uclibc-ranlib
STRIP           = $(BIN)/mipsel-linux-uclibc-strip

LIBDIRS         = -L$(LINKSYSDIR) -L$(TOOLCHAIN)/lib -L$(MIPSEL)/usr/lib

The discussion might have continued from here.