0

I am trying to run a c compiled code for a linux based iot devices running busybox, here are the cpu info

cat /proc/cpuinfo
Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 217.08
Features        : swp half thumb fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5

Hardware        : hi3518
Revision        : 0000
Serial          : 0000000000000000

and here is the linux system

Linux (none) 3.0.8 #30 Tue May 27 21:58:10 CST 2014 armv5tejl GNU/Linux

the code I am trying to run is a hello world example in C language and I compile it using the command

arm-linux-gnueabi-gcc -Wall -pedantic -ggdb3  -march=armv5te -mtune=arm926ej-s  main.c http.c   -Wno-unused-variable -o app

the error i am getting

/dev/shm/app: line 1: syntax error: unexpected word (expecting ")")

I am compiling the code on a 64bit machine then copying the compiled binary using wget because the devices does not have gcc

Sec Team
  • 47
  • 8
  • 1
    It looks like it tries to execute it as a script. – Ted Lyngmo Mar 05 '23 at 18:52
  • What is return `file /dev/shm/app` (launched from the arm board) – Mathieu Mar 06 '23 at 08:21
  • 1
    You need a compiler with the busybox library. Your are compiling with a 'gnu libc' as the target which is **gnueabi**. This compiler does not match the target. A compiler is a 'triple' of parameters. OS, libc and CPU. The best advice is to get a compiler that is an exact match, especially if you don't know what you are doing. A recipe is here [Start as thumb](https://stackoverflow.com/questions/20369440/can-start-be-the-thumb-function/20379933#20379933) to write a non-libc binary (completely static binary). This will work with any system libc. – artless noise Mar 06 '23 at 17:24

0 Answers0