Build option PICO_TOOLCHAIN_PATH has no effect #258

Closed
opened 2021-03-15 04:04:58 -05:00 by josesimoes · 16 comments
josesimoes commented 2021-03-15 04:04:58 -05:00 (Migrated from github.com)

Was trying to use PICO_TOOLCHAIN_PATH to point to the location where I have it installed on my setup.
(I do NOT have gcc it on my path)

Turns out that this option has no effect because it's always cleared here.

As soon as I comment out this line, I can set the PICO_TOOLCHAIN_PATH option and pico_find_compiler happilly finds the compiler.

I can submit a PR with this fix if you want.

Was trying to use `PICO_TOOLCHAIN_PATH` to point to the location where I have it installed on my setup. (I do _NOT_ have gcc it on my path) Turns out that this option has no effect because it's always cleared [here](https://github.com/raspberrypi/pico-sdk/blob/26653ea81e340cacee55025d110c3e014a252a87/cmake/pico_pre_load_toolchain.cmake#L3). As soon as I comment out this line, I can set the `PICO_TOOLCHAIN_PATH` option and `pico_find_compiler` happilly finds the compiler. I can submit a PR with this fix if you want.
kilograham commented 2021-03-15 13:58:24 -05:00 (Migrated from github.com)

how are you setting PICO_TOOLCHAIN_PATH? was this a fresh build directory?

how are you setting `PICO_TOOLCHAIN_PATH`? was this a fresh build directory?
josesimoes commented 2021-03-15 14:05:33 -05:00 (Migrated from github.com)

how are you setting PICO_TOOLCHAIN_PATH? was this a fresh build directory?

Yes, it's a fresh build directory and I'm using VS Code ".vscode\cmake-variants.json" to set the build options.

> how are you setting `PICO_TOOLCHAIN_PATH`? was this a fresh build directory? Yes, it's a fresh build directory and I'm using VS Code ".vscode\cmake-variants.json" to set the build options.
kilograham commented 2021-03-15 14:20:38 -05:00 (Migrated from github.com)

what i meant was how is it getting set from a cmake perspective? command line define, environment?

I know it works with -DPICO_TOOLCHAIN_PATH= on the command line, since i use that all the time!

what i meant was how is it getting set from a cmake perspective? command line define, environment? I know it works with `-DPICO_TOOLCHAIN_PATH=` on the command line, since i use that all the time!
josesimoes commented 2021-03-15 14:48:10 -05:00 (Migrated from github.com)

I was using cmake-variants.json to build with CMake with the CMake Tools extension.

I was using cmake-variants.json to build with CMake with the [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) extension.
josesimoes commented 2021-03-15 15:37:21 -05:00 (Migrated from github.com)

@kilograham do you use just -DPICO_TOOLCHAIN_PATH= or you actually have something in the path ahead of the = ?

@kilograham do you use _just_ `-DPICO_TOOLCHAIN_PATH=` or you actually have _something_ in the path ahead of the `=` ?
lurch commented 2021-03-15 17:51:16 -05:00 (Migrated from github.com)

I suspect Graham meant -DPICO_TOOLCHAIN_PATH=/path/to/toolchain

I _suspect_ Graham meant `-DPICO_TOOLCHAIN_PATH=/path/to/toolchain`
kilograham commented 2021-03-15 18:36:58 -05:00 (Migrated from github.com)

yes, that is what I meant... also what OS are you on?

yes, that is what I meant... also what OS are you on?
josesimoes commented 2021-03-15 18:55:47 -05:00 (Migrated from github.com)

Windows 10, 64bits
VS Code 1.54.1
CMake tools 1.6.0

Windows 10, 64bits VS Code 1.54.1 CMake tools 1.6.0
josesimoes commented 2021-03-15 19:00:41 -05:00 (Migrated from github.com)

Follows the CMake logs, for completeness. On both the PICO_TOOLCHAIN_PATH is set trough .vscode\cmake-variants.json. Build folder cleaned.

With the original code:

[main] Configuring folder: pico-sdk 
[proc] Executing command: "C:/Program Files/CMake/bin/cmake.exe" --no-warn-unused-cli -DCMAKE_MAKE_PROGRAM:STRING=E:/nftools/Ninja/ninja.exe -DPICO_TOOLCHAIN_PATH:STRING=E:/nftools/GNU_Tools_ARM_Embedded/9-2020-q2-update/ -DPICO_COMPILER:STRING=pico_arm_gcc -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -He:/Github/pico-sdk -Be:/Github/pico-sdk/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] PICO_SDK_PATH is E:/Github/pico-sdk
[cmake] Defaulting PICO_PLATFORM to rp2040 since not specified.
[cmake] PICO compiler is pico_arm_gcc
[cmake] PICO_GCC_TRIPLE defaulted to arm-none-eabi
[cmake] CMake Error at cmake/preload/toolchains/find_compiler.cmake:28 (message):
[cmake]   Compiler 'arm-none-eabi-gcc' not found, you can specify search path with
[cmake]   "PICO_TOOLCHAIN_PATH".
[cmake] Call Stack (most recent call first):
[cmake]   cmake/preload/toolchains/pico_arm_gcc.cmake:20 (pico_find_compiler)
[cmake]   C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeDetermineSystem.cmake:93 (include)
[cmake]   CMakeLists.txt:6 (project)
[cmake] 
[cmake] 
[cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
[cmake] CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
[cmake] CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
[cmake] -- Configuring incomplete, errors occurred!

With line 3 @ pico_pre_load_toolchain.cmake commented:

[cmake] -- Build files have been written to: E:/Github/pico-sdk/build
[main] Configuring folder: pico-sdk 
[proc] Executing command: "C:/Program Files/CMake/bin/cmake.exe" --no-warn-unused-cli -DCMAKE_MAKE_PROGRAM:STRING=E:/nftools/Ninja/ninja.exe -DPICO_TOOLCHAIN_PATH:STRING=E:/nftools/GNU_Tools_ARM_Embedded/9-2020-q2-update/ -DPICO_COMPILER:STRING=pico_arm_gcc -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -He:/Github/pico-sdk -Be:/Github/pico-sdk/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] PICO_SDK_PATH is E:/Github/pico-sdk
[cmake] Defaulting PICO_PLATFORM to rp2040 since not specified.
[cmake] PICO compiler is pico_arm_gcc
[cmake] PICO_GCC_TRIPLE defaulted to arm-none-eabi
[cmake] -- The C compiler identification is GNU 9.3.1
[cmake] -- The CXX compiler identification is GNU 9.3.1
[cmake] -- The ASM compiler identification is GNU
[cmake] -- Found assembler: E:/nftools/GNU_Tools_ARM_Embedded/9-2020-q2-update/bin/arm-none-eabi-gcc.exe
[cmake] Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)
[cmake] Defaulting PICO target board to pico since not specified.
[cmake] Using board configuration from E:/Github/pico-sdk/src/boards/include/boards/pico.h
[cmake] -- Found Python3: C:/Program Files/Python39/python.exe (found version "3.9.2") found components:  Interpreter 
[cmake] TinyUSB available at E:/Github/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
[cmake] Compiling TinyUSB with CFG_TUSB_DEBUG=1
[cmake] ELF2UF2 will need to be built
[cmake] -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: E:/Github/pico-sdk/build
Follows the CMake logs, for completeness. On both the `PICO_TOOLCHAIN_PATH` is set trough `.vscode\cmake-variants.json`. Build folder cleaned. With the original code: ``` [main] Configuring folder: pico-sdk [proc] Executing command: "C:/Program Files/CMake/bin/cmake.exe" --no-warn-unused-cli -DCMAKE_MAKE_PROGRAM:STRING=E:/nftools/Ninja/ninja.exe -DPICO_TOOLCHAIN_PATH:STRING=E:/nftools/GNU_Tools_ARM_Embedded/9-2020-q2-update/ -DPICO_COMPILER:STRING=pico_arm_gcc -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -He:/Github/pico-sdk -Be:/Github/pico-sdk/build -G Ninja [cmake] Not searching for unused variables given on the command line. [cmake] PICO_SDK_PATH is E:/Github/pico-sdk [cmake] Defaulting PICO_PLATFORM to rp2040 since not specified. [cmake] PICO compiler is pico_arm_gcc [cmake] PICO_GCC_TRIPLE defaulted to arm-none-eabi [cmake] CMake Error at cmake/preload/toolchains/find_compiler.cmake:28 (message): [cmake] Compiler 'arm-none-eabi-gcc' not found, you can specify search path with [cmake] "PICO_TOOLCHAIN_PATH". [cmake] Call Stack (most recent call first): [cmake] cmake/preload/toolchains/pico_arm_gcc.cmake:20 (pico_find_compiler) [cmake] C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeDetermineSystem.cmake:93 (include) [cmake] CMakeLists.txt:6 (project) [cmake] [cmake] [cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage [cmake] CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage [cmake] CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage [cmake] -- Configuring incomplete, errors occurred! ``` With line 3 @ pico_pre_load_toolchain.cmake commented: ``` [cmake] -- Build files have been written to: E:/Github/pico-sdk/build [main] Configuring folder: pico-sdk [proc] Executing command: "C:/Program Files/CMake/bin/cmake.exe" --no-warn-unused-cli -DCMAKE_MAKE_PROGRAM:STRING=E:/nftools/Ninja/ninja.exe -DPICO_TOOLCHAIN_PATH:STRING=E:/nftools/GNU_Tools_ARM_Embedded/9-2020-q2-update/ -DPICO_COMPILER:STRING=pico_arm_gcc -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -He:/Github/pico-sdk -Be:/Github/pico-sdk/build -G Ninja [cmake] Not searching for unused variables given on the command line. [cmake] PICO_SDK_PATH is E:/Github/pico-sdk [cmake] Defaulting PICO_PLATFORM to rp2040 since not specified. [cmake] PICO compiler is pico_arm_gcc [cmake] PICO_GCC_TRIPLE defaulted to arm-none-eabi [cmake] -- The C compiler identification is GNU 9.3.1 [cmake] -- The CXX compiler identification is GNU 9.3.1 [cmake] -- The ASM compiler identification is GNU [cmake] -- Found assembler: E:/nftools/GNU_Tools_ARM_Embedded/9-2020-q2-update/bin/arm-none-eabi-gcc.exe [cmake] Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize) [cmake] Defaulting PICO target board to pico since not specified. [cmake] Using board configuration from E:/Github/pico-sdk/src/boards/include/boards/pico.h [cmake] -- Found Python3: C:/Program Files/Python39/python.exe (found version "3.9.2") found components: Interpreter [cmake] TinyUSB available at E:/Github/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support. [cmake] Compiling TinyUSB with CFG_TUSB_DEBUG=1 [cmake] ELF2UF2 will need to be built [cmake] -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) [cmake] -- Configuring done [cmake] -- Generating done [cmake] -- Build files have been written to: E:/Github/pico-sdk/build ```
kilograham commented 2021-03-15 19:09:17 -05:00 (Migrated from github.com)

Ah, well -DPICO_TOOLCHAIN_PATH:STRING=... wasn't something i was even aware of, and is the reason for the difference in behavior.

Can you check

set(PICO_TOOLCHAIN_PATH "${PICO_TOOLCHAIN_PATH}" CACHE INTERNAL "")

works for you

Ah, well `-DPICO_TOOLCHAIN_PATH:STRING=...` wasn't something i was even aware of, and is the reason for the difference in behavior. Can you check ``` set(PICO_TOOLCHAIN_PATH "${PICO_TOOLCHAIN_PATH}" CACHE INTERNAL "") ``` works for you
josesimoes commented 2021-03-15 19:14:58 -05:00 (Migrated from github.com)

Yes, that works.

🤔 I didn't think of adding the " because, from the comment, I was under the impression that the intent of the line was precisely to clear the variable.

Yes, that works. 🤔 I didn't think of adding the `"` because, from the comment, I was under the impression that the intent of the line was precisely to clear the variable.
josesimoes commented 2021-03-15 20:07:36 -05:00 (Migrated from github.com)

I can still submit the PR with your fix, if you want to. Not sure if you prefer to handle this other way...
Just let me know.

I can still submit the PR with your fix, if you want to. Not sure if you prefer to handle this other way... Just let me know.
kilograham commented 2021-03-15 20:12:28 -05:00 (Migrated from github.com)

sure, thx

sure, thx
kilograham commented 2021-03-22 09:19:05 -05:00 (Migrated from github.com)

merged into 1.1.1

merged into 1.1.1
jbhntr861 commented 2022-12-07 11:32:16 -06:00 (Migrated from github.com)

Hello I am having this issue I believe

"CMake Warning at pico-sdk/cmake/preload/toolchains/find_compiler.cmake:22 (message):
PICO_TOOLCHAIN_PATH specified (/c/Program Files
(x86)/ARMgnu/mpac/bin/arm-none-eabi-gcc), but arm-none-eabi-gcc not found
there
"

I have tried a million different ways of setting the path to arm-none-eabi-gcc and it will not find it there. Is there any solution to this?

Hello I am having this issue I believe "CMake Warning at pico-sdk/cmake/preload/toolchains/find_compiler.cmake:22 (message): PICO_TOOLCHAIN_PATH specified (/c/Program Files (x86)/ARMgnu/mpac/bin/arm-none-eabi-gcc), but arm-none-eabi-gcc not found there " I have tried a million different ways of setting the path to arm-none-eabi-gcc and it will not find it there. Is there any solution to this?
peterharperuk commented 2022-12-07 13:05:30 -06:00 (Migrated from github.com)

You're commenting on an issue that was fixed some time ago. You might have more luck raising a new issue if you think you have found a new problem. If you just want support - try the forum https://forums.raspberrypi.com/viewforum.php?f=144

You're commenting on an issue that was fixed some time ago. You might have more luck raising a new issue if you think you have found a new problem. If you just want support - try the forum https://forums.raspberrypi.com/viewforum.php?f=144
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#258
No description provided.