【发布时间】:2016-10-06 05:16:23
【问题描述】:
我正在尝试从 GitHub 项目构建固件,该项目使用 GCC-ARM、SCons 和 OpenOCD(我使用的是 Mac btw)。如果我从命令行运行“scons”,项目构建得很好。
但是,我想使用 Eclipse 来构建项目。我安装了“SConsolidator”和“GNU ARM on Eclipse”插件,并将该项目作为 Scons 项目导入。我还进入了项目属性 -> C/C++ 常规 -> 路径和符号,并在包含选项卡下添加了 GNU ARM 包含 GNU C 和 GNU C++ 的目录。
=== Running SCons at 10/5/16 10:04 PM ====
Command line: /usr/local/bin/scons -u --jobs=8
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build/lpc11c14 build/lpc1549 build
CXX build/BMS/src/ADT7470Fan.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/main.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/peripherals.o
sh: arm-none-eabi-g++: command not found
CXX build/BMS/src/pins.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/main.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/peripherals.o
sh: arm-none-eabi-g++: command not found
CXX build/Cutoff/src/pins.o
sh: arm-none-eabi-g++: command not found
scons: *** [build/BMS/src/ADT7470Fan.o] Error 127
CXX build/Dashboard/src/can_dash.o
scons: *** [build/BMS/src/main.o] Error 127
scons: *** [build/BMS/src/peripherals.o] Error 127
scons: *** [build/BMS/src/pins.o] Error 127
scons: *** [build/Cutoff/src/main.o] Error 127
scons: *** [build/Cutoff/src/peripherals.o] Error 127
scons: *** [build/Cutoff/src/pins.o] Error 127
sh: arm-none-eabi-g++: command not found
scons: *** [build/Dashboard/src/can_dash.o] Error 127
scons: building terminated because of errors.
Duration 9132 ms.
我正在按照 Github 页面上的说明进行操作,它适用于其他人,所以我不确定我做错了什么。我怀疑这与 $PATH 未注册 Eclipse 有关,因为我使用 ~/.bash_profile 将 /usr/local/gcc-arm-none-eabi-5_4-2016q3/bin 添加到 $PATH 所以“scons”会在命令行中工作。
【问题讨论】:
-
(只是猜测,没有真正了解 scons 或 Eclipse)可能是从 Eclipse 运行的 scons 使用真正的
sh(或者在 mac 设置为默认替换,旧的sh很少使用,但该错误消息...),当您使用bash时,因此从 CLI 启动它是否使用了您的 .bash_profile?包含路径与此完全无关,错误是关于sh无法找到 g++ 二进制文件(对于特定架构+ABI)。也许检查 scons 是否可以配置为使用 bash,或者如何在登录时为 sh 设置路径,或者在系统级别全局安装该 arm gcc? -
我通过gnuarmeclipse.github.io/toolchain/path发现该错误是由于Eclipse没有找到工具链路径引起的。不幸的是,我不知道如何在 Eclipse 中进行设置。我认为设置 $PATH 就足够了。
-
我意识到我认为我解决了这个问题,但这是不久前的事了。我在 Mac 上运行 Eclipse,我相信我只需要从终端打开 Eclipse(使用打开的 Eclipse.app)就可以让它注册 $PATH。