From 90637d651de7ddc8271eb08683319b8a6a811f90 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 7 Aug 2024 20:29:36 -0700 Subject: [PATCH] clang: Set -DLLVM_APPEND_VC_REV=OFF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes Issue #991 If this is not disabled, the build tries to use CMake magic to compute repository and sha1 its building, however in case of OE it gets it completely wrong when building from tarball, because its building under TMPDIR which maybe a directory under main repo checkout e.g. poky tree so it traverses up and finds the sha of poky and assumes that its building from a git tree instead of tarball and emits the version control info into clang -v output e.g. ❯ ../image/mnt/b/yoe/master/build/tmp/work/x86_64-linux/clang-native/20.0.0/recipe-sysroot-native/usr/bin/clang -v clang version 20.0.0 (/home/kraj/work/llvm-project f133c59b33a749dc6d5fa8fb9a2366b95ea45068) This can contain buildpaths since work-shared is where llvm sources will be and they will appear here. Therefore, avoid cmake trying to do this and we get good clean version info > ../recipe-sysroot-native/usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-clang clang version 20.0.0 This will also avoid emitting buildpaths into debuginfo in some cases where compiler version is emitted into build.id info Signed-off-by: Khem Raj --- recipes-devtools/clang/clang_git.bb | 1 + recipes-devtools/clang/compiler-rt-sanitizers_git.bb | 1 + recipes-devtools/clang/compiler-rt_git.bb | 1 + recipes-devtools/clang/libclc_git.bb | 1 + recipes-devtools/clang/libcxx_git.bb | 1 + recipes-devtools/clang/openmp_git.bb | 1 + 6 files changed, 6 insertions(+) diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index 88ae329e..7b9096a0 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb @@ -133,6 +133,7 @@ SOLIBSDEV:mingw32 = ".pyd" #CMAKE_VERBOSE = "VERBOSE=1" EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ + -DLLVM_APPEND_VC_REV=OFF \ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \ -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \ -DLLVM_ENABLE_PIC=ON \ diff --git a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb index be018222..f866aa52 100644 --- a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb +++ b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb @@ -50,6 +50,7 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCOMPILER_RT_BUILD_MEMPROF=ON \ -DLLVM_ENABLE_PROJECTS='compiler-rt' \ -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \ + -DLLVM_APPEND_VC_REV=OFF \ " EXTRA_OECMAKE:append:class-nativesdk = "\ diff --git a/recipes-devtools/clang/compiler-rt_git.bb b/recipes-devtools/clang/compiler-rt_git.bb index 6ed9bc87..84878aa1 100644 --- a/recipes-devtools/clang/compiler-rt_git.bb +++ b/recipes-devtools/clang/compiler-rt_git.bb @@ -70,6 +70,7 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ -DLLVM_ENABLE_PROJECTS='compiler-rt' \ -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \ + -DLLVM_APPEND_VC_REV=OFF \ " EXTRA_OECMAKE:append:class-target = "\ -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \ diff --git a/recipes-devtools/clang/libclc_git.bb b/recipes-devtools/clang/libclc_git.bb index 1f30c540..16ab8332 100644 --- a/recipes-devtools/clang/libclc_git.bb +++ b/recipes-devtools/clang/libclc_git.bb @@ -16,6 +16,7 @@ DEPENDS += "clang spirv-tools spirv-llvm-translator spirv-llvm-translator-native OECMAKE_SOURCEPATH = "${S}/libclc" EXTRA_OECMAKE += "\ + -DLLVM_APPEND_VC_REV=OFF \ -DLIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR=${STAGING_BINDIR_NATIVE} \ -DLLVM_CLANG=${STAGING_BINDIR_NATIVE}/clang \ -DLLVM_AS=${STAGING_BINDIR_NATIVE}/llvm-as \ diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb index 280f3d66..8b57dfc1 100644 --- a/recipes-devtools/clang/libcxx_git.bb +++ b/recipes-devtools/clang/libcxx_git.bb @@ -72,6 +72,7 @@ EXTRA_OECMAKE += "\ -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \ -DLLVM_RUNTIME_TARGETS=${HOST_SYS} \ -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \ + -DLLVM_APPEND_VC_REV=OFF \ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ " diff --git a/recipes-devtools/clang/openmp_git.bb b/recipes-devtools/clang/openmp_git.bb index 865dbe66..34f6e4ab 100644 --- a/recipes-devtools/clang/openmp_git.bb +++ b/recipes-devtools/clang/openmp_git.bb @@ -17,6 +17,7 @@ inherit cmake pkgconfig perlnative python3native python3targetconfig DEPENDS += "elfutils libffi clang" EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DLLVM_APPEND_VC_REV=OFF \ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \ -DOPENMP_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \ -DOPENMP_STANDALONE_BUILD=ON \