Windows 10 Bash 上 arm-none-eabi-gcc 的错误

Windows 10 Bash 上 arm-none-eabi-gcc 的错误

我正在尝试使用 Windows 10 Bash 运行 ARM 交叉编译器,但似乎无法执行 gcc 编译器(即 arm-none-eabi-gcc)。出现此错误:

arm-none-eabi-gcc: cannot execute binary file: Exec format error

如果您没有安装 32 位库,则此错误会出现在 VM/Ubuntu 机器上,因为我使用的这个 ARM 交叉编译器是 32 位的。在 Windows 10 bash 上安装相同的库仍然无法解决此问题。

我基本上在 bash 中遵循以下步骤: https://dev.px4.io/starting-installing-linux-boutique.html

pushd .
cd ~
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
tar -jxf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2
exportline="export PATH=$HOME/gcc-arm-none-eabi-4_9-2015q3/bin:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
. ~/.profile
popd

对于 32 位库:

sudo apt-get install libc6:i386 libgcc1:i386 libstdc++5:i386 libstdc++6:i386
sudo apt-get install gcc-4.6-base:i386

按照这些步骤操作后,安装似乎正确,但 arm-none-eabi-gcc 的错误消息仍然存在。我在这里所做的操作是否存在不兼容性?

答案1

我遇到过同样的问题。

安装这个版本为我解决了这个问题:

add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
apt-get install gcc-arm-none-eabi=4.9.3.2015q3-1trusty1

在 Ardupilot 论坛上找到了这个解决方案http://discuss.ardupilot.org/t/using-bash-on-windows-for-ardupilot-development/8604/7

相关内容