[CMake] Fwd: CPack does not generate a RPM
Domen Vrankar
domen.vrankar at gmail.com
Sun Apr 17 15:21:01 EDT 2016
I've finally had time to look into this.
The problem is that rpm expects a shared library to have execute
permissions - during packaging missing execute permissions are ignored
so dependency is found but once we try to install the package it
figures out that it's missing hence the odd missing dependency error.
To fix this simply set permissions that you want e.g.:
set(LIBRARIES
${LIB}/liblibrary.so
${LIB}/liblibrary.so.5
${LIB}/liblibrary.so.5.6.7)
install(FILES ${LIBRARIES} DESTINATION lib
PERMISSIONS OWNER_EXECUTE # this permission is mandatory or package
installation will fail
)
See the entire list of permissions here:
https://cmake.org/cmake/help/v3.5/command/install.html
I'll try to add some simple checking for such errors in CPack/RPM.
Thanks,
Domen
2016-04-12 10:41 GMT+02:00 Wang, Peng 1. (Nokia - CN/Hangzhou)
<peng.1.wang at nokia.com>:
> Please find the attached file.
> It contains 2 directories,
> cmake_proj: a CMakeLists.txt which packs some existing files(here I add some libraries from glib2, you can edit it to pack other existing libraries), to build it, with below command
> tar zxf rpm_example.tgz
> cd cmake_proj
> mkdir build
> cd build
> cmake ..
> make package
> //then use mc command to check the PROVIDES infor from the generated rpm
>
> rpmbuild: the similar example with the above, build it with below command
> tar zxf rpm_example.tgz
> cd rpmbuild
> vim SPEC/hello.spec //edit the value of _topdir to point to the current absolute path of the current dir and save.
> rpmbuild -bb SPECS/hello.spec
> //then rpm is generated in RPMS directory
>
> In cmake_proj, the option 'CPACK_RPM_PACKAGE_AUTOPROV' is set to 1, while the option 'CPACK_RPM_PACKAGE_AUTOREQ' is set to 0, accordingly, in rpmbuild, the same option value about 'Autoprov' and 'Autoreq' are set, but with cmake, the correct 'PROVIDES' information is not generated.
>
> Thanks for your time again :)
>
> Wang Peng (Rex)
> Seat: 21F
> HZ SE Team
> +86018605811125
>
>
> -----Original Message-----
> From: EXT Kristian [mailto:kristianonline28 at gmail.com]
> Sent: Friday, April 08, 2016 4:28 PM
> To: Wang, Peng 1. (Nokia - CN/Hangzhou) <peng.1.wang at nokia.com>
> Cc: Domen Vrankar <domen.vrankar at gmail.com>; cmake at cmake.org
> Subject: Re: [CMake] Fwd: CPack does not generate a RPM
>
> I think others also may be interested in this. Please send a copy of
> your example ...
>
> 2016-04-08 8:31 GMT+02:00 Wang, Peng 1. (Nokia - CN/Hangzhou)
> <peng.1.wang at nokia.com>:
>> Hi,
>>
>> Sorry guys, I am busy on some prioritized tasks.
>> I've made a simple example, can I send in attachment? Or maybe I shall send the attachment only to you two?
>>
>> Wang Peng (Rex)
>> Seat: 21F
>> HZ SE Team
>> +86018605811125
>>
>> -----Original Message-----
>> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of EXT Kristian
>> Sent: Friday, April 08, 2016 5:16 AM
>> To: Domen Vrankar <domen.vrankar at gmail.com>
>> Cc: cmake at cmake.org
>> Subject: Re: [CMake] Fwd: CPack does not generate a RPM
>>
>> Thank you for your answer. Setting the variable
>> CPACK_RPM_PACKAGE_AUTOREQ to "NO" worked.
>>
>> I also tried to produce a minimal example, which produces such error
>> as the behaviour I described. But I couldn't generate such an example.
>> I do not know currently, under which circumstances this happens :(.
>>
>> My assumptions are the same, that this seems to be a rpm issue.
>>
>> 2016-04-07 19:39 GMT+02:00 Domen Vrankar <domen.vrankar at gmail.com>:
>>>> Let's assume, I have a library, e.g. liblibrary.so.5.6.7 and I have
>>>> two symbolic links, so the result of "ls -l" would look like this
>>>>
>>>> liblibrary.so -> liblibrary.so.0
>>>> liblibrary.so.0 -> liblibrary.so.5.6.7
>>>> liblibrary.so.5.6.7
>>>>
>>>> And let's assume, I have these lines in my CMakeLists.txt:
>>>>
>>>> *******
>>>> set(LIBRARIES
>>>> ${LIB}/liblibrary.so
>>>> ${LIB}/liblibrary.so.0
>>>> ${LIB}/liblibrary.so.5.6.7)
>>>> #...
>>>> install(FILES ${LIBRARIES} DESTINATION lib)
>>>> *******
>>>>
>>>> Now, I call the commands "cmake . && make package" and I get a package
>>>> "project1.1-Linux.rpm". After that, I try to install that package with
>>>> "yum install project1.1-Linux.rpm", I get some strange dependency
>>>> resolution errors, which would look like this
>>>>
>>>> --> Finished Dependency Resolution
>>>> Error: Package: project1.1-1.x86_64 (/project1.1-Linux)
>>>> Requires: liblibrary.so.0()(64bit)
>>>> You could try using --skip-broken to work around the problem
>>>> You could try running: rpm -Va --nofiles --nodigest
>>>
>>> Hi,
>>>
>>> Not certain why that dependency problem occurs - will have to look
>>> into it a bit further but it seems to be rpm issue (somehow it gets
>>> the file dependencies wrong with symlinks to symlinks).
>>>
>>> As a workaround you could disable auto requirements generation by setting:
>>> set(CPACK_RPM_PACKAGE_AUTOREQ "NO")
>>>
>>> Regards,
>>> Domen
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
More information about the CMake
mailing list