我是新手,对此有点困惑:
我正在尝试为 MIPS 编译 netcat 源代码以便将其部署在我的路由器中,我所做的是:
下载mips的工具链:mips-linux-gcc
下载netcat源码并将其展开到一个文件夹
cd path/to/netcatsource
Execute:
CC=path/to/compiler/mips-linux-gcc ./configure --host=mips-linux
make
make 命令工作正常,并在已编译的 netcat 文件上尝试 file 命令显示:
file netcat
OUTPUT: ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked (uses shared libs), not stripped
对我来说一切似乎都很好,但是如果我在我的 ubuntu 机器上执行 ./netcat 它就可以工作,一旦我将它上传到路由器它就会显示以下错误:
# ./netcat
Segmentation fault
这是来 self 的路由器的/proc/cpuinfo:
# cat /proc/cpuinfo
system type : 963281T_TEF
processor : 0
cpu model : Broadcom4350 V7.5
BogoMIPS : 319.48
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : no
hardware watchpoint : no
ASEs implemented :
shadow register sets : 1
core : 0
VCED exceptions : not available
VCEI exceptions : not available
unaligned exceptions : 1395
谁能帮我解决这个问题? 问候
最佳答案
(我无法添加评论,因为我没有足够的积分)
尝试静态编译源代码
发生问题的原因可能是路由器上没有必要的库,可能二进制文件指向 ld-linux.so 而路由器使用 ld-uclibc.so.
所以尝试静态构建...
更新
我推荐 buildroot 工具链,顺便说一句,它包括 netcat 和许多其他工具,如 busybox
关于c - 在 ubuntu 中为 MIPS 编译 netcat 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15412351/