Bug 273803 - graphics/mesa-dri: mesa-dri is missing a required shared library: libelf.so.1
Summary: graphics/mesa-dri: mesa-dri is missing a required shared library: libelf.so.1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-x11 (Nobody)
URL: https://www.freshports.org/graphics/m...
Keywords:
Depends on: 275443
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-14 20:50 UTC by Ivan Rozhuk
Modified: 2024-07-04 13:58 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
patch (937 bytes, patch)
2023-09-15 20:57 UTC, Ivan Rozhuk
no flags Details | Diff
patch (948 bytes, patch)
2023-09-15 23:15 UTC, Ivan Rozhuk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2023-09-14 20:50:30 UTC
links with libelf.so.1 if devel/elfutils installed, but this is not reflected in deps list.
Comment 1 Gunther Nikl 2023-09-15 19:36:36 UTC
(In reply to Ivan Rozhuk from comment #0)
If libelf is detected then some AMD backend code apparently makes use of it. Unfortunately libelf is not a build option, thus the only way to prevent using libelf if installed is apparently to patch meson.build.
Comment 2 Ivan Rozhuk 2023-09-15 20:57:11 UTC
Created attachment 244903 [details]
patch

This patch disables 3 optional deps that does not described in ports Makefile.
I do not test it, but IMHO only libudev probably was persist always then build on FreeBSD.

This can be converted to 2-3 separate port options.
Comment 3 Ivan Rozhuk 2023-09-15 21:57:41 UTC
(In reply to Ivan Rozhuk from comment #2)

With: -e 's|dep_elf =.*|dep_elf = null_dep|g'
got link error:

FAILED: src/gallium/targets/dri/libgallium_dri.so 
c++  -o src/gallium/targets/dri/libgallium_dri.so src/gallium/targets/dri/libgallium_dri.so.p/target.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libgallium_dri.so -Wl,-rpath=/usr/local/llvm15/lib -fstack-protector-strong -O2 -pipe -O3 -funroll-loops -mretpoline -fno-delete-null-pointer-checks -fstack-protector-strong -fno-strict-aliasing -fdebug-prefix-map=/tmp/ports/usr/ports/graphics/mesa-dri/work/mesa-22.3.7=. -O3 -funroll-loops -mretpoline -fno-delete-null-pointer-checks '-Wl,-rpath,$ORIGIN/../../../mapi/shared-glapi:/usr/local/lib' -Wl,-rpath-link,/tmp/ports/usr/ports/graphics/mesa-dri/work/mesa-22.3.7/_build/src/mapi/shared-glapi -Wl,-rpath-link,/usr/local/lib src/gallium/frontends/dri/libdri.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/mesa/libmesa.a src/compiler/glsl/libglsl.a src/compiler/glsl/glcpp/libglcpp.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/mesa/libmesa_sse41.a src/gallium/auxiliary/libgalliumvl.a src/gallium/auxiliary/libgallium.a src/mapi/shared-glapi/libglapi.so.0.0.0 src/gallium/auxiliary/pipe-loader/libpipe_loader_static.a src/loader/libloader.a src/util/libxmlconfig.a src/gallium/winsys/sw/null/libws_null.a src/gallium/winsys/sw/wrapper/libwsw.a src/gallium/winsys/sw/dri/libswdri.a src/gallium/winsys/sw/kms-dri/libswkmsdri.a src/gallium/drivers/llvmpipe/libllvmpipe.a src/gallium/drivers/softpipe/libsoftpipe.a src/gallium/drivers/r300/libr300.a src/gallium/winsys/radeon/drm/libradeonwinsys.a src/gallium/drivers/r600/libr600.a src/gallium/drivers/radeonsi/libradeonsi_gfx6.a src/gallium/drivers/radeonsi/libradeonsi_gfx7.a src/gallium/drivers/radeonsi/libradeonsi_gfx8.a src/gallium/drivers/radeonsi/libradeonsi_gfx9.a src/gallium/drivers/radeonsi/libradeonsi_gfx10.a src/gallium/drivers/radeonsi/libradeonsi_gfx103.a src/gallium/drivers/radeonsi/libradeonsi_gfx11.a src/gallium/drivers/radeonsi/libradeonsi.a src/gallium/winsys/amdgpu/drm/libamdgpuwinsys.a src/amd/addrlib/libaddrlib.a src/amd/common/libamd_common.a src/amd/llvm/libamd_common_llvm.a src/gallium/drivers/i915/libi915.a src/gallium/winsys/i915/drm/libi915drm.a src/gallium/drivers/svga/libsvga.a src/gallium/winsys/svga/drm/libsvgadrm.a src/gallium/drivers/iris/libiris.a src/gallium/drivers/iris/libiris_per_hw_ver80.a src/gallium/drivers/iris/libiris_per_hw_ver90.a src/gallium/drivers/iris/libiris_per_hw_ver110.a src/gallium/drivers/iris/libiris_per_hw_ver120.a src/gallium/drivers/iris/libiris_per_hw_ver125.a src/intel/compiler/libintel_compiler.a src/intel/dev/libintel_dev.a src/intel/isl/libisl.a src/intel/isl/libisl_per_hw_ver40.a src/intel/isl/libisl_per_hw_ver50.a src/intel/isl/libisl_per_hw_ver60.a src/intel/isl/libisl_per_hw_ver70.a src/intel/isl/libisl_per_hw_ver75.a src/intel/isl/libisl_per_hw_ver80.a src/intel/isl/libisl_per_hw_ver90.a src/intel/isl/libisl_per_hw_ver110.a src/intel/isl/libisl_per_hw_ver120.a src/intel/isl/libisl_per_hw_ver125.a src/intel/isl/libisl_tiled_memcpy.a src/intel/isl/libisl_tiled_memcpy_sse41.a src/intel/blorp/libblorp.a src/intel/perf/libintel_perf.a src/intel/common/libintel_common.a src/intel/ds/libintel-driver-ds.a src/gallium/winsys/iris/drm/libiriswinsys.a src/gallium/drivers/zink/libzink.a src/vulkan/util/libvulkan_util.a src/gallium/drivers/crocus/libcrocus.a src/gallium/drivers/crocus/libcrocus_per_hw_ver40.a src/gallium/drivers/crocus/libcrocus_per_hw_ver45.a src/gallium/drivers/crocus/libcrocus_per_hw_ver50.a src/gallium/drivers/crocus/libcrocus_per_hw_ver60.a src/gallium/drivers/crocus/libcrocus_per_hw_ver70.a src/gallium/drivers/crocus/libcrocus_per_hw_ver75.a src/gallium/drivers/crocus/libcrocus_per_hw_ver80.a src/gallium/winsys/crocus/drm/libcrocuswinsys.a -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script /tmp/ports/usr/ports/graphics/mesa-dri/work/mesa-22.3.7/src/gallium/targets/dri/dri.sym -Wl,--dynamic-list /tmp/ports/usr/ports/graphics/mesa-dri/work/mesa-22.3.7/src/gallium/targets/dri/../dri-vdpau.dyn /usr/local/lib/libdrm.so /usr/local/llvm15/lib/libLLVM-15.so -pthread /usr/local/lib/libexpat.so /usr/lib/libz.so -lm /usr/local/lib/libzstd.so /usr/local/lib/libunwind.so /usr/local/lib/libdrm_radeon.so /usr/local/lib/libdrm_amdgpu.so /usr/local/lib/libdrm_intel.so /usr/local/lib/libxcb.so /usr/local/lib/libX11-xcb.so /usr/local/lib/libX11.so /usr/local/lib/libxcb-dri3.so /usr/local/lib/libxcb-present.so /usr/local/lib/libxcb-xfixes.so /usr/local/lib/libxcb-sync.so /usr/local/lib/libxcb-randr.so /usr/local/lib/libxcb-shm.so /usr/local/lib/libxshmfence.so /usr/local/lib/libXrandr.so -Wl,--end-group
ld: warning: version script assignment of 'global' to symbol '__driDriverExtensions' failed: symbol not defined
ld: warning: version script assignment of 'global' to symbol 'nouveau_drm_screen_create' failed: symbol not defined
ld: warning: version script assignment of 'global' to symbol 'fd_drm_screen_create' failed: symbol not defined
ld: error: undefined symbol: ac_rtld_open
>>> referenced by si_shader_llvm.c
>>>               libradeonsi.a.p/si_shader_llvm.c.o:(si_compile_llvm) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_shader.c
>>>               libradeonsi.a.p/si_shader.c.o:(si_shader_binary_open) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_shader.c
>>>               libradeonsi.a.p/si_shader.c.o:(si_shader_dump_disassembly) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced 3 more times

ld: error: undefined symbol: ac_rtld_read_config
>>> referenced by si_shader_llvm.c
>>>               libradeonsi.a.p/si_shader_llvm.c.o:(si_compile_llvm) in archive src/gallium/drivers/radeonsi/libradeonsi.a

ld: error: undefined symbol: ac_rtld_close
>>> referenced by si_shader_llvm.c
>>>               libradeonsi.a.p/si_shader_llvm.c.o:(si_compile_llvm) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_shader.c
>>>               libradeonsi.a.p/si_shader.c.o:(si_shader_binary_upload) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_shader.c
>>>               libradeonsi.a.p/si_shader.c.o:(si_shader_dump_stats_for_shader_db) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced 130 more times

ld: error: undefined symbol: ac_rtld_upload
>>> referenced by si_shader.c
>>>               libradeonsi.a.p/si_shader.c.o:(si_shader_binary_upload) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_state_draw.cpp
>>>               libradeonsi_gfx11.a.p/si_state_draw.cpp.o:(bool si_update_shaders<(amd_gfx_level)14, (si_has_tess)0, (si_has_gs)0, (si_has_ngg)1>(si_context*)) in archive src/gallium/drivers/radeonsi/libradeonsi_gfx11.a
>>> referenced by si_state_draw.cpp
>>>               libradeonsi_gfx11.a.p/si_state_draw.cpp.o:(bool si_update_shaders<(amd_gfx_level)14, (si_has_tess)0, (si_has_gs)0, (si_has_ngg)1>(si_context*)) in archive src/gallium/drivers/radeonsi/libradeonsi_gfx11.a
>>> referenced 118 more times

ld: error: undefined symbol: ac_rtld_get_section_by_name
>>> referenced by si_shader.c
>>>               libradeonsi.a.p/si_shader.c.o:(si_shader_dump_disassembly) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_compute.c
>>>               libradeonsi.a.p/si_compute.c.o:(si_create_compute_state) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced by si_compute.c
>>>               libradeonsi.a.p/si_compute.c.o:(si_launch_grid) in archive src/gallium/drivers/radeonsi/libradeonsi.a
>>> referenced 1 more times
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1
Comment 4 Ivan Rozhuk 2023-09-15 23:14:48 UTC
As fallback it uses "Library elf found: YES", it is also marked as optional but got link error.
dep_elf = dependency('libelf', required : false)
if not with_platform_windows and not dep_elf.found()
  dep_elf = cc.find_library('elf', required : false)
endif
if dep_elf.found()
  pre_args += '-DUSE_LIBELF'
endif

New path removes only 'libelf'.
Comment 5 Ivan Rozhuk 2023-09-15 23:15:07 UTC
Created attachment 244907 [details]
patch
Comment 6 Ivan Rozhuk 2023-09-16 04:22:38 UTC
I dig more [1] and found another way without port patching for use libelf from base system.
But other 2 optional dep require attention.


1. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273839#c1
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-11-21 15:19:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=29d855b6f775be3f43aa5fb4b45c88ca9711dfd3

commit 29d855b6f775be3f43aa5fb4b45c88ca9711dfd3
Author:     gnikl <gnikl@justmail.de>
AuthorDate: 2023-09-14 23:16:00 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-11-21 15:17:28 +0000

    graphics/mesa: update to 23.1.8

    While here:
    - Remove some unneeded dep in gallium-vdpau
    - Disable libelf from devel/elfutils (we will fallback on base libelf), PR 273803
    - Always disable libunwind, if you want stacktrace you will need to compile from
    upstream PR: 250306
    - enable vulkan haswell driver

    Co-authored-by: manu, vishwin
    PR: 273703, 273803, 250306

 graphics/libosmesa/Makefile                        |  12 +-
 graphics/mesa-dri/Makefile                         |  22 ++-
 graphics/mesa-dri/Makefile.common                  |  29 ++-
 graphics/mesa-dri/distinfo                         |  10 +-
 .../files/patch-include_drm-uapi_dma-buf.h (gone)  | 198 ---------------------
 ...h-src_gallium_include_pipe_p__compiler.h (gone) |  11 --
 .../mesa-dri/files/patch-src_util_macros.h (gone)  |  11 --
 graphics/mesa-dri/files/patch-src_util_u__memory.h |  18 +-
 .../patch-src_vulkan_wsi_wsi__common__drm.c (gone) |  61 -------
 graphics/mesa-dri/files/patch-wayland-1.22 (gone)  |  44 -----
 graphics/mesa-dri/pkg-plist                        |   2 +
 graphics/mesa-gallium-va/Makefile                  |   9 +-
 graphics/mesa-gallium-vdpau/Makefile               |  13 +-
 graphics/mesa-gallium-vdpau/pkg-plist              |   4 -
 graphics/mesa-gallium-xa/Makefile                  |  13 +-
 graphics/mesa-libs/Makefile                        |   6 +-
 lang/clover/Makefile                               |  16 +-
 17 files changed, 90 insertions(+), 389 deletions(-)
Comment 8 Amanda Steele 2023-12-13 04:16:13 UTC
MARKED AS SPAM