如何修复此交叉编译链接错误
How can I fix this cross-compilation linking error
我正尝试在 linux x86_64
机器上为 arm
目标交叉编译一个项目,我正在使用 gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf
.
我在编译过程中遇到的错误是:
/home/zoist/workspace/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/libgcc.a(_dvmd_lnx.o): In function `__aeabi_idiv0':
/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libgcc/config/arm/lib1funcs.S:1545: undefined reference to `raise'
collect2: error: ld returned 1 exit status
我的编译标志是:
CFLAGS = -mtune=cortex-a9 -march=armv7-a -Wall -Werror \
-nostdlib -marm -mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a9
ASFLAGS = -D__ASSEMBLY__ $(CFLAGS)
LDFLAGS = -Wl,-L$(CROSS_COMPILE_DIR)/lib/gcc/arm-linux-gnueabihf/7.4.1/ -lgcc -Wl,-T$(LINK_SCRIPT_GEN) -nostdlib -Wl,--build-id=none
LDLIBS = -Wl,-T$(LINK_SCRIPT_GEN) -lgcc
我花时间在线阅读了类似的主题,但无法解决我的问题。是否有关于如何解决此问题的建议?
如果您需要更多信息,请告诉我。
编辑:
导致错误的完整命令是
arm-linux-gnueabihf-gcc -Wl,-L/lib/gcc/arm-linux-gnueabihf/7.4.1/ -lgcc -Wl,-T../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/firmware.lnk -nostdlib -Wl,--build-id=none -o ../../../../build/tests/arm32/vexpress-a9/freertos/freertos.elf ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/basic_irq.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/basic_stdio.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/basic_string.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_ro.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_rw.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_strerror.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_support.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_sw.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_wip.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/pic/gic.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/serial/pl01x.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/sys/vminfo.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/timer/sp804.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/arch_cache_v7.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/arch_irq.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/arch_math.o ../../../../build/tests/arm32/vexpress-a9/freertos/../basic/arch_board.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/croutine.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/event_groups.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/list.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/portable/MemMang/heap_4.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/queue.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/stream_buffer.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/tasks.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/timers.o ../../../../build/tests/arm32/vexpress-a9/freertos/arm_entry_v7.o ../../../../build/tests/arm32/vexpress-a9/freertos/glue.o ../../../../build/tests/arm32/vexpress-a9/freertos/main.o ../../../../build/tests/arm32/vexpress-a9/freertos/port/port.o ../../../../build/tests/arm32/vexpress-a9/freertos/port/portASM.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/firmware.lnk -Wl,-T../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/firmware.lnk -lgcc
arm-linux-gnueabihf
交叉编译器是 Linux 目标的变体,需要一些 (Linux) OS 支持作为 raise
的未定义引用Linux系统调用指示。
在构建裸 metal/FreeRTOS 应用程序时,必须使用适当的交叉编译器。例如,32 位 ARM CPU 的裸机(非 OS)GCC 变体是 arm-none-eabi
.
使用裸机交叉编译器应该可以解决您遇到的问题。
我正尝试在 linux x86_64
机器上为 arm
目标交叉编译一个项目,我正在使用 gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf
.
我在编译过程中遇到的错误是:
/home/zoist/workspace/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/libgcc.a(_dvmd_lnx.o): In function `__aeabi_idiv0':
/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.4-2019.02/libgcc/config/arm/lib1funcs.S:1545: undefined reference to `raise'
collect2: error: ld returned 1 exit status
我的编译标志是:
CFLAGS = -mtune=cortex-a9 -march=armv7-a -Wall -Werror \
-nostdlib -marm -mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a9
ASFLAGS = -D__ASSEMBLY__ $(CFLAGS)
LDFLAGS = -Wl,-L$(CROSS_COMPILE_DIR)/lib/gcc/arm-linux-gnueabihf/7.4.1/ -lgcc -Wl,-T$(LINK_SCRIPT_GEN) -nostdlib -Wl,--build-id=none
LDLIBS = -Wl,-T$(LINK_SCRIPT_GEN) -lgcc
我花时间在线阅读了类似的主题,但无法解决我的问题。是否有关于如何解决此问题的建议?
如果您需要更多信息,请告诉我。
编辑:
导致错误的完整命令是
arm-linux-gnueabihf-gcc -Wl,-L/lib/gcc/arm-linux-gnueabihf/7.4.1/ -lgcc -Wl,-T../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/firmware.lnk -nostdlib -Wl,--build-id=none -o ../../../../build/tests/arm32/vexpress-a9/freertos/freertos.elf ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/basic_irq.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/basic_stdio.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/basic_string.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_ro.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_rw.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_strerror.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_support.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_sw.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/libfdt/fdt_wip.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/pic/gic.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/serial/pl01x.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/sys/vminfo.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../../common/basic/timer/sp804.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/arch_cache_v7.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/arch_irq.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/arch_math.o ../../../../build/tests/arm32/vexpress-a9/freertos/../basic/arch_board.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/croutine.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/event_groups.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/list.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/portable/MemMang/heap_4.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/queue.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/stream_buffer.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/tasks.o ../../../../build/tests/arm32/vexpress-a9/freertos/FreeRTOS/Source/timers.o ../../../../build/tests/arm32/vexpress-a9/freertos/arm_entry_v7.o ../../../../build/tests/arm32/vexpress-a9/freertos/glue.o ../../../../build/tests/arm32/vexpress-a9/freertos/main.o ../../../../build/tests/arm32/vexpress-a9/freertos/port/port.o ../../../../build/tests/arm32/vexpress-a9/freertos/port/portASM.o ../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/firmware.lnk -Wl,-T../../../../build/tests/arm32/vexpress-a9/freertos/../../common/basic/firmware.lnk -lgcc
arm-linux-gnueabihf
交叉编译器是 Linux 目标的变体,需要一些 (Linux) OS 支持作为 raise
的未定义引用Linux系统调用指示。
在构建裸 metal/FreeRTOS 应用程序时,必须使用适当的交叉编译器。例如,32 位 ARM CPU 的裸机(非 OS)GCC 变体是 arm-none-eabi
.
使用裸机交叉编译器应该可以解决您遇到的问题。