Skip to content

lvp: Use libudev linker flag when building with udev suport

Thomas Debesse requested to merge illwieckz/mesa:lavapipe-udev into main

Linking lavapipe requires -ludev linker flag when libudev is found and lavapipe makes use of it.

I first thought the link issue was a problem with my distro but they said it is not: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1990315

I'm not a meson master so I don't know how it behaves if optional libudev isn't there.

Here is the link failure it fixes on my end:

Dependency libudev found: YES 249 (cached)
[…]
[1070/1118] Linking target src/gallium/targets/lavapipe/libvulkan_lvp.so
FAILED: src/gallium/targets/lavapipe/libvulkan_lvp.so 
c++  -o src/gallium/targets/lavapipe/libvulkan_lvp.so src/gallium/targets/lavapipe/libvulkan_lvp.so.p/target.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libvulkan_lvp.so -Wl,--whole-archive src/gallium/frontends/lavapipe/liblavapipe_st.a -Wl,--no-whole-archive -fno-lto -fno-lto src/gallium/auxiliary/pipe-loader/libpipe_loader_static.a src/loader/libloader.a src/util/libxmlconfig.a src/util/libmesa_util.a src/util/format/libmesa_format.a src/util/libmesa_util_sse41.a src/c11/impl/libmesa_util_c11.a src/gallium/auxiliary/libgallium.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/gallium/winsys/sw/wrapper/libwsw.a src/gallium/winsys/sw/null/libws_null.a src/gallium/drivers/llvmpipe/libllvmpipe.a src/gallium/drivers/softpipe/libsoftpipe.a src/vulkan/util/libvulkan_util.a -Wl,-Bsymbolic -Wl,--gc-sections -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMCFGuard -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMPasses -lLLVMObjCARCOpts -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -pthread /usr/lib/x86_64-linux-gnu/libz.so -lm install/lib/x86_64-linux-gnu/libdrm.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libzstd.so /usr/lib/x86_64-linux-gnu/libunwind.so -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMCFGuard -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMPasses -lLLVMObjCARCOpts -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMCFGuard -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMPasses -lLLVMObjCARCOpts -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMCFGuard -lLLVMX86Desc -lLLVMX86Info -lLLVMMCJIT -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMAMDGPUTargetMCA -lLLVMMCA -lLLVMAMDGPUDisassembler -lLLVMMCDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMPasses -lLLVMObjCARCOpts -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle /usr/lib/x86_64-linux-gnu/libxcb-dri3.so install/lib/x86_64-linux-gnu/libwayland-client.so /usr/lib/x86_64-linux-gnu/libxcb.so /usr/lib/x86_64-linux-gnu/libX11-xcb.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libxcb-present.so /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so /usr/lib/x86_64-linux-gnu/libxcb-sync.so /usr/lib/x86_64-linux-gnu/libxcb-randr.so /usr/lib/x86_64-linux-gnu/libxcb-shm.so /usr/lib/x86_64-linux-gnu/libxshmfence.so /usr/lib/x86_64-linux-gnu/libXrandr.so -Wl,--end-group
mold: error: undefined symbol: udev_new
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_monitor_get_fd
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_monitor_new_from_netlink
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_monitor_receive_device
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_monitor_unref
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_unref
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_device_unref
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_device_get_property_value
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_monitor_filter_add_match_subsystem_devtype
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
mold: error: undefined symbol: udev_monitor_enable_receiving
>>> referenced by wsi_common_display.c
>>>               src/gallium/frontends/lavapipe/liblavapipe_st.a(src/gallium/frontends/lavapipe/../../../vulkan/wsi/libvulkan_wsi.a.p/wsi_common_display.c.o):(udev_event_listener_thread)
collect2: error: ld returned 1 exit status

Merge request reports