CPack failing for MinGW builds since 3.22
Hello,
Our project has the MinGW packaging failing since cmake v3.22.0. It is working fine up to v3.21.4.
It uses CPack with CPACK_GENERATOR=ZIP
. This is a cross-build running on Linux targeting Windows. Compilation and linking work fine, but the packaging step fails at fixup_bundle
in BundleUtilities. The packaging fails only for the MinGW build.
Using cmake v3.22 we are getting errors like these:
CPack: Install projects
CPack: - Run preinstall target for: ja2-stracciatella
CPack: - Install project: ja2-stracciatella []
CMake Error at /usr/local/share/cmake-3.22/Modules/BundleUtilities.cmake:471 (file):
file READ_ELF given FILE
"/home/runner/work/ja2-stracciatella/ja2-stracciatella/ci-build/_CPack_Packages/win64/ZIP/ja2-stracciatella_0.19.0-git+f7dfca6_win-mingw64-cross/ja2.exe"
that is not a valid ELF file.
Call Stack (most recent call first):
/usr/local/share/cmake-3.22/Modules/BundleUtilities.cmake:527 (get_item_rpaths)
/usr/local/share/cmake-3.22/Modules/BundleUtilities.cmake:593 (set_bundle_key_values)
/usr/local/share/cmake-3.22/Modules/BundleUtilities.cmake:934 (get_bundle_keys)
/home/runner/work/ja2-stracciatella/ja2-stracciatella/ci-build/install-dlls-mingw.cmake:104 (fixup_bundle)
/home/runner/work/ja2-stracciatella/ja2-stracciatella/ci-build/cmake_install.cmake:89 (include)
CMake Error at /usr/local/share/cmake-3.22/Modules/BundleUtilities.cmake:471 (file):
...
The project's build config can be found here and also here on GitHub. The packaging works with the exact same config using cmake v3.21.4 (and earlier).
An example of a failed build can be seen here. A successful build with cmake v3.21 is here.
I understand this might not be enough information to pin down the problem, but I do not know much about CMake and I am lost at how to investigate further. I don't see anything suspicious in v3.22 release notes.
Any pointers or help is appreciated. Thank you!