Since r348628, FreeBSD head fails to build devel/valgrind as follows. I believe this is not a port problem. ``` cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../VEX/pub -I../VEX/pub -DVGA_x 86=1 -DVGO_freebsd=1 -DVGP_x86_freebsd=1 -DVGPV_x86_freebsd_vanilla=1 -I../coreg rind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"x86-freebsd\"" -B/usr/lib32 -m32 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Ws trict-prototypes -Wmissing-declarations -Wno-format-zero-length -Wno-tautologica l-compare -fno-strict-aliasing -fno-builtin -fomit-frame-pointer -Wno-long-long -O2 -pipe -march=skylake -fstack-protector-strong -fno-strict-aliasing -Wno-t autological-compare -Wno-cast-align -Wno-self-assign -fno-stack-protector -MT m_ debuginfo/libcoregrind_x86_freebsd_a-readelf.o -MD -MP -MF m_debuginfo/.deps/lib coregrind_x86_freebsd_a-readelf.Tpo -c -o m_debuginfo/libcoregrind_x86_freebsd_a -readelf.o `test -f 'm_debuginfo/readelf.c' || echo './'`m_debuginfo/readelf.c In file included from m_debuginfo/readelf.c:35: In file included from ./pub_core_vki.h:44: In file included from ../include/pub_tool_vki.h:54: ../include/vki/vki-freebsd.h:1958:1: warning: typedef requires a name [-Wmissing-declarations] typedef struct vki_i386_get_xfpustate { ^~~~~~~ ../include/vki/vki-freebsd.h:1963:1: warning: typedef requires a name [-Wmissing-declarations] typedef struct vki_amd64_get_xfpustate { ^~~~~~~ m_debuginfo/readelf.c:1094:54: error: use of undeclared identifier 'ELF_NOTE_GNU' if (ML_(img_strcmp_c)(img, name_ioff, ELF_NOTE_GNU) == 0 ^ m_debuginfo/readelf.c:1134:54: error: use of undeclared identifier 'ELF_NOTE_GNU' if (ML_(img_strcmp_c)(img, name_ioff, ELF_NOTE_GNU) == 0 ^ ``` r348628 commit added ``` #define NT_GNU_BUILD_ID 3 ``` in sys/elf_common.h. In m_debuginfo/readelf.c of valgrind source, ``` # ifdef NT_GNU_BUILD_ID if (is_elf_object_file_by_DiImage(img, rel_ok)) { (snip) if (ML_(img_strcmp_c)(img, name_ioff, ELF_NOTE_GNU) == 0 && note.n_type == NT_GNU_BUILD_ID) { ``` ELF_NOTE_GNU is referenced if NT_GNU_BUILD_ID is defined, but it is not defined in sys/elf_common.h. I've tried to add ``` #define ELF_NOTE_GNU "GNU" ``` in sys/elf_common.h. It works for me. Please consider to add the definition.
Assign to committer of r348628.
I opened new differential on https://reviews.freebsd.org/D21472. Please check and see it.
A commit references this bug: Author: emaste Date: Fri Sep 20 09:04:52 UTC 2019 New revision: 352551 URL: https://svnweb.freebsd.org/changeset/base/352551 Log: elf_common: add ELF note names r348628 added a definition of NT_GNU_BUILD_ID. Some software (Valgrind) also expects a #define for the note name (ELF_NOTE_GNU) in the case that NT_GNU_BUILD_ID is defined. PR: 239669 Reported by: Yuichiro NAITO Sponsored by: The FreeBSD Foundation Event: EuroBSDCon FreeBSD DevSummit 2019 Changes: head/sys/sys/elf_common.h
A commit references this bug: Author: emaste Date: Thu Sep 26 16:39:33 UTC 2019 New revision: 352760 URL: https://svnweb.freebsd.org/changeset/base/352760 Log: MFC r352551: elf_common: add ELF note names r348628 added a definition of NT_GNU_BUILD_ID. Some software (Valgrind) also expects a #define for the note name (ELF_NOTE_GNU) in the case that NT_GNU_BUILD_ID is defined. PR: 239669 Sponsored by: The FreeBSD Foundation Changes: _U stable/12/ stable/12/sys/sys/elf_common.h
FYI, this one bites me on 12.1-RC1 - are these changes supposed to land in 12.1-RELEASE, or is it too late?
I encountered this error on 12.1-RELEASE-p1, so it definitely affects the release.
I just encountered this on my 11.3-STABLE system, after the valgrind port got updated yesterday. Apparently 11.3 got the NT_GNU_BUILD_ID in sys/elf_common.h, too, but I never detected this problem because I had valgrind installed before I updated from 11.2 to 11.3, and the port hadn't needed to be recompiled until today.
workaround on 12.1-RELEASE-p2 cat /usr/ports/devel/valgrind/Makefile.local CFLAGS+= -DELF_NOTE_GNU=\\\"GNU\\\"
This still affects 12.1-RELEASE-p2 builds in poudriere.
Created attachment 213563 [details] Fix build error This should sort out the build error, and in the future should ELF_NOTE_GNU become defined again then it will do nothing.
In a contributed diff, I've added the update recommended by Paul Floyd to the patch file for vki-freebsd.h under the devel/valgrind port. The patch for the patch is incorporated into a diff/changeset for devel/valgrind, sysutils/dtc, emulator/qemu and emulators/qemu-devel submitted to FreeBSD bugzilla, this morning available: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245997
This patch is actually obsolete, yes? Both devel/valgrind and devel/valgrind-devel build for me on 12.1-STABLE r364374 (though devel/valgrind-devel has been much advanced from the "stable" port)
The patch is certainly not needed for devel/valgrind-devel. I haven't tried compiling the old devel/valgrind code for a while. I'll check and update soon.
I still get the same build failure for devel/valgrind with 12.1-RELEASE-p9.
(In reply to Paul Floyd from comment #14) This item can now be closed as we've now switched to an updated Valgrind codebase.