Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,823
    • Issues 3,823
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #20691
Closed
Open
Created May 11, 2020 by Bruce Adams@tortoise_74

/usr/lib/.build-id & RPM relocation

Moving from RHEL7 to RHEL8 I note that RPM now include entries in /usr/lib/.build-id (see https://unix.stackexchange.com/questions/411727/what-is-the-purpose-of-usr-lib-build-id-dir and https://fedoraproject.org/wiki/Releases/FeatureBuildId for reference).

In integration tests I install RPMs using a fake DB and relocating them as in:

rpmdb --initdb --dbpath "$WSDIR"/rpmdb
rpm --relocate /opt/foo="$WSDIR"/opt/foo --dbpath "$WSDIR"/rpmdb -i foobar.rpm --nodeps 

The new path mean I must instead use:

rpm --relocate /opt/foo="$WSDIR"/opt/foo --relocate /usr/lib="$WSDIR"/usr/lib --dbpath "$WSDIR"/rpmdb -i foobar.rpm --nodeps 

With cmake, it is not possible to make /usr/lib relocatable unless I explicitly install a dummy file myself. For example:

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/VERSION DESTINATION "/usr/lib" COMPONENT core RENAME "/usr/lib/.dummy/.foobar.core.dummy")
set(CPACK_RPM_CORE_RELOCATION_PATHS "/usr/lib")

Otherwise adding the relocation path is silently ignored.

I suggest the following:

  • On platforms using /usr/lib/.build-id it should be possible to add a relocation for /usr/lib or at least /usr/lib/.build-id without installing an additional file.

  • For variables that are used by cmake an error or warning should be issued if the requested operation cannot be performed. If I add:

    set(CPACK_RPM_CORE_RELOCATION_PATHS "/IDONOTEXIST")

There should be some message like "relocation ignored: no files installed to /IDONOTEXIST"

Also consider:

  • Find a way to disable inclusion of /usr/lib/.build-id in RPMBuild There isn't one by design - see https://bugzilla.redhat.com/show_bug.cgi?id=1724153 but perhaps it could/should be made optional upstream. While this is outside the scope of cmake itself, the cmake maintainers may have useful opinions and a louder voice.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking