问题描述
我正在尝试构建与MIPS处理器兼容的C静态库(.a)(我正在嵌入式系统中工作).
I'm trying to build a C static library (.a) that is compatible with a MIPS processor (I'm working in an embedded system).
为此,我尝试执行以下命令(obs:我正在使用mipsel-unknown-elf工具):
To do so I tried to execute the following commands (obs: I'm using the mipsel-unknown-elf tool):
mipsel-unknown-elf-gcc -o math.o -c math.c
(此命令无错误)
mipsel-unknown-elf-gcc -archive -o libmath.a math.o -lm
使用此命令,我收到以下错误消息:
找不到-lm
cannot find -lm
collect2:ld返回1个退出状态
collect2: ld returned 1 exit status
通过获取此消息,我尝试添加-L/path参数:
By getting this message I tried to add a -L/path argument:
mipsel-unknown-elf-gcc -archive -o libmath.a math.o -L/usr/lib/i386-linux-gnu -lm
但是随后出现以下错误:
But then I got the following error:
在搜索-lm
skipping incompatible /usr/lib/i386-linux-gnu/libm.a when searching for -lm
找不到-lm
cannot find -lm
collect2:ld返回1个退出状态
collect2: ld returned 1 exit status
有人知道发生了什么吗?
Does anyone knows what's going on?
推荐答案
您的交叉编译器发行版应包含MIPS libm.a
.我刚刚检查了一下,在安装CodeSourcery mips-linux-gnu-gcc
时发现了几个libm.a
版本.我没有安装mipsel-unknown-elf-gcc
,所以无法检查.如果libm.a
的mips-linux-gnu-
版本是自包含的,则可以尝试使用该版本.
Your cross compiler distribution should include a MIPS libm.a
. I just checked and I found several libm.a
versions in my installation of CodeSourcery mips-linux-gnu-gcc
. I don't have mipsel-unknown-elf-gcc
installed, so I can't check that. If the mips-linux-gnu-
version of libm.a
is self contained, you might try using that version.
这篇关于无法构建兼容MIPS的C静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!