diff mbox series

cmake.bbclass: Unset LDFLAGS for native builds

Message ID 20250926050228.1782175-1-raj.khem@gmail.com
State New
Headers show
Series cmake.bbclass: Unset LDFLAGS for native builds | expand

Commit Message

Khem Raj Sept. 26, 2025, 5:02 a.m. UTC
It ends up appending LDFLAGS to CMAKE_C_LDFLAGS and CMAKE_CXX_LDFLAGS
which is not good when bulding native pieces in otherwise nativesdk or
target packages where LDFLAGS corresponds to them and not the native
portion of building the package.

Addresses the nativesdk-clang build regression when using

TOOLCHAIN = "clang"

because clang toolchain class add dynamic linker settings to LDFLAGS
which unearthed this issue

Suggested-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes-recipe/cmake.bbclass | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/cmake.bbclass b/meta/classes-recipe/cmake.bbclass
index b8cd622c2df..c9a03dc3fa1 100644
--- a/meta/classes-recipe/cmake.bbclass
+++ b/meta/classes-recipe/cmake.bbclass
@@ -181,6 +181,7 @@  list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${includedir})
 
 EOF
         cat > ${WORKDIR}/toolchain-native.cmake <<EOF
+unset( ENV{LDFLAGS} )
 set( CMAKE_C_COMPILER ${OECMAKE_NATIVE_C_COMPILER} )
 set( CMAKE_CXX_COMPILER ${OECMAKE_NATIVE_CXX_COMPILER} )
 set( CMAKE_ASM_COMPILER ${OECMAKE_NATIVE_C_COMPILER} )