CPack, RPM, and build-id

It’s been a few years since I used CMake/CPack to generate RPMs, but the requirement arose recently, so I grabbed the packaging section from a previous project and voila I had an RPM.

However, when I examine the RPM with rpm -qlp my.rpm I see these files in /usr/lib/.build-id that I’ve never seen before. Doing a little digging, I see that rpmbuild can control the generation of these files with the %_build_id_links variable.

What I don’t know is if it is good to suppress this information in my RPM, and if so, how to do it using CMake/CPack variables or other native means, rather than writing my own spec file.

This seems to work:

  set(CPACK_RPM_SPEC_MORE_DEFINE "%define _build_id_links none")

That’s the way to go. CPackRPM is using rpmbuild command in order to create RPMs.
The default behavior of rpmbuild may depends on system specific RPM macros:
https://rpm-packaging-guide.github.io/#rpm-distribution-macros
which are not under CPackRPM control.

(re)defining your appropriate value may help as you see.

Same kind of solution for https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum

1 Like