交叉编译Arm armv5tejl

Nic*_*rne 5 linux gcc arm compilation

我正在尝试为linux系统交叉编译一个简单的hello world程序。

我有以下信息:

uname -a
Linux (none) 2.6.32.28 #130 PREEMPT Mon Feb 18 13:54:18 CST 2013 armv5tejl GNU/Linux

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

Hardware        : KeyASIC Ka2000 EVM
Revision        : 0000
Serial          : 0000000000000000
Run Code Online (Sandbox Code Playgroud)

我想知道如何对该系统进行交叉编译。我尝试了以下方法:

  • arm-linux-gnueabi-gcc helloworld.c -march = armv5 -o helloworld
  • arm-linux-gnueabi-gcc helloworld.c -mcpu = arm926ej-s -o helloworld

但是,当我尝试运行可执行文件时,出现错误消息“找不到命令”。我可能没有正确地编译它,但是根据我所掌握的信息,我不知道要使用什么编译选项。

(我知道helloworld.c都可以正常工作)。

ls -l helloworld
-rwxr-xr-x    1 0        0             8428 Jan  1 00:00 helloworld

which helloworld
which: applet not found
Run Code Online (Sandbox Code Playgroud)

我把busybox-armv5l放在

busybox which helloworld
(no output)
Run Code Online (Sandbox Code Playgroud)

我尝试为其编译的系统上也没有ldd(其超越WifiSD卡)。

ls -ln /lib/libc*
-rwxrwxrwx    1 0        0           244279 Jan 19  2012 /lib/libc.so.0
-rwxrwxrwx    1 0        0            13043 Jan 19  2012 /lib/libcrypt.so.0
-rwxr-xr-x    1 0        0          1251776 Jan  1 00:00 /lib/libcrypto.so.0.9.8
Run Code Online (Sandbox Code Playgroud)

我试图运行/lib/libc.so.0来获取版本信息,但遇到了分段错误。用-static编译似乎可以解决此问题。所以我想这是libc库的问题。感谢您的帮助。

Nic*_*rne 3

我必须使用 -static 标志将 c 库包含在二进制文件中。感谢奥塞伦。