无法使用 Eigen 库编译 ChibOS

Unable to compile ChibiOS with Eigen library

本文关键字:编译 ChibOS Eigen      更新时间:2023-10-16

我想在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

如何修复此错误?

该函数_sbrk听起来很像与内存分配一起使用的系统调用。是否确定目标系统支持sbrk(2)系统调用?无论如何,询问_sbrk和Raspberry Pi可能会得到更好的结果。您可能想检查这个问题,这似乎是一个类似的问题。