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

Include GNUInstallDirs to set CMAKE_INSTALL_LIBDIR for MacOS builds #62

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

jmcarcell
Copy link
Contributor

@jmcarcell jmcarcell commented Jan 13, 2025

The issue is that when building on MacOS, the installation rpath is always set to @loader_path/.. which causes the lookup to look in <install-prefix>/lib/.. and this doesn't work. The default path is related to CMAKE_INSTALL_LIBDIR, so by including GNUInstallDirs CMAKE_INSTALL_LIBDIR gets set to lib and then the rpath becomes @loader_path/../lib which works.

Before

$ otool -l libMarlin.dylib | grep -A2 RPATH
...
          cmd LC_RPATH
      cmdsize 32
         path @loader_path/../ (offset 12)

After

$ otool -l libgear.dylib | grep -A2 RPATH
...
          cmd LC_RPATH
      cmdsize 32
         path @loader_path/../lib (offset 12)

BEGINRELEASENOTES

  • Include GNUInstallDirs to set CMAKE_INSTALL_LIBDIR so that the default rpath is correct in MacOS and can be used in downstream projects, like in k4MarlinWrapper

ENDRELEASENOTES

I tried adding Key4hepConfig.cmake but that didn't change anything. I wonder if passing libraries by full paths instead of cmake targets is the cause since I haven't seen this issue for other packages.

With iLCSoft/GEAR#14 I was able to build k4MarlinWrapper on MacOS.

@tmadlener
Copy link
Contributor

Does this change anything for linux builds?

@jmcarcell
Copy link
Contributor Author

The files are installed to the same places. I only saw that for rpaths before there was this path:

$ORIGIN/../lib64

and now it is

$ORIGIN/../lib

I think this should be harmless since libraries are installed to lib so since we currently have the path with lib64 with libs installed in lib it's probably not doing anything.

@tmadlener
Copy link
Contributor

Thanks for checking. If the installation is unchanged and working, this can go in.

@tmadlener tmadlener merged commit d8420db into iLCSoft:master Jan 13, 2025
6 checks passed
@tmadlener
Copy link
Contributor

new tag as well?

@jmcarcell
Copy link
Contributor Author

Yes please. I'm not sure if everything will be OK but at least we'll have tags for a buildable stack on MacOS (on the LCG stacks)

@tmadlener
Copy link
Contributor

Done: https://github.com/iLCSoft/Marlin/releases/tag/v01-19-04
Also for GEAR: https://github.com/iLCSoft/GEAR/releases/tag/v01-09-04

@jmcarcell
Copy link
Contributor Author

Thanks! 😃

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

Successfully merging this pull request may close these issues.

2 participants