"undefined reference to `_exit'" on compiler check

I installed the newest Pico SDK 1.4.0 on Ubuntu 22.04 (x86) with GCC 10.3.1 and CMake 3.21.4. I followed instructions in “Getting started with Raspberry Pi Pico”. When building a “blink” example, I’m getting “undefined reference to `_exit’” error:

[main] Building folder: blink 
[main] Configuring folder: blink 
[main] Changes were detected in CMakeLists.txt but we could not reconfigure the project because another operation is already in progress.
[proc] Executing command: /usr/local/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/arm-none-eabi-gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/arm-none-eabi-g++ -S/home/paul/pico/pico-examples/blink -B/home/paul/pico/pico-examples/blink/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The CXX compiler identification is GNU 10.3.1
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - failed
[cmake] -- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++
[cmake] -- Check for working CXX compiler: /usr/bin/arm-none-eabi-g++ - broken
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/paul/pico/pico-examples/blink/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "/home/paul/pico/pico-examples/blink/build/CMakeFiles/CMakeError.log".
[cmake] CMake Error at /usr/local/share/cmake-3.21/Modules/CMakeTestCXXCompiler.cmake:62 (message):
[cmake]   The C++ compiler
[cmake] 
[cmake]     "/usr/bin/arm-none-eabi-g++"
[cmake] 
[cmake]   is not able to compile a simple test program.
[cmake] 
[cmake]   It fails with the following output:
[cmake] 
[cmake]     Change Dir: /home/paul/pico/pico-examples/blink/build/CMakeFiles/CMakeTmp
[cmake]     
[cmake]     Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_c07fd/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_c07fd.dir/build.make CMakeFiles/cmTC_c07fd.dir/build
[cmake]     gmake[1]: Entering directory '/home/paul/pico/pico-examples/blink/build/CMakeFiles/CMakeTmp'
[cmake]     Building CXX object CMakeFiles/cmTC_c07fd.dir/testCXXCompiler.cxx.o
[cmake]     /usr/bin/arm-none-eabi-g++    -o CMakeFiles/cmTC_c07fd.dir/testCXXCompiler.cxx.o -c /home/paul/pico/pico-examples/blink/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
[cmake]     Linking CXX executable cmTC_c07fd
[cmake]     /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c07fd.dir/link.txt --verbose=1
[cmake]     /usr/bin/arm-none-eabi-g++ CMakeFiles/cmTC_c07fd.dir/testCXXCompiler.cxx.o -o cmTC_c07fd 
[cmake]     /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
[cmake]     /build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
[cmake]     collect2: error: ld returned 1 exit status
[cmake]     gmake[1]: *** [CMakeFiles/cmTC_c07fd.dir/build.make:99: cmTC_c07fd] Error 1
[cmake]     gmake[1]: Leaving directory '/home/paul/pico/pico-examples/blink/build/CMakeFiles/CMakeTmp'
[cmake]     gmake: *** [Makefile:127: cmTC_c07fd/fast] Error 2
[cmake]     

Following advice from SO, I tried several options to disable compiler test, e.g.:

set(CMAKE_C_COMPILER_FORCED TRUE)
CMAKE_FORCE_C_COMPILER(arm-none-eabi-gcc GNU)

but they didn’t help and seem to be deprecated in modern CMake. Other forum posts suggest that disabling compiler check is counterproductive. Any clues how to solve it would be appreciated.

Never mind. Pico SDK requires a big include. For future reference, here is a minimum CMakeLists.txt for a basic blink project:

cmake_minimum_required(VERSION 3.18)
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(blink LANGUAGES C CXX ASM)

add_executable(blink blink.c)
set_target_properties(blink PROPERTIES
  CMAKE_C_STANDARD 11
  CMAKE_CXX_STANDARD 17
)

pico_sdk_init()
pico_add_extra_outputs(blink)
target_link_libraries(blink pico_stdlib)