You are not logged in.

#1 2025-04-17 12:06:52

Samueru
Member
Registered: 2023-07-03
Posts: 36

I'm trying to build mesa with llvm linked statically with no luck

It seems this was easy a few years ago when the `llvm-libs` package still shipped static libs by looking at this: https://forum.artixlinux.org/index.php/ … 145.0.html


I modified the llvm-libs PKGBUILD to also add the `.a` libraries and now I have a bunch of them. But when I try to build mesa with `-D shared-llvm=disabled` I just get this error:

Checking for function "pthread_setaffinity_np" with dependency threads: YES 
Run-time dependency expat found: YES 2.7.1
Library m found: YES
Message: libdrm 2.4.121 needed because amdgpu has the highest requirement
Run-time dependency libdrm_intel found: YES 2.4.124
Run-time dependency libdrm_amdgpu found: YES 2.4.124
Run-time dependency libdrm found: YES 2.4.124
Run-time dependency libudev found: YES 257
llvm-config found: YES (/usr/bin/llvm-config) 19.1.7
Run-time dependency LLVM (modules: amdgpu, bitreader, bitwriter, core, coverage, engine, executionengine, instcombine, instrumentation, ipo, irreader, libdriver, linker, lto, mcdisassembler, mcjit, native, objcarcopts, option, profiledata, scalaropts, target, transformutils, all-targets, coroutines, frontenddriver, frontendhlsl, frontendopenmp, lto, windowsdriver) found: NO (tried config-tool)
Looking for a fallback subproject for the dependency llvm (modules: bitwriter, engine, mcdisassembler, mcjit, core, executionengine, scalaropts, transformutils, instcombine, amdgpu, bitreader, ipo, linker, coverage, instrumentation, ipo, irreader, lto, option, objcarcopts, profiledata, coverage, target, linker, irreader, option, libdriver, lto, native)
Building fallback subproject with default_library=static
ERROR: Subproject llvm is buildable: NO

mesa-25.0.3/meson.build:1785:13: ERROR: Neither a subproject directory nor a llvm.wrap file was found.

Offline

#2 2025-04-17 17:19:56

mackin_cheese
Member
Registered: 2025-01-07
Posts: 475

Re: I'm trying to build mesa with llvm linked statically with no luck

Okay please:

1. Post the PKGBUILD you were using
2. Post the exact command you were using that produced that output
3. Post the full output

Offline

#3 2025-04-17 20:53:05

Samueru
Member
Registered: 2023-07-03
Posts: 36

Re: I'm trying to build mesa with llvm linked statically with no luck

mackin_cheese wrote:

Okay please:

1. Post the PKGBUILD you were using

2. Post the exact command you were using that produced that output

3. Post the full output

1. It is the existing llvm-libs PKGBUILD modified to include the static libs: https://pastebin.com/WygAf2jz

When installing I noticed that this modified llvm-libs contains a few static libs that conflict with the existing llvm package, those were overwritten in that case, I don't think this is a problem given that both files get produced by the same PKGBUILD and llvm is split into two separate packages but let me know.

2. I took the existing mesa PKGBUILD and added the [-D shared-llvm=disabled] to meson_options: https://gitlab.archlinux.org/archlinux/ … heads#L182

3. https://pastebin.com/xjrqmq8b

https://pastebin.com/af9qS96h

Edit: I just noticed that I got a different error this time after repeating the steps lol

Last edited by Samueru (2025-04-17 20:58:25)

Offline

#4 2025-04-18 10:05:16

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,870

Re: I'm trying to build mesa with llvm linked statically with no luck

mesa needs a lot more then just llvm-libs .

You will very likely need to provide static builds of llvm , clang and libclc . Also a build of spirv-llvm-translator against your static llvm .

Look again at the llvm repo PKGBUILD .

# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
# installing static libraries; inspired by Gentoo
_get_distribution_components() {

The _get_distribution_components() function was specifically added to get rid of static libraries, you'll have to remove any usage of that function.


Moderator Note :
moved to Creating & Modifying Packages


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2025-06-17 03:52:23

Samueru
Member
Registered: 2023-07-03
Posts: 36

Re: I'm trying to build mesa with llvm linked statically with no luck

Lone_Wolf wrote:

mesa needs a lot more then just llvm-libs .

You will very likely need to provide static builds of llvm , clang and libclc . Also a build of spirv-llvm-translator against your static llvm .

Look again at the llvm repo PKGBUILD .

# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
# installing static libraries; inspired by Gentoo
_get_distribution_components() {

The _get_distribution_components() function was specifically added to get rid of static libraries, you'll have to remove any usage of that function.


Moderator Note :
moved to Creating & Modifying Packages

Okay I have managed to edit the PKGBUILDs of llvm and clang to have the static libs, there is progress since now mesa can start building.

However compilation fails about a 3rd of the way in with this error:


[723/3552] Linking target src/compiler/clc/mesa_clc
FAILED: src/compiler/clc/mesa_clc
c++  -o src/compiler/clc/mesa_clc src/compiler/clc/mesa_clc.p/mesa_clc.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/samuel/madness/mesa/src=/usr/src/debug/mesa -g1 -Wl,--start-group src/compiler/clc/liblibmesaclc.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/util/libmesa_util.a src/util/libmesa_util_sse41.a src/util/blake3/libblake3.a src/c11/impl/libmesa_util_c11.a src/compiler/spirv/libvtn.a -Wl,--build-id=sha1 -lrt -ldl -lm -lLLVMWindowsDriver -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSPIRVCodeGen -lLLVMSPIRVDesc -lLLVMSPIRVInfo -lLLVMSPIRVAnalysis -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMLTO -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMCoverage -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMPasses -lLLVMCoroutines -lLLVMCFGuard -lLLVMMIRParser -lLLVMIRPrinter -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMSandboxIR -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMFrontendAtomic -lLLVMFrontendOffloading -lLLVMHipStdPar -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMObjCARCOpts -lLLVMTransformUtils -lLLVMCGData -lLLVMBitWriter -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMCodeGenTypes -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAMDGPUInfo -lLLVMMC -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lzstd.so.1.5.7 -lxml2 -pthread /usr/lib/libSPIRV-Tools-opt.so /usr/lib/libSPIRV-Tools.so /usr/lib/libSPIRV-Tools-link.so /usr/lib/libz.so /usr/lib/libzstd.so /usr/lib/libdrm.so /usr/lib/libclangBasic.a /usr/lib/libclangAST.a /usr/lib/libclangCodeGen.a /usr/lib/libclangLex.a /usr/lib/libclangDriver.a /usr/lib/libclangFrontend.a /usr/lib/libclangFrontendTool.a /usr/lib/libclangHandleCXX.a /usr/lib/libclangHandleLLVM.a /usr/lib/libclangSerialization.a /usr/lib/libclangSema.a /usr/lib/libclangParse.a /usr/lib/libclangEdit.a /usr/lib/libclangAnalysis.a /usr/lib/libclangSupport.a /usr/lib/libclangASTMatchers.a /usr/lib/libclangAPINotes.a -lLLVMWindowsDriver -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSPIRVCodeGen -lLLVMSPIRVDesc -lLLVMSPIRVInfo -lLLVMSPIRVAnalysis -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMLTO -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMCoverage -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMPasses -lLLVMCoroutines -lLLVMCFGuard -lLLVMMIRParser -lLLVMIRPrinter -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMSandboxIR -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMFrontendAtomic -lLLVMFrontendOffloading -lLLVMHipStdPar -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMObjCARCOpts -lLLVMTransformUtils -lLLVMCGData -lLLVMBitWriter -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMCodeGenTypes -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAMDGPUInfo -lLLVMMC -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lzstd.so.1.5.7 -lxml2 /usr/lib/libLLVMSPIRVLib.so -Wl,--end-group
/usr/bin/ld: cannot find -lzstd.so.1.5.7: No such file or directory
/usr/bin/ld: cannot find -lzstd.so.1.5.7: No such file or directory
collect2: error: ld returned 1 exit status
[736/3552] Compiling C++ object src/compiler/glsl/libglsl.a.p/builtin_functions.cpp.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

This only happens when I add the option `-D shared-llvm=disabled` to the mesa PKGBUILD.

I went and compiled zstd to include static libs, however after editing the PKGBUILD to include the static libs for some reason the only static lib that gets made is not included ? Here is the modified zstd PKGBUILD that should include the static libs:

pkgname=zstd
pkgver=1.5.7
pkgrel=2
pkgdesc='Zstandard - Fast real-time compression algorithm'
url='https://facebook.github.io/zstd/'
arch=(x86_64)
license=(
  BSD-3-Clause
  GPL-2.0-only
)
depends=(
  glibc
  gcc-libs
  zlib
  xz
  lz4
)
makedepends=(
  cmake
  gtest
  ninja
)
provides=(libzstd.so)
source=(https://github.com/facebook/zstd/releases/download/v${pkgver}/zstd-${pkgver}.tar.zst{,.sig}
  [url]https://github.com/facebook/zstd/commit/6af3842118ea5325480b403213b2a9fbed3d3d74.patch)[/url]
sha256sums=('5b331d961d6989dc21bb03397fc7a2a4d86bc65a14adc5ffbbce050354e30fd2'
            'SKIP'
            '7c07be222d45718b81fb16f97e611adfeb24efa0712ca77fb1e08f4c67803ec3')
b2sums=('20df0493d9d960b8fc98f7cac7630f84dae6226bd906364ab9c9ce7dfb2be44a303fd077e4264979f3ee92efd59072d63c4bb4ae7b65c52f6ce0153513088837'
        'SKIP'
        '02e472b01ead30ebc703f64d35ccbfe1db8a9eae6b15a3690e6e5092c6b8cdfaaca585b31b965d94eea7da04cebd6bcca7f5c8bbf9e2c2e84b4acd7f3ce54e5d')
validpgpkeys=(4EF4AC63455FC9F4545D9B7DEF8FE99528B52FFD)

prepare() {
  cd ${pkgname}-${pkgver}
  # fix manpages
  patch -Np1 -i ../6af3842118ea5325480b403213b2a9fbed3d3d74.patch
}

build() {
  cd ${pkgname}-${pkgver}
  export CFLAGS+=' -ffat-lto-objects'
  export CXXFLAGS+=' -ffat-lto-objects'

  cmake -S build/cmake -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DZSTD_ZLIB_SUPPORT=ON \
    -DZSTD_LZMA_SUPPORT=ON \
    -DZSTD_LZ4_SUPPORT=ON \
    -DZSTD_BUILD_CONTRIB=ON \
    -DZSTD_BUILD_STATIC=ON \
    -DZSTD_BUILD_TESTS=ON \
    -DZSTD_PROGRAMS_LINK_SHARED=ON
  cmake --build build
}

package() {
  cd ${pkgname}-${pkgver}
  DESTDIR="${pkgdir}" cmake --install build
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

But anyways, I went and manually dropped the `libzstd.a` in `/usr/lib` and tried to build mesa again and I got the same error of not being able to find it. ?

Offline

#6 2025-06-17 15:11:33

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,870

Re: I'm trying to build mesa with llvm linked statically with no luck

The simplest solution is probably to add -D zstd=disabled in the mesa PKGBUILD so mesa will use zlib for compression instead of zstd .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#7 2025-06-17 16:02:59

Samueru
Member
Registered: 2023-07-03
Posts: 36

Re: I'm trying to build mesa with llvm linked statically with no luck

Lone_Wolf wrote:

The simplest solution is probably to add -D zstd=disabled in the mesa PKGBUILD so mesa will use zlib for compression instead of zstd .

Did not work, weird.

mesa 25.1.3-arch1.3

  Directories
    prefix              : /usr
    libdir              : lib
    includedir          : include

  Common C and C++ arguments
    c_cpp_args          : -mtls-dialect=gnu2

  OpenGL
    OpenGL              : YES
    ES1                 : NO
    ES2                 : YES
    GLVND               : YES

  DRI
    Platform            : drm
    Driver dir          : /usr/lib/dri

  GLX
    Enabled             : YES
    Provider            : dri

  EGL
    Enabled             : YES
    Drivers             : builtin:egl_dri2 builtin:egl_dri3
    Platforms           : x11 wayland surfaceless drm xcb

  GBM
    Enabled             : YES
    External libgbm     : NO
    Backends path       : /usr/lib/gbm

  Vulkan
    Drivers             : amd gfxstream intel intel_hasvk nouveau swrast virtio microsoft-experimental
    Platforms           : x11 wayland surfaceless drm xcb
    ICD dir             : share/vulkan/icd.d
    Layers              : device-select intel-nullhw overlay screenshot vram-report-limit
    Intel Ray tracing   : YES

  Video
    Codecs              : vc1dec h264dec h264enc h265dec h265enc av1dec av1enc vp9dec
    APIs                : vdpau va vulkan

  LLVM
    Enabled             : YES
    Version             : 20.1.6

  Gallium
    Enabled             : YES
    Drivers             : r300 r600 radeonsi nouveau virgl svga llvmpipe softpipe iris crocus i915 zink d3d12
    Platforms           : x11 wayland surfaceless drm xcb
    Frontends           : mesa vdpau va
    HUD lm-sensors      : YES

  Perfetto
    Enabled             : NO

  Teflon (TensorFlow Lite delegate)
    Enabled             : NO

  Subprojects
    paste               : YES 3 warnings
    proc-macro2         : YES 2 warnings (from syn => quote)
    quote               : YES 2 warnings (from syn)
    syn                 : YES 2 warnings
    unicode-ident       : YES 2 warnings (from syn)

  User defined options
    android-libbacktrace: disabled
    auto_features       : enabled
    b_ndebug            : true
    b_pie               : true
    buildtype           : plain
    gallium-drivers     : r300,r600,radeonsi,nouveau,virgl,svga,llvmpipe,softpipe,iris,crocus,i915,zink,d3d12
    gallium-extra-hud   : true
    gallium-rusticl     : false
    gallium-xa          : disabled
    gles1               : disabled
    html-docs           : enabled
    libexecdir          : lib
    libunwind           : disabled
    microsoft-clc       : disabled
    prefix              : /usr
    python.bytecompile  : 1
    sbindir             : bin
    shared-llvm         : disabled
    valgrind            : enabled
    video-codecs        : all
    vulkan-drivers      : amd,gfxstream,intel,intel_hasvk,nouveau,swrast,virtio,microsoft-experimental
    vulkan-layers       : device-select,intel-nullhw,overlay,screenshot,vram-report-limit
    wrap_mode           : nodownload
    zstd                : disabled

Found ninja-1.12.1 at /usr/bin/ninja
Cleaning... 0 files.
[4/2817] Linking target src/compiler/clc/mesa_clc
FAILED: src/compiler/clc/mesa_clc
c++  -o src/compiler/clc/mesa_clc src/compiler/clc/mesa_clc.p/mesa_clc.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/samuel/madness/mesa/src=/usr/src/debug/mesa -g1 -Wl,--start-group src/compiler/clc/liblibmesaclc.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/util/libmesa_util.a src/util/libmesa_util_sse41.a src/util/blake3/libblake3.a src/c11/impl/libmesa_util_c11.a src/compiler/spirv/libvtn.a -Wl,--build-id=sha1 -lrt -ldl -lm -lLLVMWindowsDriver -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSPIRVCodeGen -lLLVMSPIRVDesc -lLLVMSPIRVInfo -lLLVMSPIRVAnalysis -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMLTO -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMCoverage -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMPasses -lLLVMCoroutines -lLLVMCFGuard -lLLVMMIRParser -lLLVMIRPrinter -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMSandboxIR -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMFrontendAtomic -lLLVMFrontendOffloading -lLLVMHipStdPar -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMObjCARCOpts -lLLVMTransformUtils -lLLVMCGData -lLLVMBitWriter -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMCodeGenTypes -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAMDGPUInfo -lLLVMMC -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lzstd.so.1.5.7 -lxml2 -pthread /usr/lib/libSPIRV-Tools-opt.so /usr/lib/libSPIRV-Tools.so /usr/lib/libSPIRV-Tools-link.so /usr/lib/libz.so /usr/lib/libdrm.so /usr/lib/libclangBasic.a /usr/lib/libclangAST.a /usr/lib/libclangCodeGen.a /usr/lib/libclangLex.a /usr/lib/libclangDriver.a /usr/lib/libclangFrontend.a /usr/lib/libclangFrontendTool.a /usr/lib/libclangHandleCXX.a /usr/lib/libclangHandleLLVM.a /usr/lib/libclangSerialization.a /usr/lib/libclangSema.a /usr/lib/libclangParse.a /usr/lib/libclangEdit.a /usr/lib/libclangAnalysis.a /usr/lib/libclangSupport.a /usr/lib/libclangASTMatchers.a /usr/lib/libclangAPINotes.a -lLLVMWindowsDriver -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSPIRVCodeGen -lLLVMSPIRVDesc -lLLVMSPIRVInfo -lLLVMSPIRVAnalysis -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMLTO -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMCoverage -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMPasses -lLLVMCoroutines -lLLVMCFGuard -lLLVMMIRParser -lLLVMIRPrinter -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMSandboxIR -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMFrontendAtomic -lLLVMFrontendOffloading -lLLVMHipStdPar -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMObjCARCOpts -lLLVMTransformUtils -lLLVMCGData -lLLVMBitWriter -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMCodeGenTypes -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAMDGPUInfo -lLLVMMC -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lzstd.so.1.5.7 -lxml2 /usr/lib/libLLVMSPIRVLib.so -Wl,--end-group
/usr/bin/ld: cannot find -lzstd.so.1.5.7: No such file or directory
/usr/bin/ld: cannot find -lzstd.so.1.5.7: No such file or directory
collect2: error: ld returned 1 exit status
[17/2817] Compiling C++ object src/intel/compiler/libintel_compiler.a.p/brw_from_nir.cpp.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

Offline

#8 2025-06-17 16:15:56

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,870

Re: I'm trying to build mesa with llvm linked statically with no luck

So it's not mesa itself that requires zstd .

llvm has a make dependency on zstd, try adding LLVM_ENABLE_ZSTD="OFF" to its cmake configuration .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#9 2025-06-17 17:57:29

Samueru
Member
Registered: 2023-07-03
Posts: 36

Re: I'm trying to build mesa with llvm linked statically with no luck

Lone_Wolf wrote:

So it's not mesa itself that requires zstd .

llvm has a make dependency on zstd, try adding LLVM_ENABLE_ZSTD="OFF" to its cmake configuration .

You mean building llvm again with that option? I just did it and now I get this when building mesa:

Found ninja-1.12.1 at /usr/bin/ninja
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /home/samuel/madness/mesa/src/build
ninja: Entering directory `/home/samuel/madness/mesa/src/build'
[297/3552] Compiling C object src/compiler/nir/libnir.a.p/nir_opt_shrink_vectors.c.o
../mesa-25.1.3/src/compiler/nir/nir_opt_shrink_vectors.c: In function ‘shrink_dest_to_read_mask’:
../mesa-25.1.3/src/compiler/nir/nir_opt_shrink_vectors.c:139:36: warning: writing 16 bytes into a region of size 15 [-Wstringop-overflow=]
  139 |             swizzle[first_bit + i] = i;
      |             ~~~~~~~~~~~~~~~~~~~~~~~^~~
../mesa-25.1.3/src/compiler/nir/nir_opt_shrink_vectors.c:137:18: note: at offset [1, 15] into destination object ‘swizzle’ of size 16
  137 |          uint8_t swizzle[NIR_MAX_VEC_COMPONENTS] = { 0 };
      |                  ^~~~~~~
[341/3552] Compiling C object src/compiler/clc/mesa_clc.p/mesa_clc.c.o
../mesa-25.1.3/src/compiler/clc/mesa_clc.c: In function ‘main’:
../mesa-25.1.3/src/compiler/clc/mesa_clc.c:127:7: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  127 |       fread(map, 1, len, fp);
      |       ^~~~~~~~~~~~~~~~~~~~~~
[349/3552] Compiling C object src/compiler/spirv/vtn_bindgen2.p/vtn_bindgen2.c.o
../mesa-25.1.3/src/compiler/spirv/vtn_bindgen2.c: In function ‘main’:
../mesa-25.1.3/src/compiler/spirv/vtn_bindgen2.c:313:4: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  313 |    fread(map, 1, len, fin);
      |    ^~~~~~~~~~~~~~~~~~~~~~~
[682/3552] Compiling C++ object src/gallium/auxiliary/libgallium.a.p/gallivm_lp_bld_debug.cpp.o
../mesa-25.1.3/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp: In function ‘void lp_function_add_debug_info(gallivm_state*, LLVMValueRef, LLVMTypeRef)’:
../mesa-25.1.3/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp:388:15: warning: ignoring return value of ‘int asprintf(char**, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  388 |       asprintf(&gallivm->file_name, "%s/%u.nir", LP_NIR_SHADER_DUMP_DIR, shader_index);
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[827/3552] Linking target src/compiler/clc/mesa_clc
FAILED: src/compiler/clc/mesa_clc
c++  -o src/compiler/clc/mesa_clc src/compiler/clc/mesa_clc.p/mesa_clc.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/samuel/madness/mesa/src=/usr/src/debug/mesa -g1 -Wl,--start-group src/compiler/clc/liblibmesaclc.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/util/libmesa_util.a src/util/libmesa_util_sse41.a src/util/blake3/libblake3.a src/c11/impl/libmesa_util_c11.a src/compiler/spirv/libvtn.a -Wl,--build-id=sha1 -lrt -ldl -lm -lLLVMWindowsDriver -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSPIRVCodeGen -lLLVMSPIRVDesc -lLLVMSPIRVInfo -lLLVMSPIRVAnalysis -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMLTO -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMCoverage -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMPasses -lLLVMCoroutines -lLLVMCFGuard -lLLVMMIRParser -lLLVMIRPrinter -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMSandboxIR -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMFrontendAtomic -lLLVMFrontendOffloading -lLLVMHipStdPar -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMObjCARCOpts -lLLVMTransformUtils -lLLVMCGData -lLLVMBitWriter -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMCodeGenTypes -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAMDGPUInfo -lLLVMMC -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lxml2 -pthread /usr/lib/libSPIRV-Tools-opt.so /usr/lib/libSPIRV-Tools.so /usr/lib/libSPIRV-Tools-link.so /usr/lib/libz.so /usr/lib/libdrm.so /usr/lib/libclangBasic.a /usr/lib/libclangAST.a /usr/lib/libclangCodeGen.a /usr/lib/libclangLex.a /usr/lib/libclangDriver.a /usr/lib/libclangFrontend.a /usr/lib/libclangFrontendTool.a /usr/lib/libclangHandleCXX.a /usr/lib/libclangHandleLLVM.a /usr/lib/libclangSerialization.a /usr/lib/libclangSema.a /usr/lib/libclangParse.a /usr/lib/libclangEdit.a /usr/lib/libclangAnalysis.a /usr/lib/libclangSupport.a /usr/lib/libclangASTMatchers.a /usr/lib/libclangAPINotes.a -lLLVMWindowsDriver -lLLVMFrontendHLSL -lLLVMFrontendDriver -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyUtils -lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSPIRVCodeGen -lLLVMSPIRVDesc -lLLVMSPIRVInfo -lLLVMSPIRVAnalysis -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser -lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMLTO -lLLVMExtensions -lLLVMLibDriver -lLLVMOption -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMCoverage -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMPasses -lLLVMCoroutines -lLLVMCFGuard -lLLVMMIRParser -lLLVMIRPrinter -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMSandboxIR -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMFrontendAtomic -lLLVMFrontendOffloading -lLLVMHipStdPar -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMObjCARCOpts -lLLVMTransformUtils -lLLVMCGData -lLLVMBitWriter -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMCodeGenTypes -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMAMDGPUInfo -lLLVMMC -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lz -lxml2 /usr/lib/libLLVMSPIRVLib.so -Wl,--end-group
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clc_compile_to_llvm_module(llvm::LLVMContext&, clc_compile_args const*, clc_logger const*, set*) [clone .cold]':
/usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:1069:(.text.unlikely._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x74): undefined reference to `clang::DiagnosticsEngine::~DiagnosticsEngine()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clang::EmitLLVMOnlyAction::~EmitLLVMOnlyAction()':
/usr/include/clang/CodeGen/CodeGenAction.h:109:(.text.unlikely._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x132): undefined reference to `vtable for clang::EmitLLVMOnlyAction'
/usr/bin/ld: /usr/include/clang/CodeGen/CodeGenAction.h:109:(.text.unlikely._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x14a): undefined reference to `clang::CodeGenAction::~CodeGenAction()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `llvm::RefCountedBase<clang::DiagnosticIDs>::Release() const':
/usr/include/llvm/ADT/IntrusiveRefCntPtr.h:103:(.text.unlikely._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x390): undefined reference to `clang::DiagnosticIDs::~DiagnosticIDs()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `void std::_Construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*)':
/usr/include/c++/15.1.1/bits/stl_construct.h:133:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x140): undefined reference to `clang::PCHContainerOperations::PCHContainerOperations()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clc_compile_to_llvm_module':
/usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:796:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x16a): undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, clang::InMemoryModuleCache*)'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clang::DependencyCollector::DependencyCollector()':
/usr/include/clang/Frontend/Utils.h:63:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x1ff): undefined reference to `vtable for clang::DependencyCollector'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clc_compile_to_llvm_module':
/usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:804:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x29d): undefined reference to `clang::DiagnosticIDs::DiagnosticIDs()'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:807:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x3bb): undefined reference to `clang::TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream&, clang::DiagnosticOptions*, bool)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:808:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x3f0): undefined reference to `clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>, clang::DiagnosticConsumer*, bool)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:840:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x562): undefined reference to `clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:1069:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x5fe): undefined reference to `clang::DiagnosticsEngine::~DiagnosticsEngine()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `llvm::RefCountedBase<clang::DiagnosticIDs>::Release() const':
/usr/include/llvm/ADT/IntrusiveRefCntPtr.h:103:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x785): undefined reference to `clang::DiagnosticIDs::~DiagnosticIDs()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clc_compile_to_llvm_module':
/usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:864:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0xa68): undefined reference to `clang::TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream&, clang::DiagnosticOptions*, bool)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:858:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0xa8d): undefined reference to `clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticConsumer*, bool)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:866:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0xabf): undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::DiagnosticsEngine&, std::shared_ptr<clang::TargetOptions> const&)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:866:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0xacb): undefined reference to `clang::CompilerInstance::setTarget(clang::TargetInfo*)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:1050:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x1f06): undefined reference to `clang::EmitLLVMOnlyAction::EmitLLVMOnlyAction(llvm::LLVMContext*)'
/usr/bin/ld: /usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:1051:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x1f12): undefined reference to `clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clang::EmitLLVMOnlyAction::~EmitLLVMOnlyAction()':
/usr/include/clang/CodeGen/CodeGenAction.h:109:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x1f8c): undefined reference to `vtable for clang::EmitLLVMOnlyAction'
/usr/bin/ld: /usr/include/clang/CodeGen/CodeGenAction.h:109:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x1fa4): undefined reference to `clang::CodeGenAction::~CodeGenAction()'
/usr/bin/ld: src/compiler/clc/liblibmesaclc.a.p/clc_helpers.cpp.o: in function `clc_compile_to_llvm_module':
/usr/src/debug/mesa/build/../mesa-25.1.3/src/compiler/clc/clc_helpers.cpp:1063:(.text._ZL26clc_compile_to_llvm_moduleRN4llvm11LLVMContextEPK16clc_compile_argsPK10clc_loggerP3set+0x2336): undefined reference to `clang::CodeGenAction::takeModule()'
collect2: error: ld returned 1 exit status
[828/3552] Compiling C object src/intel/blorp/libblorp.a.p/blorp_clear.c.o
../mesa-25.1.3/src/intel/blorp/blorp_clear.c: In function ‘convert_rt_from_3d_to_2d’:
../mesa-25.1.3/src/intel/blorp/blorp_clear.c:420:9: warning: unused variable ‘ok’ [-Wunused-variable]
  420 |    bool ok = isl_surf_init(isl_dev, &info->surf,
      |         ^~
[834/3552] Compiling C object src/intel/blorp/libblorp_elk.a.p/blorp_clear.c.o
../mesa-25.1.3/src/intel/blorp/blorp_clear.c: In function ‘convert_rt_from_3d_to_2d’:
../mesa-25.1.3/src/intel/blorp/blorp_clear.c:420:9: warning: unused variable ‘ok’ [-Wunused-variable]
  420 |    bool ok = isl_surf_init(isl_dev, &info->surf,
      |         ^~
[836/3552] Compiling C object src/intel/blorp/libblorp.a.p/blorp_blit.c.o
../mesa-25.1.3/src/intel/blorp/blorp_blit.c: In function ‘blorp_copy_get_formats’:
../mesa-25.1.3/src/intel/blorp/blorp_blit.c:2879:36: warning: unused variable ‘src_fmtl’ [-Wunused-variable]
 2879 |    const struct isl_format_layout *src_fmtl =
      |                                    ^~~~~~~~
[837/3552] Compiling C object src/intel/blorp/libblorp_elk.a.p/blorp_blit.c.o
../mesa-25.1.3/src/intel/blorp/blorp_blit.c: In function ‘blorp_copy_get_formats’:
../mesa-25.1.3/src/intel/blorp/blorp_blit.c:2879:36: warning: unused variable ‘src_fmtl’ [-Wunused-variable]
 2879 |    const struct isl_format_layout *src_fmtl =
      |                                    ^~~~~~~~
[840/3552] Compiling C object src/intel/dev/libintel_dev.a.p/intel_device_info.c.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

Offline

#10 2025-06-17 19:20:11

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,870

Re: I'm trying to build mesa with llvm linked statically with no luck

For clarity :
are you building in a clean chroot ?

Do you use split packages for llvm/clang (similar to my llvm-minimal-git) or separate packages like the repo ones ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#11 2025-06-18 01:09:58

Samueru
Member
Registered: 2023-07-03
Posts: 36

Re: I'm trying to build mesa with llvm linked statically with no luck

Lone_Wolf wrote:

For clarity :
are you building in a clean chroot ?

Do you use split packages for llvm/clang (similar to my llvm-minimal-git) or separate packages like the repo ones ?

I made an archlinux container with distrobox to build and install the modified packages.

So far I have modified and added:

* llvm-libs with static libs, using the upstream PKGBUILD. (which I had to repeat to make llvm with zstd disabled as well)

* clang with static libs, using the upstream PKGBUILD.

* zstd with static libs, using the upstream PKGBUILD. In this case I had to manually copy over the `.a` lib for some reason.


And now I'm stuck with mesa failing to build. Eventually once I can figure out how to compile mesa I would turn all of this mess into its own PKGBUILD.

Last edited by Samueru (2025-06-18 01:10:31)

Offline

#12 2025-06-18 10:43:41

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,870

Re: I'm trying to build mesa with llvm linked statically with no luck

Got it .

You want to setup a tool chain to build mesa against a static llvm/clang.
For my llvm-minimal-git/mesa-minimal-git packages that build mesa trunk against llvm trunk I had to figure out a similar toolchain .

Based on my experience with that toolchain and understanding how its parts interact I can help to setup such a toolchain for your goal.
The order in which things are build is critical. Frequently issues will be discovered in later steps that can only be solved by changes to earlier components.

In such cases everything after the changed component will have to be rebuild.

The current order you need is :

1. zstd
2, llvm + llvm-libs
3. clang
4. spirv-llvm-translator
5. libclc
6. mesa

some notes :
llvm , llvm-libs, clang, libclc are part of the llvm/clang suite and need to be of the exact same version. They also share many settings .

spirv-llvm-translator is a makedep for libclc and must be build against llvm/clang to function .
In the past spirv/libclc was mainly used for opencl in mesa. A while ago intel decided compiling shaders for their mesa intel driver using upstream spirv/llvm instead of their own custom shader compiler was a good idea.
Since then libclc/spirv-llvm-translator have become very important for mesa .

As spirv-llvm-translator is designed & maintained by Khronos it doesn't fit smoothly in the llvm/clang build process.
The above order is the only reliable way I found to provide mesa with the functionality it needs at build time .

To keep things manageable, relatively simple and as close as possible to arch repos you need to compile with gcc and use gnu ld as linker .

Last edited by Lone_Wolf (2025-06-18 10:44:30)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#13 2025-06-20 04:17:21

Samueru
Member
Registered: 2023-07-03
Posts: 36

Re: I'm trying to build mesa with llvm linked statically with no luck

Thanks a lot for the help Lone_Wolf.

I think I will just give up for now, I had a change of plan which was just make mesa without llvm hoping I could just use the software rasterizer but even that now depends on llvm as well wtf.

I will focus on reducing the size of libLLVM.so instead, I managed to get it down to 59 MiB but after llvm updated to version 20 this increased to 65 MiB, so I will live with this for now.

Offline

#14 2025-06-20 09:18:47

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,870

Re: I'm trying to build mesa with llvm linked statically with no luck

It is possible to get a working setup without llvm.

Zink can provide OpenGL and doesn't require llvm.
It does need a vulkan driver and sofar it seems the only mesa vulkan driver not needing llvm is the one for amd usually referred to as radv .

Recently I needed to bisect older mesa builds for a zink issue and had to disable llvm completely.
These are the settings I used

    meson setup mesa _build \
       -D b_ndebug=true \
       -D b_lto=false \
       -D b_pie=true \
       -D buildtype=plain \
       --wrap-mode=nofallback \
       -D prefix=/usr \
       -D sysconfdir=/etc \
       -D platforms=x11 \
       -D gallium-drivers=zink \
       -D vulkan-drivers=amd \
       -D egl=enabled \
       -D gallium-extra-hud=false \
       -D gallium-va=disabled \
       -D gallium-vdpau=disabled \
       -D gbm=enabled \
       -D gles1=disabled \
       -D gles2=enabled \
       -D glvnd=true \
       -D glx=dri \
       -D libunwind=enabled \
       -D llvm=disabled \
       -D lmsensors=disabled \
       -D valgrind=disabled \
       -D vulkan-layers=device-select \
       -D tools=[] \
       -D zstd=enabled \
       -D microsoft-clc=disabled \
       -D gallium-rusticl=false

Note that I disabled opencl/gallium-rusticl to make the build simpler but haven't tested if that is necessary.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB