raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.25k stars 838 forks source link

[question] Build fails for simple test program due to missing native compiler but pioasm or elf2uf2 are not used #1693

Closed HackXIt closed 2 months ago

HackXIt commented 2 months ago

Greetings,

I have an open issue on conan which describes the following build error when using the pico SDK in a conan project:

Build error ``` ======== Calling build() ======== conanfile.py (pico-conan-blink/0.0.1): Calling build() conanfile.py (pico-conan-blink/0.0.1): Running CMake.configure() conanfile.py (pico-conan-blink/0.0.1): RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/home/rini/git-stash/pico-conan-blink/build/Debug/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/rini/git-stash/pico-conan-blink" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "/home/rini/git-stash/pico-conan-blink" -- Using Conan toolchain: /home/rini/git-stash/pico-conan-blink/build/Debug/generators/conan_toolchain.cmake Using PICO_SDK_PATH from environment ('/home/rini/pico/sdk') PICO_SDK_PATH is /home/rini/pico/sdk Defaulting PICO_PLATFORM to rp2040 since not specified. -- Conan toolchain: C++ Standard 17 with extensions ON -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The C compiler identification is GNU 12.2.1 -- The CXX compiler identification is GNU 12.2.1 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/arm-none-eabi-gcc -- Detecting C compiler ABI info Using PICO_SDK_PATH from environment ('/home/rini/pico/sdk') PICO_SDK_PATH is /home/rini/pico/sdk 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 -- Detecting C compiler ABI info - failed -- Check for working C compiler: /usr/bin/arm-none-eabi-gcc Using PICO_SDK_PATH from environment ('/home/rini/pico/sdk') PICO_SDK_PATH is /home/rini/pico/sdk 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 -- Check for working C compiler: /usr/bin/arm-none-eabi-gcc - broken CMake Error at /usr/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message): The C compiler "/usr/bin/arm-none-eabi-gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/rini/git-stash/pico-conan-blink/build/Debug/CMakeFiles/CMakeScratch/TryCompile-j07YgO Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_0f430/fast && /usr/bin/gmake -f CMakeFiles/cmTC_0f430.dir/build.make CMakeFiles/cmTC_0f430.dir/build gmake[1]: Entering directory '/home/rini/git-stash/pico-conan-blink/build/Debug/CMakeFiles/CMakeScratch/TryCompile-j07YgO' Building C object CMakeFiles/cmTC_0f430.dir/testCCompiler.c.o /usr/bin/arm-none-eabi-gcc -O3 -DNDEBUG -o CMakeFiles/cmTC_0f430.dir/testCCompiler.c.o -c /home/rini/git-stash/pico-conan-blink/build/Debug/CMakeFiles/CMakeScratch/TryCompile-j07YgO/testCCompiler.c Linking C executable cmTC_0f430 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0f430.dir/link.txt --verbose=1 /usr/bin/arm-none-eabi-gcc -O3 -DNDEBUG CMakeFiles/cmTC_0f430.dir/testCCompiler.c.o -o cmTC_0f430 /usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit': /build/newlib-afIbHz/newlib-3.3.0/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit' collect2: error: ld returned 1 exit status gmake[1]: *** [CMakeFiles/cmTC_0f430.dir/build.make:99: cmTC_0f430] Error 1 gmake[1]: Leaving directory '/home/rini/git-stash/pico-conan-blink/build/Debug/CMakeFiles/CMakeScratch/TryCompile-j07YgO' gmake: *** [Makefile:127: cmTC_0f430/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:30 (project) -- Configuring incomplete, errors occurred! See also "/home/rini/git-stash/pico-conan-blink/build/Debug/CMakeFiles/CMakeOutput.log". See also "/home/rini/git-stash/pico-conan-blink/build/Debug/CMakeFiles/CMakeError.log". ERROR: conanfile.py (pico-conan-blink/0.0.1): Error in build() method, line 65 cmake.configure(cli_args=common_cmake_args) ConanException: Error 1 while executing ```

Here is a somewhat minimal example on what our CMakeLists look like in our RP2040 projects:

CMakeLists.txt ```cmake cmake_minimum_required(VERSION 3.13...3.27) include(FetchContent) # PICO_SDK ------------------------------------------------------------------------------ # Initialise pico_sdk from installed location # (note this can come from environment, CMake cache etc) if(NOT DEFINED $ENV{PICO_SDK_PATH}) # Pull in Raspberry Pi Pico SDK (must be before project) message(STATUS "PICO_SDK_PATH not defined.") if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/deps/pico-sdk) message(STATUS "Using path: ${CMAKE_CURRENT_BINARY_DIR}/deps/pico-sdk") include(${CMAKE_CURRENT_BINARY_DIR}/deps/pico-sdk/pico_sdk_init.cmake) elseif(EXISTS ${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake) message(STATUS "Using path: ${CMAKE_CURRENT_LIST_DIR}") include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake) else() message(FATAL_ERROR "PICO_SDK_PATH not defined and pico_sdk_import.cmake not found.") endif() else() message(STATUS "PICO_SDK_PATH defined. Using path: $ENV{PICO_SDK_PATH}") include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) endif() set(PICO_BOARD pico CACHE STRING "Board type") if (PICO_SDK_VERSION_STRING VERSION_LESS "1.5.0") message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.5.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}") endif() project(pico-conan-blink LANGUAGES C CXX ASM VERSION 0.0.1) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) # Initialise the Raspberry Pi Pico SDK pico_sdk_init() # create disassembly with source function(pico_add_dis_output2 TARGET) add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJDUMP} -S $ >$>,$,$>.dis2) add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND arm-none-eabi-size ${CMAKE_CURRENT_BINARY_DIR}/$>,$,$>.elf VERBATIM ) endfunction() # LIBRARIES ------------------------------------------------------------------------------ # https://stackoverflow.com/questions/7787823/cmake-how-to-get-the-name-of-all-subdirectories-of-a-directory macro(SUBDIRLIST result curdir) file(GLOB children RELATIVE ${curdir} ${curdir}/*) set(dirlist "") foreach(child ${children}) if(IS_DIRECTORY ${curdir}/${child} AND EXISTS ${curdir}/${child}/CMakeLists.txt) list(APPEND dirlist ${child}) endif() endforeach() set(${result} ${dirlist}) endmacro() # Add each library in the lib directory SUBDIRLIST(LIBDIRS ${CMAKE_CURRENT_LIST_DIR}/lib) foreach(libdir ${LIBDIRS}) add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/${libdir}) endforeach() # GITVERSION ------------------------------------------------------------------------------ FetchContent_Declare(cmake_git_version_tracking GIT_REPOSITORY https://github.com/andrew-hardin/cmake-git-version-tracking.git GIT_TAG 904dbda1336ba4b9a1415a68d5f203f576b696bb ) FetchContent_MakeAvailable(cmake_git_version_tracking) # BUILD ------------------------------------------------------------------------------ # Device type configuration # Check if the build type is Debug if(CMAKE_BUILD_TYPE STREQUAL "Debug") # Add compile options for Debug build add_compile_options(-g) # include debug info add_compile_options(-O0) # no optimization add_compile_options(-fno-inline) # no inlining add_compile_definitions(DEBUG) # define DEBUG endif() if(CMAKE_BUILD_TYPE STREQUAL "Release") # Add compile options for Release build add_compile_options(-O3) # optimize for speed add_definitions(-DFW_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}) add_definitions(-DFW_VERSION_MINOR=${PROJECT_VERSION_MINOR}) add_definitions(-DFW_VERSION_PATCH=${PROJECT_VERSION_PATCH}) endif() # Custom Conan package dependencies # E.g.: find_package(lex-common REQUIRED) # Add executable. Default name is the project name, version 0.1 add_executable(${PROJECT_NAME} src/main.cpp) set_target_properties(${PROJECT_NAME} PROPERTIES CMAKE_C_STANDARD 11 CMAKE_CXX_STANDARD 17 ) # Add the standard include files to the build target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/inc ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts or any other standard includes, if required ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) # compiler flags target_compile_options(${PROJECT_NAME} PRIVATE $<$:-fno-rtti> -fno-exceptions -fno-check-new $<$:-fno-enforce-eh-specs> -g -ffunction-sections -fdata-sections -O3 -funroll-loops $<$:-Wno-psabi> # NOTE Compiling with GCC 7.1 or later, so can ignore ABI compatibility warnings when they come up (-Wpsabi) -Wno-unknown-pragmas -Werror -Wall ) target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEVICE_TYPE} PICO_HEAP_SIZE=4096 PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64 ) # select linker script # pico_set_binary_type(${PROJECT_NAME} copy_to_ram) # Generate PIO headerss here if necessary # pico_generate_pio_header(... ${CMAKE_CURRENT_LIST_DIR}/pio/...) pico_set_program_name(${PROJECT_NAME} "${PROJECT_NAME}") pico_set_program_version(${PROJECT_NAME} "0.1") pico_enable_stdio_uart(${PROJECT_NAME} 0) pico_enable_stdio_usb(${PROJECT_NAME} 1) #pico_add_extra_outputs(${PROJECT_NAME}) #pico_add_dis_output2(${PROJECT_NAME}) file(GLOB SOURCES_CPP "src/*.cpp") file(GLOB SOURCES_C "src/*.c") target_sources(${PROJECT_NAME} PRIVATE ${SOURCES_C} ${SOURCES_CPP} ) # Add the standard library to the build target_link_libraries(${PROJECT_NAME} PRIVATE pico_stdlib ) # linker options target_link_options(${PROJECT_NAME} PRIVATE "LINKER:--print-memory-usage" ) ```

And here is a somewhat minimal conanfile.py that goes along with that:

conanfile.py ```python from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.scm import Git from conan.tools.files import get class BlinkRecipe(ConanFile): name = "pico-conan-blink" version = "0.0.1" package_type = "application" arch = "armv6" # Optional metadata license = "" author = "" description = "Conan + Pico SDK Toolchain example with blink code" # Binary configuration settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "parallel": [True, False]} default_options = {"shared": False, "parallel": True} # Sources are located in the same place as this recipe, copy them to the recipe exports_sources = "src/*", "CMakeLists.txt" def layout(self): cmake_layout(self, src_folder=".", build_folder="build") def source(self): # get(self, "https://github.com/raspberrypi/pico-sdk/archive/refs/tags/1.5.1.tar.gz", destination="deps/pico-sdk", strip_root=True) pass def requirements(self): # Any custom static library packages go here pass def build_requirements(self): pass # def layout(self): # self.folders.source = "src" # self.folders.build = "build" # self.cpp.source.includedirs = ["inc"] def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) tc.extra_cflags = ["--mcpu=cortex-m0plus", "-mthumb"] tc.extra_cxxflags = ["--mcpu=cortex-m0plus", "-mthumb"] tc.preprocessor_definitions["PICO_SDK_PATH"] = "deps/pico-sdk" tc.generate() def build(self): # It was also attempted to use the PICO_SDK_PATH from the environment here - the behaviour is the same get(self, "https://github.com/raspberrypi/pico-sdk/archive/refs/tags/1.5.1.tar.gz", destination="deps/pico-sdk", strip_root=True) common_cmake_args = [] cmake = CMake(self) cmake.configure(cli_args=common_cmake_args) if self.options.parallel: common_cmake_args += ["--parallel"] cmake.build(cli_args=common_cmake_args) ```

Conan does not provide the native C/C++ compiler to the build process, but only arm-none-eabi cross-compiler.

Despite my CMakeLists.txt not using the cmake functions provided by the pioasm and elf2uf2 tools, there still seems to be a hidden step that does require some sort of native compiler, resulting in the simple test program error.

Am I doing something wrong or forgetting something?

I've setup conan so that it loads the pico_sdk_import.cmake during the build step and it's visible in the logs that configuration catches multiple C/C++ compiler setups (I am yet unsure why it is done multiple times, I suspect due to the additional import in my CMakeLists.txt)

However, from there on, the project should actually compile just fine, since it has the cross-compiler, it finds the SDK, so I don't see a reason why it should fail in the way it does.

Without conan the project compiles fine, which led me here to ask where this somewhat hidden dependency on the native C/C++ compiler lies or what does specific error means in the context of the pico SDK.

peterharperuk commented 2 months ago

By coincidence we were talking about this today...

Yes, it's a common problem I'm afraid. Some people work around the issue https://forums.raspberrypi.com/viewtopic.php?t=350982

On windows - which doesn't have a native compiler - the following is included before including pico_sdk_import.cmake

set(Pioasm_TARGET Pioasm)
set(Pioasm_EXECUTABLE ${pico-sdk-tools_DIR}/pioasm.exe)
if(NOT TARGET ${Pioasm_TARGET})
    add_executable(${Pioasm_TARGET} IMPORTED)
endif()
set_property(TARGET ${Pioasm_TARGET} PROPERTY IMPORTED_LOCATION ${Pioasm_EXECUTABLE})
set(Pioasm_FOUND 1)

set(ELF2UF2_TARGET ELF2UF2)
set(ELF2UF2_EXECUTABLE ${pico-sdk-tools_DIR}/elf2uf2.exe)
if(NOT TARGET ${ELF2UF2_TARGET})
    add_executable(${ELF2UF2_TARGET} IMPORTED)
endif()
set_property(TARGET ${ELF2UF2_TARGET} PROPERTY IMPORTED_LOCATION ${ELF2UF2_EXECUTABLE})
set(ELF2UF2_FOUND 1)
HackXIt commented 2 months ago

That's great news!

I have included your cmake snippet before the import, but it didn't seem to do the trick just yet.

I quickly applied my hack to get around the simple test program error, which I can't seem to fix: (For some reason I always get Detecting C compiler ABI info - failed and Detecting CXX compiler ABI info - failed, which I believe results in the simple test program error whenever using conan to build)

set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

But now I get the following build error:

Build log ``` $ conan build . --profile=rp2040-debug ======== Input profiles ======== Profile host: [settings] arch=armv6 build_type=Debug compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=12 os=baremetal [conf] tools.cmake.cmaketoolchain:user_toolchain=['$ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake'] [buildenv] CC=/usr/bin/arm-none-eabi-gcc CXX=/usr/bin/arm-none-eabi-g++ AR=/usr/bin/arm-none-eabi-ar AS=/usr/bin/arm-none-eabi-as RANLIB=/usr/bin/arm-none-eabi-ranlib LD=/usr/bin/arm-none-eabi-ld STRIP=/usr/bin/arm-none-eabi-strip Profile build: [settings] arch=armv8 build_type=Release compiler=gcc compiler.cppstd=gnu17 compiler.libcxx=libstdc++11 compiler.version=12 os=Linux ======== Computing dependency graph ======== Graph root conanfile.py (pico-conan-blink/0.0.1): /home/rini/git-stash/pico-conan-blink/conanfile.py ======== Computing necessary packages ======== ======== Installing packages ======== ======== Installing packages ======== ======== Finalizing install (deploy, generators) ======== conanfile.py (pico-conan-blink/0.0.1): Calling generate() conanfile.py (pico-conan-blink/0.0.1): Generators folder: /home/rini/git-stash/pico-conan-blink/build/Debug/generators conanfile.py (pico-conan-blink/0.0.1): CMakeToolchain generated: conan_toolchain.cmake conanfile.py (pico-conan-blink/0.0.1): Preset 'conan-debug' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-debug' if using CMake>=3.23 conanfile.py (pico-conan-blink/0.0.1): If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/home/rini/git-stash/pico-conan-blink/build/Debug/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug' conanfile.py (pico-conan-blink/0.0.1): CMakeToolchain generated: CMakePresets.json conanfile.py (pico-conan-blink/0.0.1): CMakeToolchain generated: ../../../CMakeUserPresets.json conanfile.py (pico-conan-blink/0.0.1): Generating aggregated env files conanfile.py (pico-conan-blink/0.0.1): Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] ======== Calling build() ======== conanfile.py (pico-conan-blink/0.0.1): Calling build() conanfile.py (pico-conan-blink/0.0.1): Running CMake.configure() conanfile.py (pico-conan-blink/0.0.1): RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/home/rini/git-stash/pico-conan-blink/build/Debug/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/rini/git-stash/pico-conan-blink" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "/home/rini/git-stash/pico-conan-blink" -- PICO_SDK_PATH not defined. -- Using path: /home/rini/git-stash/pico-conan-blink Using PICO_SDK_PATH from environment ('/home/rini/pico/sdk') PICO_SDK_PATH is /home/rini/pico/sdk Defaulting PICO_PLATFORM to rp2040 since not specified. -- Using Conan toolchain: /home/rini/git-stash/pico-conan-blink/build/Debug/generators/conan_toolchain.cmake -- Conan toolchain: C++ Standard 17 with extensions ON -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The C compiler identification is GNU 12.2.1 -- The CXX compiler identification is GNU 12.2.1 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/arm-none-eabi-gcc -- Detecting C compiler ABI info Using PICO_SDK_PATH from environment ('/home/rini/pico/sdk') PICO_SDK_PATH is /home/rini/pico/sdk 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 -- Detecting C compiler ABI info - failed -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info Using PICO_SDK_PATH from environment ('/home/rini/pico/sdk') PICO_SDK_PATH is /home/rini/pico/sdk 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 -- Detecting CXX compiler ABI info - failed -- Detecting CXX compile features -- Detecting CXX compile features - done Build type is Debug Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize) PICO target board is pico. Using board configuration from /home/rini/pico/sdk/src/boards/include/boards/pico.h -- Found Python3: /usr/bin/python3 (found version "3.11.2") found components: Interpreter TinyUSB available at /home/rini/pico/sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB. Compiling TinyUSB with CFG_TUSB_DEBUG=1 BTstack available at /home/rini/pico/sdk/lib/btstack cyw43-driver available at /home/rini/pico/sdk/lib/cyw43-driver Pico W Bluetooth build support available. lwIP available at /home/rini/pico/sdk/lib/lwip mbedtls available at /home/rini/pico/sdk/lib/mbedtls -- Configuring done -- Generating done -- Build files have been written to: /home/rini/git-stash/pico-conan-blink/build/Debug conanfile.py (pico-conan-blink/0.0.1): Running CMake.build() conanfile.py (pico-conan-blink/0.0.1): RUN: cmake --build "/home/rini/git-stash/pico-conan-blink/build/Debug" --parallel -- -j4 [ 1%] Checking the git repository for changes... [ 2%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.o [ 3%] Linking ASM executable bs2_default.elf [ 3%] Built target check_git [ 3%] Built target bs2_default [ 5%] Building C object _deps/cmake_git_version_tracking-build/CMakeFiles/cmake_git_version_tracking.dir/git.c.o [ 6%] Generating bs2_default.bin [ 7%] Generating bs2_default_padded_checksummed.S [ 9%] Linking C static library libcmake_git_version_tracking.a [ 9%] Built target bs2_default_padded_checksummed_asm [ 9%] Built target cmake_git_version_tracking [ 10%] Building CXX object CMakeFiles/pico-conan-blink.dir/src/main.cpp.o [ 11%] Building C object CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/pico_stdlib/stdlib.c.o [ 12%] Building C object CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/hardware_gpio/gpio.c.o [ 14%] Building C object CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/pico_platform/platform.c.o [ 15%] Building C object CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/hardware_claim/claim.c.o [ 16%] Building C object CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/hardware_sync/sync.c.o /tmp/cciwm6MN.s: Assembler messages: /tmp/cciwm6MN.s:49: Error: selected processor does not support requested special purpose register -- `mrs r0,PRIMASK' /tmp/cciwm6MN.s:50: Error: selected processor does not support `cpsid i' in ARM mode /tmp/cciwm6MN.s:86: Error: selected processor does not support `dmb' in ARM mode /tmp/cciwm6MN.s:143: Error: selected processor does not support `dmb' in ARM mode /tmp/cciwm6MN.s:168: Error: selected processor does not support requested special purpose register -- `msr PRIMASK,r0' gmake[2]: *** [CMakeFiles/pico-conan-blink.dir/build.make:132: CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/hardware_claim/claim.c.o] Error 1 gmake[2]: *** Waiting for unfinished jobs.... /tmp/ccoBBkCO.s: Assembler messages: /tmp/ccoBBkCO.s:79: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:119: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:158: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:197: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:236: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:275: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:314: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:353: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:443: Error: selected processor does not support `dmb' in ARM mode /tmp/ccoBBkCO.s:716: Error: selected processor does not support `dmb' in ARM mode gmake[2]: *** [CMakeFiles/pico-conan-blink.dir/build.make:146: CMakeFiles/pico-conan-blink.dir/home/rini/pico/sdk/src/rp2_common/hardware_sync/sync.c.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:1524: CMakeFiles/pico-conan-blink.dir/all] Error 2 gmake: *** [Makefile:91: all] Error 2 ERROR: conanfile.py (pico-conan-blink/0.0.1): Error in build() method, line 68 cmake.build(cli_args=common_cmake_args) ConanException: Error 2 while executing ```
HackXIt commented 2 months ago

I fixed the additional build errors by enforcing the target -mcpu and -march in the conan profile.

This did not occur to me beforehand, because these flags are normally set when using pico_sdk_import.cmake and pico_sdk_init().

I will continue this in the conan issue, since the package manager introduces this weird behaviour.

Thanks for all the insight, there were definitly one or two steps necessary to get the core issue, would have taken me way longer without your snippet to avoid pioasm and elf2uf2.