C code compiled but executing issue on router

I download the Below SDK. i compiled the code succesfully (hello world)using toolchain, but when i execute that code on GL-inet 1300 router it shows an error message.



-ash: ./hello : not found

kindly suggest the solution to execute c code on router.

Did you chmod +x hello?

yes execute permission is there to the file

What does file hello show? (Not sure if busybox has that implemented, if not then run that on your pc where the toolchain.. it should output arm something... if it outputs x86 the compilation created for the wrong target

Edit: Arm , not mips

if i compile the same code on linux and execute it show the message hello world as i print but when i compiled using toolchain of its sdk it compile but didn't execute i already set the PATH env and staging directory too.

Yes you think you have everything set correctly. But thats what the file command is for. It reads the what a file is.

Im away from my pc at present but this is an example from wikipedia

$ file program
program: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked
    (uses shared libs), stripped

Run file hello on the one compiled for your host pc. Then run it against the one compiled with the sdk. They should show different output.

1 Like

Are you sure you are compiling for the right platform?

i have ar7xx arch router i compile and execute fine, but i face the issue only in ipq40xx series,
same code is execute in ar7xx succesfully but not execute in ipq40xx with its SDK

I have vague memories of reading that the GL.iNet firmware for the B1300 was built with the Qualcomm tool chain for the ipq806x. If you're using the OpenWrt that is under the OEM firmware, you may need to use the GL.iNet-supplied build environment.

Are you running exactly the 18.06.1 release?

The error "-ash: ... : not found" is very often caused with binaries that have been compiled with different libc version (musl instead of uClibc (or vice versa), or wrong version of one of them). So, if you use 18.06.1 SDK, you need to be running the standard 18.06.1 build, so that your compiled binary matches the libc in the router.

1 Like

I agree with @hnyman.

  • The only other thing I can suggest - is to ensure you've installed libstdcpp

Dear hnyman

Thanks for your help buddy GL_INETB1300 is officially declare under the ipq40xx series but it work in ipq80xx old version SDK . new version of ipq80xx didnt support.

Thanks again...