Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
furgo16 opened this issue Feb 11, 2025 · 0 comments

Comments

@furgo16
Copy link
Collaborator

furgo16 commented Feb 11, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant