tosiara DD-WRT User
Joined: 20 Dec 2011 Posts: 100
|
Posted: Fri Aug 01, 2014 10:01 Post subject: Compile hello_world against musl |
|
Hi,
is there any wiki about simple program compilation against new musl libc library?
My test platform is:
Code: | # cat /proc/cpuinfo
system type : Atheros AR9132 rev 2 (0xb9)
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 265.42
CPUClock : 400
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
Router Model: TP-Link TL-WR1043ND
Firmware Version: DD-WRT v24-sp2 (06/23/14) std - build 24461
Kernel Version: Linux 3.10.44 #11005 Mon Jun 23 08:30:54 CEST 2014 mips |
I have downloaded toolchains from ftp://ftp.dd-wrt.com/toolchains/toolchains.tar.xz, and found gcc there:
Code: | ./toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.2/bin/mips-openwrt-linux-musl-gcc |
Sample source code to compile:
Code: | #include <stdio.h>
int main(int argc, char **argv)
{ printf("hello %d\n", argc); } |
I compile using this command:
Code: | ./mips-openwrt-linux-musl-gcc hello.c -o hello |
Produced binary is:
Code: | # file hello
hello: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, not stripped |
Then I transfer the binary to my router and try to execute - no error, but also no output:
Can anyone point me - what is wrong?
I tried to compile division by zero - no segfault. Looks like program is not being executed
Any help appreciated
Thaks
Last edited by tosiara on Sat Aug 02, 2014 16:17; edited 1 time in total |
|