简体   繁体   English

在Ubuntu中为MIPS编译Netcat的问题

[英]Problems compiling netcat for MIPS in ubuntu

I'm new with this and I am a little messed with it: 我对此很陌生,对此有些困惑:

I'm trying to compile netcat source code for MIPS in order to deploy it in my router, what I do is: 我正在尝试为MIPS编译netcat源代码,以便将其部署到路由器中,我的工作是:

Download the toolchain for mips: mips-linux-gcc 下载mips的工具链:mips-linux-gcc

Download netcat source and expand it to a folder 下载netcat源并将其扩展到文件夹

cd path/to/netcatsource

Execute:
CC=path/to/compiler/mips-linux-gcc ./configure --host=mips-linux

make

The make command works fine and trying the file command over compiled netcat file displays: make命令可以正常运行,并在编译的netcat文件上尝试使用file命令显示:

file netcat
OUTPUT: ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked (uses shared libs), not stripped

For me everything seems fine, but if I execute ./netcat on my ubuntu box it works, and once I upload it to the router it displays the following error: 对我来说,一切似乎都很好,但是如果我在ubuntu框上执行./netcat,它就可以工作,一旦将其上载到路由器,它就会显示以下错误:

# ./netcat
Segmentation fault

This is the /proc/cpuinfo from my router: 这是我路由器的/ 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

Could anyone help me with this? 有人可以帮我吗? Regards 问候

(I couldn't add a comment due to, I do not have enough points) (由于没有足够的积分,我无法添加评论)

Try to static compile the source code 尝试静态编译源代码
The problem may be happening because you do not have the necessary libraries on the router, maybe the binary is pointing to ld-linux.so and the router uses ld-uclibc.so . 由于您的路由器上没有必需的库,可能是问题所在,二进制文件可能指向ld-linux.so ,而路由器使用了ld-uclibc.so
So try static build... 所以尝试静态构建...

UPDATE UPDATE
I recomend the buildroot toolchain, which by the way include netcat and many other tools like busybox 我推荐了buildroot工具链,顺便说一下,其中包括netcat和busybox等许多其他工具

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM