# CPack, RPM, and build-id

**URL:** https://discourse.cmake.org/t/cpack-rpm-and-build-id/11788
**Category:** Usage
**Created:** [September 27, 2024, 9:11pm UTC](https://discourse.cmake.org/t/cpack-rpm-and-build-id/11788 "2024-09-27T21:11:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [September 27, 2024, 9:11pm UTC](https://discourse.cmake.org/t/cpack-rpm-and-build-id/11788/1 "2024-09-27T21:11:59Z")

</div>

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`](https://github.com/rpm-software-management/rpm/blob/bcf06fded9ff0d94d5104b53344eb959a8dd0c92/macros.in#L497-L523) 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.

---

<div class="post-metadata">

### Author: ![jwm](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jwm/32/654_2.png) [@jwm](https://discourse.cmake.org/u/jwm)
#### Post date: [September 27, 2024, 9:32pm UTC](https://discourse.cmake.org/t/cpack-rpm-and-build-id/11788/2 "2024-09-27T21:32:22Z")

</div>

This seems to work:

```cmake
  set(CPACK_RPM_SPEC_MORE_DEFINE "%define _build_id_links none")

```

---

<div class="post-metadata">

### Author: ![erk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/erk/32/114_2.png) [@erk](https://discourse.cmake.org/u/erk)
#### Post date: [September 30, 2024, 7:56am UTC](https://discourse.cmake.org/t/cpack-rpm-and-build-id/11788/3 "2024-09-30T07:56:18Z")

</div>

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](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](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum)
