# CPack (rpm) prebuild jar file changes checksum

**URL:** https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110
**Category:** Development
**Created:** [June 26, 2024, 1:20pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110 "2024-06-26T13:20:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dabitz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@dabitz](https://discourse.cmake.org/u/dabitz)
#### Post date: [June 26, 2024, 1:20pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/1 "2024-06-26T13:20:39Z")

</div>

I would like to generate a rpm package using cpack.  
I’m using install(DIRECTORY … DESTINATION …) to also install a bunch of prebuild jar files.  
But after rpm generation the packed jar files got modified and don’t have the same checksum as the original prebuild ones.

This is a problem, because later on I’m checking the checksums of the jar files.

Changing the files from .jar to e.g. .jar.bak and installing them will prevent the modification.

install(FILES … DESTINATION …) has the same behaviour.

Am I missing something?

Tested with latest version cmake-3.29.6-linux-x86\_64

Edit:  
I tested it with a lot of other file extensions and only jar seems to be affected.

---

<div class="post-metadata">

### Author: ![dabitz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@dabitz](https://discourse.cmake.org/u/dabitz)
#### Post date: [July 9, 2024, 1:42pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/2 "2024-07-09T13:42:04Z")

</div>

@brad.king  
Is this an intended behavior of cpack?  
Is it a kind of compression of the jar files (if yes, how to prevent it)?

---

<div class="post-metadata">

### Author: ![dabitz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@dabitz](https://discourse.cmake.org/u/dabitz)
#### Post date: [September 23, 2024, 2:50pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/3 "2024-09-23T14:50:51Z")

</div>

Sorry for bumping this again.

I have also created a ticket at gitlab:

[CPack changes checksum of prebuild jar files (#26183) · Tickets · CMake / CMake · GitLab (kitware.com)](https://gitlab.kitware.com/cmake/cmake/-/issues/26183#note_1554097)

Could I get a validiation, if this is also happening for someone else?

@brad.king@craig.scott  
Is this an intended behavior of cpack?  
Or is this a error on my side?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 23, 2024, 9:45pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/4 "2024-09-23T21:45:04Z")

</div>

Sorry, I have no insights into what’s happening in your scenario.

---

<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 24, 2024, 10:26am UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/5 "2024-09-24T10:26:34Z")

</div>

CPack RPM may not be the culprit here.  
CPack RPM is using rpmbuild command to build RPM, rpmbuild may do some “jar repacking” which implies the checksum change.

See e.g.:  
[https://bugzilla.redhat.com/show\_bug.cgi?id=219731](https://bugzilla.redhat.com/show_bug.cgi?id=219731)

You can try to disable this by adding:  
`set(CPACK_RPM_SPEC_MORE_DEFINE "%define __jar_repack %{nil}")`

to your CMakeLists.txt

---

<div class="post-metadata">

### Author: ![dabitz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/f475e1/32.png) [@dabitz](https://discourse.cmake.org/u/dabitz)
#### Post date: [September 24, 2024, 3:28pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/6 "2024-09-24T15:28:19Z")

</div>

Thank you very much, this was the part I was missing. Now I don’t have a checksum missmatch anymore.  
Excuse my lack of knowlege here, was relativly new to rpm packaging.

Issure can be closed.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [July 19, 2025, 2:39pm UTC](https://discourse.cmake.org/t/cpack-rpm-prebuild-jar-file-changes-checksum/11110/7 "2025-07-19T14:39:07Z")

</div>

> [@dabitz](#):
>
> Issure can be closed.

You can mark Eric’s post as a solution.
