Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7323

General • CMake Errors: Toolchain Not Found, Ninja Missing, and Compilers Not Set for Pico SDK

$
0
0
Hi everyone,

I’m trying to configure a project using the Raspberry Pi Pico SDK with CMake, but I’m running into several errors and warnings:
CMake Warning: Ignoring extra path from command line: ".cmake"

CMake Error at C:/Users/mmadha/.pico-sdk/cmake/v3.31.5/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:152 (message):
Could not find toolchain file: Toolchain\arm-cross-toolchain
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

It seems like CMake can’t find the toolchain, Ninja build system, or compilers. I’ve checked my environment variables and paths, but I’m not sure what I’m missing.

Has anyone encountered this before when setting up a Pico SDK project on Windows? Any guidance on setting up the toolchain and build system correctly would be much appreciated!

I have put my toolchain cmake file here as well
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)

# C compiler
set(CMAKE_C_COMPILER "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe")
set(CMAKE_C_FLAGS "-static")

# C++ compiler
set(CMAKE_CXX_COMPILER "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-g++.exe")
set(CMAKE_CXX_FLAGS "-static")

# Search behavior for libraries/includes
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

along with my top level cmakelist
cmake_minimum_required(VERSION 3.20)

project(Usb_Keyboard VERSION 1.0 LANGUAGES C CXX)

set(EXECUTABLE_NAME EXECUTABLE)
SET(LIBRARY_NAME Library)

#project(tinyusb_keyboard LANGUAGES C CXX)

add_subdirectory(common)
add_subdirectory(device)
add_subdirectory(hardware_gpio)
add_subdirectory(hid_composite/src)

# Add tinyusb to a existing target, DCD and HCD drivers are not included
function(tinyusb_target_add TARGET)
target_sources(${TARGET} PRIVATE
# common
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tusb.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/common/tusb_fifo.c
# device
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/device/usbd_control.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/audio/audio_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/cdc/cdc_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/dfu/dfu_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/dfu/dfu_rt_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/hid/hid_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/midi/midi_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/net/ecm_rndis_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/net/ncm_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/usbtmc/usbtmc_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_device.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/video/video_device.c
# host
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/host/usbh.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/host/hub.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/cdc/cdc_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/hid/hid_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/midi/midi_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/msc/msc_host.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/class/vendor/vendor_host.c
# typec
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/typec/usbc.c
)
target_include_directories(${TARGET} PUBLIC
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
# TODO for net driver, should be removed/changed
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../lib/networking
)
endfunction()
and the cmakelist for hid_composite for tinyusb
cmake_minimum_required(VERSION 3.20)

#include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)

#project(MyApp VERSION 1.0 LANGUAGES C CXX)

# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
add_executable(hid_composite
src/main.cpp
src/usb_descriptors.c
)


# Cross-compilation for ARM
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)

# Set ARM GCC compilers (with .exe for Windows)

# Tell CMake we are building static libraries in try-compile tests (avoids running ARM binaries on Windows)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)



project(${PROJECT} C CXX)



# Checks this example is valid for the family and initializes the project
#family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
# Espressif has its own cmake build system
if(FAMILY STREQUAL "espressif")
return()
endif()

#add_executable(${PROJECT})

# Example source
target_sources(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
)

# Example include
target_include_directories(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)

# Configure compilation flags and libraries for the example without RTOS.
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
This is my first time doing something like this, and I would like an idea of what I am doing.

Kind regards

Statistics: Posted by Maaz1 — Mon Sep 08, 2025 3:59 pm — Replies 1 — Views 268



Viewing all articles
Browse latest Browse all 7323

Trending Articles