Skip to content

CMake warning: files in some directories may conflict with libraries in implicit directories #160

@furgo16

Description

@furgo16

Parent issue: #161

The snap CMake build generates a number of these warnings:

CMake Warning at src/Main/CMakeLists.txt:47 (add_executable):
  Cannot generate a safe runtime search path for target FreeCADMain because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libGL.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /snap/kde-qt5-core22-sdk/current/usr/lib/x86_64-linux-gnu
    runtime library [libEGL.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /snap/kde-qt5-core22-sdk/current/usr/lib/x86_64-linux-gnu

  Some of these libraries may not be found correctly.

Impact

  • Clogging log output (~65 warnings)
  • Does not seem to otherwise affect the build or the app at runtime. However, CMake cannot guarantee that at runtime the loader will find the correct library
  • Fixing this will probably fix the "unused library" linter warnings from snapcraft at the end of the build

Cause

We need to include the kde-qt5-core22-sdk snap at build time because it has all of the Qt libraries and their CMake files. It also contains build dependencies that are already being installed by the freecad part in snapcraft.yaml. CMake sees those duplicate build dependencies (libraries) and issues a warning.

Solution

A possible way to sort this might be to add a script line in the freecad part's override-build step to remove the duplicates. E.g.

# This is untested
for snap in "kde-qt5-core22-sdk"; do  # List all content-snaps you're using here
   cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_BUILD/{}" "$CRAFT_BUILD/usr/{}" \;
done

This effectively gets a list of potential duplicates by listing the contents of the kde-qt5-core22-sdk snap, walking through that list and removing each item from the build folder before starting the build.

Reference

  1. https://stackoverflow.com/questions/22536567/cmake-cannot-resolve-runtime-directory-path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions