casaroli commented on code in PR #19507:
URL: https://github.com/apache/nuttx/pull/19507#discussion_r3645067317


##########
arch/arm/src/cmake/Toolchain.cmake:
##########
@@ -25,6 +25,23 @@
 set(CMAKE_SYSTEM_NAME Generic)
 set(CMAKE_SYSTEM_VERSION 1)
 
+# Compiler detection must not try to link a full executable.
+#
+# CMake validates a compiler by building and linking a test program.  For a 
bare
+# metal cross toolchain that link cannot succeed on its own terms: it has no
+# start files, no default linker script and no libc, and the flags NuttX
+# supplies for it (CMAKE_EXE_LINKER_FLAGS_INIT below adds --specs=nosys.specs)
+# assume a toolchain shipped with newlib.  A perfectly usable arm-none-eabi-gcc
+# without those specs then fails configuration before a single NuttX source 
file
+# is considered:
+#
+# arm-none-eabi-gcc: fatal error: cannot read spec file 'nosys.specs'
+#
+# Building a static library instead exercises the compiler and stops short of
+# the link, which is the documented approach for this case.
+
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

Review Comment:
   moved to top level CMakeLists and guarded against `sim`moved to top level 
CMakeLists and guarded against `sim`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to