Closed ProExpertProg closed 4 years ago
What's the result when you run which arm-none-eabi-g++
? Just to make sure that the compiler is actually in your path.
Also is this from CLion, or from the command line?
Both command line and CLion; they had different PATHs but they both contained /usr/share/bin
.
When I run which arm-none-eabi-g++
, I get /usr/local/bin/arm-none-eabi-gcc
.
I resolved this issue by setting the compilers explicitly using -DCMAKE_C_COMPILER=/usr/local/bin/arm-none-eabi-gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/arm-none-eabi-g++
. In CLion, that can be achieved by setting the toolchain directly.
When you set the toolchain directly, make sure that include(mbed_gcc_arm_toolchain)
happens before any project()
calls; otherwise, you might get an error in terms of
The C compiler
"/usr/local/bin/arm-none-eabi-gcc"
is not able to compile a simple test program.
which happens because CMake is testing the compiler before you set the required options.
While the solution above works, it fails later in the build process because it fails to find other arm-none-eabi-*
files.
A better solution is making sure that the correct path gets added to PATH
. This issue might be unique to CLion on Windows using WSL:
When CLion runs CMake, it does not read .bashrc
. Instead, it only gets its PATH
from /etc/environment
. Hence, if you add the bin
directory of arm-none-eabi
to the definition there, CMake will be able to access all of the toolchain executables.
Be careful: /etc/environment
contains important path definitions (to things like ls
,cp
,mount
), so if you mess it up, you won't be able to access them.
Thank you @multiplemonomials and @jayasurya-sridharan!
I have tried all the solutions above and have the same errors and it still wouldn't recognize the compiler.
On a linux system (Ubuntu 18.04 WSL).
I installed all the dependencies, and am performing step 7 of this guide.
This is the error I'm getting.
I've added the
bin
folder of the Arm toolchain to the path in.bashrc
,.bash_profile
, and.profile
.I've added the following lines in cmake, just above
include(mbed_gcc_arm_toolchain)
:Which print
This makes me think
cmake
only has access to.profile
, which is reasonable to me. Still, the PATH clearly contains the path to the Arm toolchain; if I performI get:
Googling the error itself did not give me any useful feedback. I'd appreciate any pointers!