Static linking LLVM 15 fails with unresolved symbols if not building CLC
I don't know if this is a regression or it has always been a problem, but I tested 22.2.0 and 22.2.1 and they are both affected. On MSVC build specifically enabling Microsoft CLC make everything else linking LLVM build successfully, however Microsoft CLC itself fails to build - #7243 (closed).
Example affected build configuration
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.3.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
meson.exe setup build/msvc-x64 --libdir="lib/x64" --pkgconfig.relocatable --prefix="C:/Software/Development/projects/mesa-dist-win" -Db_vscrt=mt -Dzlib:default_library=static --backend=ninja --buildtype=debugoptimized -Db_ndebug=true -Dcpp_rtti=true -Dllvm=enabled -Dshared-llvm=disabled --cmake-prefix-path= -Dgallium-drivers=swrast,zink,d3d12 -Dvulkan-drivers=swrast,microsoft-experimental -Dgallium-d3d10umd=true -Dspirv-to-dxil=true -Dshared-glapi=enabled -Dgles1=enabled -Dgles2=enabled -Degl=enabled -Dosmesa=true -Dbuild-tests=true -Dmicrosoft-clc=disabled -Dgallium-opencl=disabled -Ddraw-use-llvm=true -Dmin-windows-version=7
ninja: Entering directory `C:\Software\Development\projects\mesa\build\msvc-x64'
[2/40] Linking target src/gallium/drivers/llvmpipe/lp_test_format.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_format.exe src/gallium/drivers/llvmpipe/lp_test_format.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_format.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_format.exe : fatal error LNK1120: 3 unresolved externals
[3/40] Linking target src/gallium/drivers/llvmpipe/lp_test_arit.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_arit.exe src/gallium/drivers/llvmpipe/lp_test_arit.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_arit.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_arit.exe : fatal error LNK1120: 3 unresolved externals
[4/40] Linking target src/gallium/drivers/llvmpipe/lp_test_blend.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_blend.exe src/gallium/drivers/llvmpipe/lp_test_blend.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_blend.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_blend.exe : fatal error LNK1120: 3 unresolved externals
[5/40] Linking target src/gallium/drivers/llvmpipe/lp_test_conv.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_conv.exe src/gallium/drivers/llvmpipe/lp_test_conv.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_conv.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_conv.exe : fatal error LNK1120: 3 unresolved externals
[6/40] Linking target src/gallium/drivers/llvmpipe/lp_test_printf.exe
FAILED: src/gallium/drivers/llvmpipe/lp_test_printf.exe src/gallium/drivers/llvmpipe/lp_test_printf.pdb
"link" @src/gallium/drivers/llvmpipe/lp_test_printf.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\drivers\llvmpipe\lp_test_printf.exe : fatal error LNK1120: 3 unresolved externals
[7/40] Linking target src/gallium/targets/osmesa/osmesa.dll
FAILED: src/gallium/targets/osmesa/osmesa.dll src/gallium/targets/osmesa/osmesa.pdb
"link" @src/gallium/targets/osmesa/osmesa.dll.rsp
Creating library src\gallium\targets/osmesa\osmesa.lib and object src\gallium\targets/osmesa\osmesa.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\osmesa\osmesa.dll : fatal error LNK1120: 3 unresolved externals
[8/40] Linking target src/gallium/targets/d3d10sw/d3d10sw.dll
FAILED: src/gallium/targets/d3d10sw/d3d10sw.dll src/gallium/targets/d3d10sw/d3d10sw.pdb
"link" @src/gallium/targets/d3d10sw/d3d10sw.dll.rsp
Creating library src\gallium\targets/d3d10sw\d3d10sw.lib and object src\gallium\targets/d3d10sw\d3d10sw.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\d3d10sw\d3d10sw.dll : fatal error LNK1120: 3 unresolved externals
[9/40] Linking target src/gallium/targets/libgl-d3d12/openglon12.dll
FAILED: src/gallium/targets/libgl-d3d12/openglon12.dll src/gallium/targets/libgl-d3d12/openglon12.pdb
"link" @src/gallium/targets/libgl-d3d12/openglon12.dll.rsp
Creating library src\gallium\targets/libgl-d3d12\openglon12.lib and object src\gallium\targets/libgl-d3d12\openglon12.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\libgl-d3d12\openglon12.dll : fatal error LNK1120: 3 unresolved externals
[10/40] Linking target src/gallium/targets/wgl/libgallium_wgl.dll
FAILED: src/gallium/targets/wgl/libgallium_wgl.dll src/gallium/targets/wgl/libgallium_wgl.pdb
"link" @src/gallium/targets/wgl/libgallium_wgl.dll.rsp
Creating library src\gallium\targets/wgl\libgallium_wgl.lib and object src\gallium\targets/wgl\libgallium_wgl.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\wgl\libgallium_wgl.dll : fatal error LNK1120: 3 unresolved externals
[11/40] Linking target src/gallium/targets/graw-gdi/graw.dll
FAILED: src/gallium/targets/graw-gdi/graw.dll src/gallium/targets/graw-gdi/graw.pdb
"link" @src/gallium/targets/graw-gdi/graw.dll.rsp
Creating library src\gallium\targets/graw-gdi\graw.lib and object src\gallium\targets/graw-gdi\graw.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\graw-gdi\graw.dll : fatal error LNK1120: 3 unresolved externals
[12/40] Linking target src/gallium/targets/lavapipe/vulkan_lvp.dll
FAILED: src/gallium/targets/lavapipe/vulkan_lvp.dll src/gallium/targets/lavapipe/vulkan_lvp.pdb
"link" @src/gallium/targets/lavapipe/vulkan_lvp.dll.rsp
Creating library src\gallium\targets/lavapipe\vulkan_lvp.lib and object src\gallium\targets/lavapipe\vulkan_lvp.exp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\gallium\targets\lavapipe\vulkan_lvp.dll : fatal error LNK1120: 3 unresolved externals
[13/40] Linking target src/mesa/main/tests/main_test.exe
FAILED: src/mesa/main/tests/main_test.exe src/mesa/main/tests/main_test.pdb
"link" @src/mesa/main/tests/main_test.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\mesa\main\tests\main_test.exe : fatal error LNK1120: 3 unresolved externals
[14/40] Linking target src/mesa/state_tracker/tests/st_format_test.exe
FAILED: src/mesa/state_tracker/tests/st_format_test.exe src/mesa/state_tracker/tests/st_format_test.pdb
"link" @src/mesa/state_tracker/tests/st_format_test.exe.rsp
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMRunPasses referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMCreatePassBuilderOptions referenced in function gallivm_compile_module
libgallium.a(gallivm_lp_bld_init.c.obj) : error LNK2019: unresolved external symbol LLVMDisposePassBuilderOptions referenced in function gallivm_compile_module
src\mesa\state_tracker\tests\st_format_test.exe : fatal error LNK1120: 3 unresolved externals
ninja: build stopped: cannot make progress due to previous errors.