解决方法:编译IMX6ULL裸机串口程序提示错误arm-none-eabi-ld: cannot find -lgcc: 没有那个文件或目录
来源:     阅读:6
易浩激活码
发布于 2025-10-27 20:47
查看主页

一、问题

编译IMX6ULL野火裸机串口程序出现错误:

make[1]: 进入目录“/home/leung/embed_linux_driver_tutorial_imx6_code-master/bare_metal/uart/device”
arm-none-eabi-gcc -fno-builtin -I/home/leung/embed_linux_driver_tutorial_imx6_code-master/bare_metal/uart/include -c led.c
arm-none-eabi-gcc -fno-builtin -I/home/leung/embed_linux_driver_tutorial_imx6_code-master/bare_metal/uart/include -c system_MCIMX6Y2.c
arm-none-eabi-gcc -fno-builtin -I/home/leung/embed_linux_driver_tutorial_imx6_code-master/bare_metal/uart/include -c clock.c
arm-none-eabi-gcc -fno-builtin -I/home/leung/embed_linux_driver_tutorial_imx6_code-master/bare_metal/uart/include -c uart.c
arm-none-eabi-ld -r led.o system_MCIMX6Y2.o clock.o uart.o  -o device.o
make[1]: 离开目录“/home/leung/embed_linux_driver_tutorial_imx6_code-master/bare_metal/uart/device”
arm-none-eabi-ld -Tbase.lds start.o main.o device/device.o -o base.elf -static -L /usr/lib/gcc/arm-none-eabi/6.3.1 -lgcc
arm-none-eabi-ld: cannot find -lgcc: 没有那个文件或目录
make: *** [makefile:9:all] 错误 1




解决方法:编译IMX6ULL裸机串口程序提示错误arm-none-eabi-ld: cannot find -lgcc: 没有那个文件或目录

二、缘由

由于arm-none-eabi-gcc的版本比较高,不支持以上指令。

查看当前gcc版本:
arm-none-eabi-gcc -v
当前版本为10.3.1




解决方法:编译IMX6ULL裸机串口程序提示错误arm-none-eabi-ld: cannot find -lgcc: 没有那个文件或目录


三、解决方法

3.1 下载Linaro GCC

Linaro 是一间由ARM发起,与其它ARM SOC公司共同投资的非盈利性质的开放源代码软件工程公司,Linaro 开发了许多软件,最著名的就是 Linaro GCC 编译工具链(编译器)。

官网下载:
【老版本,稳定版】https://releases.linaro.org/components/toolchain/binaries/
【新版本,开发版】https://snapshots.linaro.org/gnu-toolchain/
百度网盘:https://pan.baidu.com/s/1w7-PwMcCwXZpOhjfQYFxQg?pwd=2jh0  提取码:2jh0

3.2 修改makefile

arm-none-eabi-ld -Tbase.lds start.o main.o device/device.o -o base.elf -static -L /usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/7.5.0 -lgcc
arm-none-eabi-ld: /usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/7.5.0/libgcc.a(_dvmd_lnx.o): in function `__aeabi_ldiv0 :
/home/tcwg-buildslave/workspace/tcwg-make-release_1/snapshots/gcc.git~linaro-7.5-2019.12/libgcc/config/arm/lib1funcs.S:1545: undefined reference to `raise 
make: *** [makefile:9:all] 错误 1

int raise(void)
{
    return 0;
}


• 由 Leung 写于 2023 年 3 月 30 日

免责声明:本文为用户发表,不代表网站立场,仅供参考,不构成引导等用途。 系统环境
相关推荐
Java Programming 9th Edition - 2019 java程序设计第9版 下载
gitlab clone 报错:remote: HTTP Basic: Access denied;remote: You must use a personal access token wi...
Spring Cloud 与 Dubbo 比较
查理斯·巴贝奇与土耳其机器人
一名开源小白的Apache成长自述
首页
搜索
订单
购物车
我的