我想在Raspberry Pi上使用ChibiOS和Eigen,但是当我包含Eigen库时我得到了一个错误:
Linking build/ch.elf
/opt/arm_gcc/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1
我正在使用Sourcery CodeBench Lite 4.7.2交叉编译器这是make命令:
arm-none-eabi-gcc -c -mcpu=arm7tdmi -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -Wall -Wextra -Wstrict-prototypes -Wa,-alms=build/lst/ -mno-thumb-interwork -MD -MP -MF .dep/build.d -I. -I../../os/ports/GCC/ARM -I../../os/ports/GCC/ARM/BCM2835 -I../../os/kernel/include -I../../os/hal/include -I../../os/hal/platforms/BCM2835 -I../../boards/RASPBERRYPI_MODB -I../../os/various -I../../os/contrib -I../../Eigen main.c -o main.o
如何解决此错误?
答案 0 :(得分:1)
函数_sbrk
听起来非常像用于内存分配的系统调用。您确定要定位的系统支持sbrk(2)
系统调用吗?在任何情况下,您可能会得到更好的结果,询问_sbrk
和Raspberry Pi。您可能想查看this question,这似乎是一个类似的问题。