EDP February 2016

Executable works on compiling machine, not on 2nd machine

I have 2 systems; a OpenWrt and a Busybox.

I'm trying to compile a simple gcc executable on the OpenWrt, to copy it and run it on the Busybox machine.

They seem to have very similar CPU so I assume my plan should work.

root@OpenWrt:/# cat /proc/cpuinfo 
system type             : Qualcomm Atheros QCA9558 ver 1 rev 0
machine                 : TP-LINK TL-WR1043ND v2
processor               : 0
cpu model               : MIPS 74Kc V5.0
BogoMIPS                : 358.80
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16 dsp dsp2
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

BusyBox v1.15.3 () built-in shell (ash)
Enter 'help' for a list of built-in commands.
#cat /proc/cpuinfo 
system type             : Broadlight Lilac SOC
processor               : 0
cpu model               : MIPS 74Kc V4.12
BogoMIPS                : 248.21
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 64
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0000, 0x0000, 0x0000, 0x0000]
ASEs implemented        : mips16 dsp
shadow register sets    : 1
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

Trying to compile and run on OpenWrt:

root@OpenWrt:/# cat /hello.c
#include <stdio.h>

int main() {
    printf("Kut met peren!\n");
    return 0;
}

root@OpenWrt:/mnt/sda3# gcc -o hello hello.c 
root@OpenWrt:/mnt/sda3# ./hello
Kut met peren!
root@OpenWrt:/mnt/sda3#

Copying hello to the Busybox an

Answers


Basile Starynkevitch February 2016

Use file(1) & strace(1) & ldd(1) on your second machine (if you don't have them, install them, perhaps by building them from source code with a cross-compiler on your laptop).

I guess that some shared library is missing, or the dynamic linker is different, so try on it:

 file ./hello
 ldd ./hello
 strace ./hello

Also run cat /proc/cpuinfo on your second machine.

this should help you understanding what is wrong.

Post Status

Asked in February 2016
Viewed 2,872 times
Voted 7
Answered 1 times

Search




Leave an answer