SlickJava SlickJava - 1 year ago 62
Linux Question

Camera's Linux system cannot run compiled C program with './abcd', recognises it as a /bin/sh script instead

recently I started to do some scripting with my camera. I made a simple hello world program in C, compiled it and sent it too my camera.

The camera's system is a very bare bones version of Linux. Running

gives me Linux, and
uname -r
gives me 2.6.35. Bash is not installed on this system.

When I execute any C executable, it thinks that it is a script, giving me the error:
./helloworld: line 1: syntax error: unexpected "("

Any help would be appreciated, thanks.

Answer Source

I assume you compiled your hello world program on your 64 bit desktop PC using something like gcc -o helloworld helloworld.c.

The resulting binary is meant for AMD64 architecture (think Intel 64 bit) and won't run on any other processor type. I.e. it is incompatible with the target system (= your camera) which uses the 32 bit ARTPEC-3 processor with a CRISv32 architecture.

This means that you must cross-compile your program for the camera's CPU. Check e.g. which looks like a very good tutorial on getting your first program to run on your camera.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download