arm-cmake-toolchains
arm-cmake-toolchains copied to clipboard
Prevent failure if more than one arm-gcc is in PATH
When there is more than one instance of arm-gcc in the PATH, BINUTILS_PATH
ends up with multiple lines (at least on Windows, where the compiler is found with the where
command), making the build fail. This patch deletes everything after the first line, so that only the first occurrence of arm-gcc is used.
@patrislav1 thank you for elaborating on that change.
I am just wondering about a situation when someone accidentally put several toolchains in theirs PATH
. E.g. there are ARM GCC 7 and ARM GCC 8 and the version 7 precedes 8. If a dev wants to build with the version 8, this change silently proceeds a build with the version 7.
Maybe we should stop a build and print out a proper error message for the dev to properly set up PATH
env variable?
I am just wondering about a situation when someone accidentally put several toolchains in theirs PATH. E.g. there are ARM GCC 7 and ARM GCC 8 and the version 7 precedes 8. If a dev wants to build with the version 8, this change silently proceeds a build with the version 7.
This would be consistent with the behavior of the rest of the system. If you enter arm-none-eabi-gcc
on the command prompt, then the first one found in the PATH
is executed, regardless of compiler version. I'd expect the same behavior from this toolchain script. The README.md
of this project even shows the use case of prepending a compiler location to the PATH to force using that one:
PATH=<path/to/arm-none-eabi>:$PATH cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=arm-gcc-toolchain.cmake -DCMAKE_BUILD_TYPE=Debug