Created attachment 246680 [details] workaround (prefer elfutils) Mixing ABIs between different projects with compatible API can lead to instability or crashes. While -Dlibelf=disabled prevents Meson (pkg-config) from using devel/elfutils other dependencies add -I/usr/local/include which end up overriding C preprocessor search order. $ pkg install elfutils $ echo '#error API trap' >>/usr/local/include/libelf.h $ make clean all -C graphics/mesa-dri [...] FAILED: src/amd/common/libamd_common.a.p/ac_rtld.c.o In file included from ../src/amd/common/ac_rtld.c:32: In file included from /usr/local/include/gelf.h:32: /usr/local/include/libelf.h:523:2: error: API trap #error API trap ^ In file included from ../src/amd/common/ac_rtld.c:33: /usr/local/include/libelf.h:523:2: error: API trap #error API trap ^ 2 errors generated. See also PKG_CONFIG_SYSTEM_INCLUDE_PATH in pkgconf(1) manpage https://wiki.freebsd.org/WarnerLosh/UsrLocal#Include_paths https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
Confirmed locally that this patch does the right thing, if I have elfutils installed mesa is then linked against it and everything works.
Jan, do you plan to land this or should I ?
No. I'm not sure what to put into the commit message and don't want to deal with upstreaming. Besides, base libelf can be forced via CPPFLAGS+=-idirafter ${LOCALBASE}/include
(In reply to Jan Beich from comment #0) As noted in https://docs.freebsd.org/en/books/porters-handbook/makefiles/#makefile-automatic-dependencies this workaround shouldn't be used as it causes problems when the building system changes and with it the dependencies of the port.
ref: ports 9f41e650f5645f1e50d8e51eb53ea231ff9f5149
Created attachment 247955 [details] patch This patch forces use system libelf.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273803
NAK, current ports is correctly made, use poudriere to build in a clean env.
(In reply to Emmanuel Vadot from comment #8) Use poudriere yourself.
Comment on attachment 247955 [details] patch Why such a large patch instead of -idirafter like comment 3 suggested?
(In reply to Jan Beich from comment #10) If it work - cool. I never see this option before ) Patch also disables: libudev, openmp, xcb_keysyms and remove libelf dep if it installed from ports.
(In reply to Jan Beich from comment #10) Pretty sure I tested -idirafter and I wasn't able to make it work correctly.