Browse Source

compile-rt: Fix building compiler-native on aarch64 build hosts.

Using target triple confuses the native system compiler to find
libgcc and C runtime during compiler-rt-native build

Fixes
|     /home/khem/yoe/build/tmp/hosttools/ld: cannot find crtbeginS.o: No such file or directory
|     /home/khem/yoe/build/tmp/hosttools/ld: cannot find -lgcc: No such file or directory
|     /home/khem/yoe/build/tmp/hosttools/ld: cannot find -lgcc_s: No such file or directory
|     clang: error: linker command failed with exit code 1 (use -v to see invocation)
|     ninja: build stopped: subcommand failed.

(From OE-Core rev: 1d4676d6b7c0fe40ab4f808dda436dc2f2915fd8)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Khem Raj 3 weeks ago
parent
commit
92ce706e23
1 changed files with 4 additions and 2 deletions
  1. 4 2
      meta/recipes-devtools/clang/compiler-rt_git.bb

+ 4 - 2
meta/recipes-devtools/clang/compiler-rt_git.bb

@@ -71,7 +71,6 @@ OECMAKE_TARGET_COMPILE = "compiler-rt"
 OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
 OECMAKE_SOURCEPATH = "${S}/llvm"
 EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-                  -DCMAKE_C_COMPILER_TARGET=${HOST_SYS} \
                   -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
                   -DCOMPILER_RT_STANDALONE_BUILD=ON \
                   -DCOMPILER_RT_INCLUDE_TESTS=OFF \
@@ -83,7 +82,6 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
                   -DLLVM_ENABLE_RUNTIMES='compiler-rt' \
                   -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
                   -DLLVM_APPEND_VC_REV=OFF \
-                  -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
                   -S ${S}/runtimes \
 "
 
@@ -91,6 +89,8 @@ EXTRA_OECMAKE:append:class-target = "\
                -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
                -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
                -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
+               -DCMAKE_C_COMPILER_TARGET=${HOST_SYS} \
+               -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
                -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
 "
 
@@ -100,6 +100,8 @@ EXTRA_OECMAKE:append:class-nativesdk = "\
                -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
                -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
                -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
+               -DCMAKE_C_COMPILER_TARGET=${HOST_SYS} \
+               -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
 "
 
 do_install:append () {