【Spiffo】防傻防呆Tips——arm-linux-gcc not found解决方案

本文针对学习系统移植、内核移植时,验证交叉编译工具安装完成出现arm-linux-gcc not found报错的问题进行分析。阐述报错原因,包括系统找不到内容、包内无指令(找不到依赖库或确实没有),并给出对应解决方案,还提供其他版本下载方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

引言:相信学习系统移植,内核移植的朋友如果不会施法安装交叉编译工具的话只能下载压缩包来代替。这样伴随了一个问题:在验证是否安装完成的时候发现arm-linux-gcc not found报错。本篇将分析问题出处与解决方法。

一、为什么报错

         首先总结出会报这个错的原因:无外乎系统找不到这个内容,或者包内没有这个指令。包内没有这个指令又分为找不到依赖库和确实没有这个指令。

二、解决方案       

        我们对症下药,根据上方的不同问题引出不同解决方案(Ubuntu22为例,其他发行版根据整体思路迁移即可):

(1)系统找不到这个内容:

        系统找不到,说明系统路径中没有路径能够将你的指令引导到对应的文件夹,所以系统在它默认能够寻找的地方都没有找到后只能作罢。

1. 要解决这个问题,我们只需要在系统环境变量里告诉系统还可以到什么地方寻找所需的东西就可以了。我们可以这样添加:

vim etc/profile  #打开对应文件添加环境变量内容,当然vi也是可以用的

2.在后文增加如下内容:

export PATH=$PATH:gcc安装包路径/bin
#例如export PATH=$PATH:/arm-linux-gcc-4.4.3-master/bin

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:gcc安装包路径/lib
#例如export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/arm-linux-gcc-4.4.3-master/lib

3.添加完长这样:

4.保存退出后,别忘了更新一下列表(关掉重开也可以):

source /etc/profile

5.然后我们再查看版本,发现已经可以了

        上文我进行的操作分别为强行告诉系统我就是要到这个文件夹下的bin和lib里面寻找我需要的指令,同学们可以不纠结于我为什么要这么书写代码,你只需要知道我的目的就是告诉系统这件事,相信以后遇到类似问题同学们就可以通过搜素”如何添加系统路径“或类似的字眼来寻找解决方案了。

(2)包内没有这个指令-找不到依赖库

        经过长时间搜索查询资料,我发现国内网上大部分的工具版本都是4.4.3,这个工具是基于32位系统来进行编写的,所以我们使用64位系统来调用指令的话会出现库函数的不兼容问题从而导致找不到。我们可以安装32位库文件来解决。翻看笔记,在几年前类似的教学中安装的都是名为"ia32-libs"的库,不过我发现这个库现在已经无法通过apt来下载了。现在这个库的安装已经更新为:

sudo apt-get install lib32z1

安装完后就可以看到编译工具版本了

(3)包内没有这个指令-确实没有

        网上资料繁多,各位同学寻找到的编译工具版本也不一定就相同。这个工具组的本质就是调用可执行文件。可执行文件的名字可不一定相同。比如说新版arm64和旧版arm32的bin文件存在以下区别(上方32位,下方64位):

        很明显,新版的ARM64工具就没有arm-linux-gcc这个可执行程序,那么你去查看当然就是没有的,如果上面的问题都检查过的同学不妨看看自己兜里揣的东西是不是对的,这个问题最呆,但往往也是同学们不会去检查的地方。

三、下载地址与总结

1、总结

        当然了,上面列举的问题是分类后的归纳结果,各位同学的包里也不一定就只存在一个问题。比如我的版本既没有32位库,又没有环境变量的问题也很常见,大家多尝试即可,实在不行也可以评论留言问问其他同学。

2、下载

        对于有些同学,可能会觉得4.4.3的包过于折腾了,还不如直接重装。确实,这样也可以节省不少时间,所以我也为各位提供了下载其他版本的方法:

https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
#ARM官网可以下载最新的版本,但最新的版本资料少,容易出现稀奇古怪的问题

sudo apt-get install gcc-arm-linux-gnueabihf
#apt自动安装,但是如果大家不会领gua域ti展zi开,十有八九会失败

【超级会员V3】通过百度网盘分享的文件:Tip_交叉编译…
链接:https://pan.baidu.com/s/1CEb5aZjyzvdtelFfLq1KcA 
提取码:946e
复制这段内容打开「百度网盘APP 即可获取」
#大家最爱的__网盘,更新的哪个就是直接支持64位的

我是斯皮福,学习不迷路。下方查看整体教学计划

https://blog.youkuaiyun.com/Spiffo_Sir/article/details/133531867?spm=1001.2014.3001.5502
### GRBL on STM32F407 Implementation and Configuration Guide #### Overview of GRBL Porting to STM32F407 GRBL is a high-performance, low-cost CNC controller written in C that runs directly on microcontroller hardware. For the STM32F407 platform, specific considerations must be made due to differences in architecture compared to traditional AVR-based systems used by original GRBL. The STM32F407 features an ARM Cortex-M4 core which offers more processing power than typical AVRs. This allows for enhanced performance when running complex G-code operations or handling multiple peripherals simultaneously[^1]. #### Setting Up Development Environment To begin implementing GRBL on STM32F407, one needs to set up a suitable development environment including: - **IDE**: Use STM32CubeIDE as it provides comprehensive support for all aspects of project creation, code editing, compilation, debugging, etc. - **Toolchain**: Ensure GCC toolchain compatibility since most open-source projects like GRBL rely heavily upon GNU tools during build processes. - **Hardware Interface Libraries (HAL)**: Utilize HAL libraries provided by STMicroelectronics; these simplify interaction between software layers and underlying hardware resources such as timers, UARTs, SPI/IIC interfaces among others. #### Configuring Hardware Resources For configuring servos using commands similar to `M281` mentioned earlier, ensure proper setup within your firmware source files where applicable settings are defined through preprocessor directives like so: ```c #define EDITABLE_SERVO_ANGLES // Enable this feature if required ``` This directive enables dynamic adjustment capabilities via serial command input while also allowing storage into non-volatile memory after changes have been applied successfully. When dealing with conditional compilations involving multiple conditions, prefer usage of `#elif` over nested `#if...else` structures whenever possible because they reduce complexity without sacrificing functionality[^2]: ```c #if SOME_CONDITION == TRUE_VALUE // Code block A #elif ANOTHER_CONDITION == ALTERNATE_TRUE_VALUE // Alternative code path B #else // Default behavior here #endif ``` #### Customizing Firmware Settings Adjustments may need to occur regarding baud rates, step pulses per second limits, acceleration profiles depending on machine requirements. These parameters can typically be found inside configuration header files (`config.h`) distributed alongside official releases from GitHub repositories hosting maintained forks compatible with ARM architectures. #### Testing & Debugging Tips After completing initial integration efforts, thorough testing becomes crucial before deploying any custom-built solution onto actual machinery. Leverage built-in diagnostic modes offered by GRBL itself along with external probes connected to JTAG/SWD ports available on target boards for real-time monitoring purposes. --related questions-- 1. What modifications should I make to optimize GRBL's performance specifically tailored towards the STM32F407 processor? 2. Can you provide examples demonstrating how to interface additional sensors or actuators not originally supported out-of-the-box by standard GRBL distributions? 3. Are there known issues related to port conflicts when integrating USB connectivity alongside other communication channels present on the same device? 4. How does enabling editable servo angle adjustments impact overall system stability under heavy load scenarios?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值