SUMMARY Building an RPM of Valgrind 3.22.0 does not work under Red Hat Enterprise Linux 8 STEPS TO REPRODUCE 1. Execute "rpmbuild -tb valgrind-3.22.0.tar.bz2" on a fully patched RHEL 8.8 system 2. One obtains the error messages below OBSERVED RESULT The error messages: --------------------------------------- /usr/bin/mkdir -p '/usr/libexec/valgrind' /usr/bin/install -c -m 644 m_gdbserver/valgrind-monitor.py m_gdbserver/valgrind-monitor-def.py '/usr/libexec/valgrind' /usr/bin/install: cannot create regular file '/usr/libexec/valgrind/valgrind-monitor.py': Permission denied /usr/bin/install: cannot create regular file '/usr/libexec/valgrind/valgrind-monitor-def.py': Permission denied make[4]: *** [Makefile:9424: install-gdbscriptsDATA] Error 1 make[4]: Leaving directory '/home/user/rpmbuild/BUILD/valgrind-3.22.0/coregrind' make[3]: *** [Makefile:9565: install-am] Error 2 make[3]: Leaving directory '/home/user/rpmbuild/BUILD/valgrind-3.22.0/coregrind' make[2]: *** [Makefile:9558: install] Error 2 make[2]: Leaving directory '/home/user/rpmbuild/BUILD/valgrind-3.22.0/coregrind' make[1]: *** [Makefile:918: install-recursive] Error 1 make[1]: Leaving directory '/home/user/rpmbuild/BUILD/valgrind-3.22.0' make: *** [Makefile:1225: install] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.Jax4dz (%install) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.Jax4dz (%install) --------------------------------------- EXPECTED RESULT It should build, like 3.21.0 did.
I created 3.22.0 rpms for epel8: https://copr.fedorainfracloud.org/coprs/mjw/valgrind-3.22.0/ The system gdb is too old to support the valgrind python monitor commands, so it is build with --without-gdbscripts-dir. Does that help?
Hi Mark Thanks, your suggestion brought me a lot closer to building the RPM. However at the end I got messages about unpackaged files: > Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/user/rpmbuild/BUILDROOT/valgrind-3.22.0.x86_64 > error: Installed (but unpackaged) file(s) found: > /usr/lib/debug/usr/libexec/valgrind/cachegrind-amd64-linux-3.22.0.x86_64.debug > ... > /usr/libexec/valgrind/32bit-core-valgrind-s1.xml > > RPM build errors: > Installed (but unpackaged) file(s) found: > /usr/lib/debug/usr/libexec/valgrind/cachegrind-amd64-linux-3.22.0.x86_64.debug > ... > /usr/libexec/valgrind/32bit-core-valgrind-s1.xml > ... To fix those, another patch was needed: > diff -Nur valgrind-3.22.0/valgrind.spec valgrind-3.22.0.patched/valgrind.spec > --- valgrind-3.22.0/valgrind.spec 2023-10-31 18:26:43.000000000 +0100 > +++ valgrind-3.22.0.patched/valgrind.spec 2023-11-08 07:13:21.246612838 +0100 > @@ -42,6 +42,7 @@ > %{_includedir}/valgrind > %{_libdir}/valgrind > %{_libdir}/pkgconfig/* > +%{_libexecdir}/valgrind > > %doc > %defattr(-,root,root)
Created attachment 163036 [details] Workaround to packge gdb Python script files It seems gdb in RHEL8 is not too old for packaging valgrind-monitor-def.py and valgrind-monitor.py. The initial comment in the bug points to a permission problem because the RPM build tries to incorrectly write the files into /usr/libexec/valgrind. In an RPM build the correct path would be '/home/user/rpmbuild/BUILDROOT/valgrind-3.22.0-1.x86_64/usr/libexec/valgrind', so the prefix is missing. The problem lies in the 'install-recursive' target of the build. This patch is just a workaround, that always sets the directory but it would not work if the user opted for --without-gdbscripts-dir. Maybe someone who has a deeper understanding of the Valgrind build mechanism can come up with a patch that works in all cases.
Created attachment 163037 [details] Patch needed to package libexec content As mentioned earlier in the bug, this patch is needed to properly package libexec files. Otherwise the RPM build mechanism complains about installed but unpackaged files. This was observed when building the RPM under RHEL8.