packagingcpack

CPack filelist conflicts with filesystem


I try to package my project written in C++ and using cmake as a build tool. I can create a rpm package but I can not install it. The error message is:

file /usr/local from install of myapp.x86_64 conflicts with file from package filesystem-3.3-3.fc27.x86_64
file /usr/local/include from install of myapp.x86_64 conflicts with file from package filesystem-3.3-3.fc27.x86_64
file /usr/local/bin from install of myapp.x86_64 conflicts with file from package filesystem-3.3-3.fc27.x86_64
file /usr/local/etc from install of myapp.x86_64 conflicts with file from package filesystem-3.3-3.fc27.x86_64

I tried to set CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION in CMakeList.txt but it is not work.

set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/local /usr/local/etc /usr/local/bin /usr/local/include`

Solution

  • I had the same issue on my C++ project, and for that sake, when tried to install the generated RPM on CentOS, yum raises conflict errors with the existing files or directories (/usr/bin dir for example).

    So, after take a look at CPackRPM documentation (I'm using cmake 3.10.2-1 at Debian Testing), I've realized that for CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST option, already exists a default list that already includes: /etc; /etc/init.d /usr; /usr/bin; /usr/include; /usr/lib; /usr/libx32; /usr/lib64; /usr/share; /usr/share/aclocal; /usr/share/doc.

    What I was actually doing was to override with the same options. Not sure if cpack gets lost or something like this, but after REMOVE my own set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) from my CMakeLists.txt and leave it default, worked well.

    I just deleted the build dir, ran cmake again and cpack -G RPM and everything worked fine. Just check the new RPM generated file with rpm -qpl yourpackage.rpm and see if its OK.

    And if you realy need a list of excluded files, try to use the CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION instead.