在ubuntu中为MIPS编译netcat的问题

时间:2013-03-14 14:41:30

标签: c compiler-construction mips

我是新手,我有点搞砸了:

我正在尝试为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 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

这是我的路由器的/ 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

有人可以帮我吗? 此致

1 个答案:

答案 0 :(得分:1)

(我无法添加评论,因为我没有足够的积分)

尝试静态编译源代码
问题可能正在发生,因为您在路由器上没有必要的库,可能二进制文件指向 ld-linux.so ,路由器使用 ld-uclibc.so
所以尝试静态构建......

<强>更新
我推荐 buildroot 工具链,其中包括netcat和许多其他工具,如busybox