diff mbox series

[v3,1/8] clang: improve opt-viewer PACKAGECONFIG

Message ID 20250915191109.1117663-1-ross.burton@arm.com
State Accepted, archived
Commit ddbbd49c15bad1b2a550188581ffebd752b9b20e
Headers show
Series [v3,1/8] clang: improve opt-viewer PACKAGECONFIG | expand

Commit Message

Ross Burton Sept. 15, 2025, 7:11 p.m. UTC
Instead of patching the python module detection, we can use the hidden
option LLVM_TOOL_OPT_VIEWER_BUILD.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 ...-users-to-set-LLVM_HAVE_OPT_VIEWER_M.patch | 70 -------------------
 meta/recipes-devtools/clang/clang_git.bb      |  2 +-
 meta/recipes-devtools/clang/common.inc        |  1 -
 3 files changed, 1 insertion(+), 72 deletions(-)
 delete mode 100644 meta/recipes-devtools/clang/clang/0040-opt-viewer-Allow-users-to-set-LLVM_HAVE_OPT_VIEWER_M.patch

Comments

Mathieu Dubois-Briand Sept. 17, 2025, 11:06 a.m. UTC | #1
On Mon Sep 15, 2025 at 9:11 PM CEST, Ross Burton via lists.openembedded.org wrote:
> Instead of patching the python module detection, we can use the hidden
> option LLVM_TOOL_OPT_VIEWER_BUILD.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---

Hi Ross,

Sorry, but it looks like one of these patches is breaking tc tests:

ERROR: clang-native-21.1.1-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/temp/run.do_compile.1114131' failed with exit code 1
...
/clang-tblgen.dir/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLTagsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDataCollectorsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpcodesEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpenCLBuiltinEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOptionDocEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSACheckersEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSyntaxEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangTypeNodesEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o -o bin/clang-tblgen  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMSupport.a  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMTableGen.a  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMSupport.a  -lrt  -ldl  -lm  -lz  -lzstd  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMDemangle.a && :
| /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/hosttools/ld: /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMTableGen.a(TGLexer.cpp.o): in function `llvm::TGLexer::LexNumber() [clone .localalias]':
| TGLexer.cpp:(.text._ZN4llvm7TGLexer9LexNumberEv+0xea): undefined reference to `__isoc23_strtoll'
| /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/hosttools/ld: TGLexer.cpp:(.text._ZN4llvm7TGLexer9LexNumberEv+0xf1): undefined reference to `__isoc23_strtoull'

https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/2313
https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2308

On the good news, reproducibility issues seem to be gone.

Thanks,
Mathieu
Richard Purdie Sept. 17, 2025, 2:27 p.m. UTC | #2
On Wed, 2025-09-17 at 13:06 +0200, Mathieu Dubois-Briand via lists.openembedded.org wrote:
> On Mon Sep 15, 2025 at 9:11 PM CEST, Ross Burton via lists.openembedded.org wrote:
> > Instead of patching the python module detection, we can use the hidden
> > option LLVM_TOOL_OPT_VIEWER_BUILD.
> > 
> > Signed-off-by: Ross Burton <ross.burton@arm.com>
> > ---
> 
> Hi Ross,
> 
> Sorry, but it looks like one of these patches is breaking tc tests:
> 
> ERROR: clang-native-21.1.1-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/temp/run.do_compile.1114131' failed with exit code 1
> ...
> /clang-tblgen.dir/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLTagsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDataCollectorsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpcodesEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpenCLBuiltinEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOptionDocEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSACheckersEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSyntaxEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangTypeNodesEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o -o bin/clang-tblgen  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMSupport.a  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMTableGen.a  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMSupport.a  -lrt  -ldl  -lm  -lz  -lzstd  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMDemangle.a && :
> > /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/hosttools/ld: /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMTableGen.a(TGLexer.cpp.o): in function `llvm::TGLexer::LexNumber() [clone .localalias]':
> > TGLexer.cpp:(.text._ZN4llvm7TGLexer9LexNumberEv+0xea): undefined reference to `__isoc23_strtoll'
> > /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/hosttools/ld: TGLexer.cpp:(.text._ZN4llvm7TGLexer9LexNumberEv+0xf1): undefined reference to `__isoc23_strtoull'
> 
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/2313
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2308
> 
> On the good news, reproducibility issues seem to be gone.

This is a horrible one.

For a bit of background and the fun we had in pseudo with this:

https://git.yoctoproject.org/pseudo/commit/?id=865ca5b647bba47ca5c4d3e65597d9a25d4261bf

Cheers,

Richard
Khem Raj Sept. 17, 2025, 4:24 p.m. UTC | #3
On Wed, Sep 17, 2025 at 7:27 AM Richard Purdie via
lists.openembedded.org
<richard.purdie=linuxfoundation.org@lists.openembedded.org> wrote:
>
> On Wed, 2025-09-17 at 13:06 +0200, Mathieu Dubois-Briand via lists.openembedded.org wrote:
> > On Mon Sep 15, 2025 at 9:11 PM CEST, Ross Burton via lists.openembedded.org wrote:
> > > Instead of patching the python module detection, we can use the hidden
> > > option LLVM_TOOL_OPT_VIEWER_BUILD.
> > >
> > > Signed-off-by: Ross Burton <ross.burton@arm.com>
> > > ---
> >
> > Hi Ross,
> >
> > Sorry, but it looks like one of these patches is breaking tc tests:
> >
> > ERROR: clang-native-21.1.1-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/temp/run.do_compile.1114131' failed with exit code 1
> > ...
> > /clang-tblgen.dir/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLTagsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDataCollectorsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpcodesEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpenCLBuiltinEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOptionDocEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSACheckersEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSyntaxEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangTypeNodesEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o -o bin/clang-tblgen  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMSupport.a  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMTableGen.a  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMSupport.a  -lrt  -ldl  -lm  -lz  -lzstd  /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMDemangle.a && :
> > > /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/hosttools/ld: /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/work/x86_64-linux/clang-native/21.1.1/recipe-sysroot-native/usr/lib/libLLVMTableGen.a(TGLexer.cpp.o): in function `llvm::TGLexer::LexNumber() [clone .localalias]':
> > > TGLexer.cpp:(.text._ZN4llvm7TGLexer9LexNumberEv+0xea): undefined reference to `__isoc23_strtoll'
> > > /srv/pokybuild/yocto-worker/qemuarm64-tc/build/build-st-3689262/tmp/hosttools/ld: TGLexer.cpp:(.text._ZN4llvm7TGLexer9LexNumberEv+0xf1): undefined reference to `__isoc23_strtoull'
> >

I wonder if we have a uninative out of sync here, the build is on
debian12 and it has glibc < 2.38 so __iso23 symbols won't be there.

> > https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/2313
> > https://autobuilder.yoctoproject.org/valkyrie/#/builders/28/builds/2308
> >
> > On the good news, reproducibility issues seem to be gone.
>
> This is a horrible one.
>
> For a bit of background and the fun we had in pseudo with this:
>
> https://git.yoctoproject.org/pseudo/commit/?id=865ca5b647bba47ca5c4d3e65597d9a25d4261bf
>
> Cheers,
>
> Richard
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#223608): https://lists.openembedded.org/g/openembedded-core/message/223608
> Mute This Topic: https://lists.openembedded.org/mt/115260480/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/clang/0040-opt-viewer-Allow-users-to-set-LLVM_HAVE_OPT_VIEWER_M.patch b/meta/recipes-devtools/clang/clang/0040-opt-viewer-Allow-users-to-set-LLVM_HAVE_OPT_VIEWER_M.patch
deleted file mode 100644
index 4e93756af92..00000000000
--- a/meta/recipes-devtools/clang/clang/0040-opt-viewer-Allow-users-to-set-LLVM_HAVE_OPT_VIEWER_M.patch
+++ /dev/null
@@ -1,70 +0,0 @@ 
-From c2b576a49ed1b83def75578f7d2b2e8c3c54e60f Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 2 Aug 2025 17:58:20 -0700
-Subject: [PATCH] [opt-viewer] Allow users to set LLVM_HAVE_OPT_VIEWER_MODULES
- manually from the CMake
-
-Check right before setting LLVM_HAVE_OPT_VIEWER_MODULES
-so that if the user specifies the variable on the commandline
-it takes precedence. If not, fall back to the old logic
-
-Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/151845]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- llvm/CMakeLists.txt                     |  2 ++
- llvm/cmake/config-ix.cmake              | 13 ++++++++++---
- llvm/include/llvm/Config/config.h.cmake |  3 +++
- 3 files changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
-index cb945b578e46..e4ed9eca6014 100644
---- a/llvm/CMakeLists.txt
-+++ b/llvm/CMakeLists.txt
-@@ -7,6 +7,8 @@ set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
- include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
-   NO_POLICY_SCOPE)
- 
-+option(LLVM_HAVE_OPT_VIEWER_MODULES "Enable opt-viewer modules support" ON)
-+
- # Builds with custom install names and installation rpath setups may not work
- # in the build tree. Allow these cases to use CMake's default build tree
- # behavior by setting `LLVM_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE` to do this.
-diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
-index a8e4e5a63244..17af3dc1e93f 100644
---- a/llvm/cmake/config-ix.cmake
-+++ b/llvm/cmake/config-ix.cmake
-@@ -805,10 +805,17 @@ foreach(module ${PYTHON_MODULES})
-   find_python_module(${module})
- endforeach()
- 
--if(PY_PYGMENTS_FOUND AND PY_PYGMENTS_LEXERS_C_CPP_FOUND AND PY_YAML_FOUND)
--  set (LLVM_HAVE_OPT_VIEWER_MODULES 1)
-+if(NOT DEFINED LLVM_HAVE_OPT_VIEWER_MODULES)
-+  if(PY_PYGMENTS_FOUND AND PY_PYGMENTS_LEXERS_C_CPP_FOUND AND PY_YAML_FOUND)
-+    set (LLVM_HAVE_OPT_VIEWER_MODULES 1)
-+  else()
-+    set (LLVM_HAVE_OPT_VIEWER_MODULES 0)
-+  endif()
-+elseif(LLVM_HAVE_OPT_VIEWER_MODULES)
-+  # Use the user-provided value
-+  set(LLVM_HAVE_OPT_VIEWER_MODULES 1)
- else()
--  set (LLVM_HAVE_OPT_VIEWER_MODULES 0)
-+  set(LLVM_HAVE_OPT_VIEWER_MODULES 0)
- endif()
- 
- function(llvm_get_host_prefixes_and_suffixes)
-diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
-index ce83de8e4cba..02cf6d2ec363 100644
---- a/llvm/include/llvm/Config/config.h.cmake
-+++ b/llvm/include/llvm/Config/config.h.cmake
-@@ -287,6 +287,9 @@
- /* Define to a function implementing strdup */
- #cmakedefine strdup ${strdup}
- 
-+/* Define indicating opt-viewer modules */
-+#cmakedefine LLVM_HAVE_OPT_VIEWER_MODULES
-+
- /* Whether GlobalISel rule coverage is being collected */
- #cmakedefine01 LLVM_GISEL_COV_ENABLED
- 
diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb
index 0009a95628d..f53ecbfe398 100644
--- a/meta/recipes-devtools/clang/clang_git.bb
+++ b/meta/recipes-devtools/clang/clang_git.bb
@@ -59,7 +59,7 @@  PACKAGECONFIG[libedit] = "-DLLVM_ENABLE_LIBEDIT=ON,-DLLVM_ENABLE_LIBEDIT=OFF,lib
 PACKAGECONFIG[libomp] = "-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp,,"
 PACKAGECONFIG[lld] = "-DCLANG_DEFAULT_LINKER=lld,,,"
 PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
-PACKAGECONFIG[opt-viewer] = "-DLLVM_HAVE_OPT_VIEWER_MODULES=ON,-DLLVM_HAVE_OPT_VIEWER_MODULES=OFF, \
+PACKAGECONFIG[opt-viewer] = "-DLLVM_TOOL_OPT_VIEWER_BUILD=ON,-DLLVM_TOOL_OPT_VIEWER_BUILD=OFF, \
                              python3-pyyaml-native python3-pygments-native python3-pyyaml python3-pygments, \
                              python3-pyyaml python3-pygments,"
 PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm,"
diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc
index 625b0b064b7..e01eb2d2879 100644
--- a/meta/recipes-devtools/clang/common.inc
+++ b/meta/recipes-devtools/clang/common.inc
@@ -60,7 +60,6 @@  SRC_URI = "\
     file://0037-Revert-libc-Remap-headers-in-the-debug-info-when-bui.patch \
     file://0038-Prevent-revisiting-block-when-searching-for-noreturn.patch \
     file://0039-Only-build-c-index-test-when-clang-tests-are-include.patch \
-    file://0040-opt-viewer-Allow-users-to-set-LLVM_HAVE_OPT_VIEWER_M.patch \
 "
 # Fallback to no-PIE if not set
 GCCPIE ??= ""