GNU Arm Embedded Toolchain Build Error

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

GNU Arm Embedded Toolchain Build Error

Post by /RaspberryPi »


Image

Hello fellow tinkerers!

I've been trying to set up CLion to work with building ELF2 an UF2 files for a Raspberry Pi Pico, but I've been having a bit of struggles. I can't use MicroPython for this project due to the required speed/efficiency.

I'm trying to use the [Raspberry Pi Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master).

My host machine is Windows 10 and I'm using the [GNU Arm Embedded Toolchain](https://developer.arm.com/downloads/-/gnu-rm) version 10 2021.10. I've set it up like this on CLion:

GNU Arm Embedded Toolchain - CLion Toolchain Setup

This is my CMakeLists.txt file:

cmake_minimum_required(VERSION 3.13) # initialize pico-sdk from GIT # (note this can come from environment, CMake cache etc) set(PICO_SDK_FETCH_FROM_GIT on) # pico_sdk_import.cmake is a single file copied from this SDK # note: this must happen before project() include(pico_sdk_import.cmake) project(blink) # initialize the Raspberry Pi Pico SDK pico_sdk_init() add_executable(blink src/blink.c) # pull in common dependencies target_link_libraries(blink pico_stdlib) # create map/bin/hex file etc. pico_add_extra_outputs(blink) My CMakeLists loads perfectly fine and the Pico SDK is fetched into the build cmake-build-pico build directory.

C:\Users\Marcel\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\232.9921.42\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/Users/Marcel/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/bin/ninja/win/x64/ninja.exe "-DCMAKE_C_COMPILER=C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-g++.exe" -G Ninja -S C:\Users\Marcel\Downloads\picoTest -B C:\Users\Marcel\Downloads\picoTest\cmake-build-pico Downloading Raspberry Pi Pico SDK PICO_SDK_PATH is C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src Defaulting PICO_PLATFORM to rp2040 since not specified. Defaulting PICO platform compiler to pico_arm_gcc since not specified. PICO compiler is pico_arm_gcc -- The C compiler identification is GNU 10.3.1 -- The CXX compiler identification is GNU 10.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The ASM compiler identification is GNU -- Found assembler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe Build type is Debug Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize) Defaulting PICO target board to pico since not specified. Using board configuration from C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/src/boards/include/boards/pico.h -- Found Python3: C:/Program Files/Python311/python.exe (found version "3.11.4") found components: Interpreter TinyUSB available at C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB. Compiling TinyUSB with CFG_TUSB_DEBUG=1 BTstack available at C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/lib/btstack cyw43-driver available at C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/lib/cyw43-driver Pico W Bluetooth build support available. lwIP available at C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/lib/lwip mbedtls available at C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/lib/mbedtls -- Configuring done (29.2s) -- Generating done (0.1s) -- Build files have been written to: C:/Users/Marcel/Downloads/picoTest/cmake-build-pico [Finished] I've used the blink example provided on the github repo to test if this setup works:

/** * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ #include "pico/stdlib.h" int main() { #ifndef PICO_DEFAULT_LED_PIN #warning blink example requires a board with a regular LED #else const uint LED_PIN = PICO_DEFAULT_LED_PIN; gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); while (true) { gpio_put(LED_PIN, 1); sleep_ms(250); gpio_put(LED_PIN, 0); sleep_ms(250); } #endif } This seems to be generally working so far. After that, I t ried building and I got a compiler not found fatal errors. So I set up the environment variables for the compiler (don't know exactly why CLion is not forwarding the Toolchain compiler locations). I've used the following environment variable: CC=C:\"Program Files (x86)"\"GNU Arm Embedded Toolchain"\"10 2021.10"\bin\arm-none-eabi-gcc.exe;CXX=C:\"Program Files (x86)"\"GNU Arm Embedded Toolchain"\"10 2021.10"\bin\arm-none-eabi-gcc.exe

After resolving the compiler, I now get a different error:

====================[ Build | blink | Pico ]==================================== C:\Users\Marcel\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\232.9921.42\bin\cmake\win\x64\bin\cmake.exe --build C:\Users\Marcel\Downloads\picoTest\cmake-build-pico --target blink -j 10 [1/51] Performing configure step for 'ELF2UF2Build' FAILED: elf2uf2/src/ELF2UF2Build-stamp/ELF2UF2Build-configure C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/elf2uf2/src/ELF2UF2Build-stamp/ELF2UF2Build-configure cmd.exe /C "cd /D C:\Users\Marcel\Downloads\picoTest\cmake-build-pico\elf2uf2 && C:\Users\Marcel\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\232.9921.42\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/Marcel/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/bin/ninja/win/x64/ninja.exe -GNinja -S C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/_deps/pico_sdk-src/tools/elf2uf2 -B C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/elf2uf2 && C:\Users\Marcel\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\232.9921.42\bin\cmake\win\x64\bin\cmake.exe -E touch C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/elf2uf2/src/ELF2UF2Build-stamp/ELF2UF2Build-configure" -- The C compiler identification is GNU 10.3.1 -- The CXX compiler identification is GNU 10.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe -- Check for working C compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe - broken CMake Error at C:/Users/Marcel/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/bin/cmake/win/x64/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message): The C compiler "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/elf2uf2/CMakeFiles/CMakeScratch/TryCompile-u75b7h Run Build Command(s):C:/Users/Marcel/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/232.9921.42/bin/ninja/win/x64/ninja.exe -v cmTC_fe1e1 && [1/2] "C:\PROGRA~2\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-gcc.exe" -o CMakeFiles/cmTC_fe1e1.dir/testCCompiler.c.obj -c C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/elf2uf2/CMakeFiles/CMakeScratch/TryCompile-u75b7h/testCCompiler.c [2/2] cmd.exe /C "cd . && "C:\PROGRA~2\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-gcc.exe" CMakeFiles/cmTC_fe1e1.dir/testCCompiler.c.obj -o cmTC_fe1e1.exe -Wl,--out-implib,libcmTC_fe1e1.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." FAILED: cmTC_fe1e1.exe cmd.exe /C "cd . && "C:\PROGRA~2\GNU Arm Embedded Toolchain\10 2021.10\bin\arm-none-eabi-gcc.exe" CMakeFiles/cmTC_fe1e1.dir/testCCompiler.c.obj -o cmTC_fe1e1.exe -Wl,--out-implib,libcmTC_fe1e1.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." c:/progra~2/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version' c:/progra~2/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed. CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:2 (project) -- Configuring incomplete, errors occurred! ninja: build stopped: subcommand failed. After tracing and trying to find the files it's executing to build, I can see it's pointing towards C:/Users/Marcel/Downloads/picoTest/cmake-build-pico/elf2uf2/src/ELF2UF2Build-stamp/ELF2UF2Build-configure which doesn't seem to exist in the SDK files. Could this signify there's an issue with the Pico SDK itself - and thus should be repotred to Pico SDK?

https://preview.redd.it/xnmxbte2uh9c1.png?width=528&format=png&auto=webp&s=a701224f0233bcd9e2e592615e9251ba61ac30a0

Is this possibly an issue/error with the compiler itself - and thus should be reported to GNU Arm?

Is it caused by CLion because the Toolchain directories are not automatically set up as an environment correctly - and thus should be reported to JetBrains?

Is it something I am doing wrong?

At this point I'm completely out of ideas and don't know what to do next, and I've already been trying dfferent things for about 7 hours now.

Does anyone have any resources I could take a look at? On YouTube I found a single video on how to set it up on Mac OS, and nothing on Windows. I've also taken a look through GitHub and Google, but to no avail I didn't find anything of interest.
submitted by /u/Supermarcel10
[link] [comments]

Source: https://www.reddit.com/r/raspberry_pi/c ... ild_error/
/RaspberryPi
Post Reply

Return to “Raspberry Pi Forum”