Skip to content

Commit

Permalink
clang: Set -DLLVM_APPEND_VC_REV=OFF
Browse files Browse the repository at this point in the history
Fixes Issue kraj#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 <[email protected]>
  • Loading branch information
kraj committed Aug 9, 2024
1 parent 4141d77 commit a5ebfbe
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions recipes-devtools/clang/clang_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions recipes-devtools/clang/compiler-rt-sanitizers_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "\
Expand Down
1 change: 1 addition & 0 deletions recipes-devtools/clang/compiler-rt_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions recipes-devtools/clang/libclc_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions recipes-devtools/clang/libcxx_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
"

Expand Down
1 change: 1 addition & 0 deletions recipes-devtools/clang/openmp_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit a5ebfbe

Please sign in to comment.