<div dir="ltr">Hi Miroslav,<div><br></div><div>Do you need something very specific that you need a custom spec file?</div><div>If this is not the case you should try to let CPackRPM generate the spec file for you.</div><div><br></div><div>This "USER spec file" feature was designed (quite a long time ago) when CPackRPM was lacking some features that came in after that.</div><div>It was a debug & developer feature as well in order to ease CPackRPM evolution.</div><div>This was made public in order to be able to "unblock" user before they get the awaited feature in next CPackRPM release.</div><div>The USER spec file cannot be as rich as a "standard RPM spec file" there is some restriction in what you can write in it.</div><div><br></div><div>In any case you can try to switch on CPackRPM debug output:</div><div>cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM<br></div><div><br></div><div>You should be able to get more detail about the failure.</div><div>In this mode CPack RPM will tell you where is the log/err file you can inspect to know more.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">Le mar. 31 juil. 2018 à 14:49, Miroslav Kubiczek <<a href="mailto:miroslav.kubiczek@gmail.com">miroslav.kubiczek@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>yes, there are install commands, one of CMakeLists.txt content:<br><br>install(DIRECTORY ${PROJECT_SOURCE_DIR}/api/rest DESTINATION include)<br>install(TARGETS Rest DESTINATION lib)<br><br></div>I can see these files after running the 'make package':<br><span style="font-family:monospace,monospace">$ find ./_CPack_Packages/Linux/<br>./_CPack_Packages/Linux/<br>./_CPack_Packages/Linux/RPM<br>./_CPack_Packages/Linux/RPM/SOURCES<br>./_CPack_Packages/Linux/RPM/rpmbuildXXX-common-cpp-libs.err<br>./_CPack_Packages/Linux/RPM/tmp<br>./_CPack_Packages/Linux/RPM/rpmbuilXXX-common-cpp-libs.out<br>./_CPack_Packages/Linux/RPM/BUILDROOT<br>./_CPack_Packages/Linux/RPM/SRPMS<br>./_CPack_Packages/Linux/RPM/BUILD<br>./_CPack_Packages/Linux/RPM/SPECS<br>./_CPack_Packages/Linux/RPM/SPECS/XXX-common-cpp-libs.spec<br>./_CPack_Packages/Linux/RPM/RPMS<br>./_CPack_Packages/Linux/RPM/XXX-common-cpp-libs-7.0.0-1.x86_64.rpm<br></span><br></div>I'm generating the spec file from a template by:<br><div>configure_file("${CMAKE_CURRENT_SOURCE_DIR}/rpm/<a href="http://xxx-common-cpp-libs.spec.in" target="_blank">xxx-common-cpp-libs.spec.in</a>" "${CMAKE_CURRENT_BINARY_DIR}/xxx-common-cpp-libs.spec" @ONLY IMMEDIATE)</div><div><br></div><div>The genereated spec file looks like this:</div><div><br></div><div><span style="font-family:monospace,monospace">Buildroot: /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM/xxx-common-cpp-libs-7.0.0-1.x86_64<br>Summary: xxx common cpp libs<br>Name: xxx-common-cpp-libs<br>Version: 7.0.0<br>Release: 1<br>License: Proprietary<br>Group: Development/Tools/Other<br>Vendor: xxx<br>Prefix: /usr/local<br> <br>%define _rpmdir /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM<br>%define _rpmfilename xxx-common-cpp-libs-7.0.0-1.x86_64.rpm<br>%define _unpackaged_files_terminate_build 0<br>%define _topdir /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM<br> <br>%description<br>...<br> <br># This is a shortcutted spec file generated by CMake RPM generator<br># we skip _install step because CPack does that for us.<br># We do only save CPack installed tree in _prepr<br># and then restore it in build.<br>%prep<br>mv $RPM_BUILD_ROOT /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM/tmpBBroot<br> <br>%install<br>if [ -e $RPM_BUILD_ROOT ];<br>then<br> rm -Rf $RPM_BUILD_ROOT<br>fi<br>mv "/data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM/tmpBBroot" $RPM_BUILD_ROOT<br> <br>%files<br>%defattr(-,root,root,-)<br>/usr/local/lib/*<br>/usr/local/include/*<br> <br></span></div><div><EOF><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 31, 2018 at 2:30 PM, Craig Scott <span dir="ltr"><<a href="mailto:craig.scott@crascit.com" target="_blank">craig.scott@crascit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><span><br><div class="gmail_quote">On Tue, Jul 31, 2018 at 9:56 PM, Miroslav Kubiczek <span dir="ltr"><<a href="mailto:miroslav.kubiczek@gmail.com" target="_blank">miroslav.kubiczek@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi All,</div><div><br></div><div>I'm running cmake 3.10.1 and have this issue:<br><br>$ make package<br>[ 50%] Built target Rest<br>[100%] Built target UT_RestLibrary<br>Run CPack packaging tool...<br>CPack: Create package using RPM<br>CPack: Install projects<br>CPack: - Run preinstall target for: XXXCommonCppLibrary<br>CPack: - Install project: XXXCommonCppLibrary<br>CPack: Create package<br>CPackRPM: Will use USER specified spec file: /data/git/common-cpp-libs/build/XXX-common-cpp-libs.spec<br>CMake Error at /usr/local/cmake-3.10.1-Linux-x86_64/share/cmake-3.10/Modules/CPackRPM.cmake:2703 (message):<br> RPM package was not generated!<br> /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM<br>Call Stack (most recent call first):<br> /usr/local/cmake-3.10.1-Linux-x86_64/share/cmake-3.10/Modules/CPackRPM.cmake:2774 (cpack_rpm_generate_package)<br><br><br>CPack Error: Error while execution CPackRPM.cmake<br>CPack Error: Problem compressing the directory<br>CPack Error: Error when generating package: XXX-common-cpp-libs<br>make: *** [package] Error 1<br></div><div><br></div><div>The rpm file is generated by those strange errors printed, make exits with an error code and jenkins build fails.<br></div><div>Does anyone know how to fix this?<br><br></div></div></blockquote></div><div class="gmail_extra"><br></div></span><div class="gmail_extra">A few things to check:</div><div class="gmail_extra"><br></div><ul><li>Have you given any install() commands in your project? The message above seems to be suggesting nothing was installed.<br></li><li>Are you overriding the .spec file rather than using the one CMake/CPack creates for you? If so, can you indicate why and maybe check its contents. Less likely this is the main issue, but worth covering anyway.</li></ul><span class="m_492997127245032931HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_492997127245032931m_5533403591294707579gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>New book released: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div>
</font></span></div></div>
</blockquote></div><br></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div>