Skip to content

Conversation

bredelings
Copy link
Contributor

@bredelings bredelings commented Aug 23, 2025

This patch is semi-analogous to Mac line:

        # Seems necessary from macOS 10.15
        set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

It contains two parts.

  1. First, the RPATH of the installed libhmsbeagle.so is set to $ORIGIN so that it looks for plugins in the same directory as itself. The RPATH is searched before LD_LIBRARY_PATH.

The benefit of this is that if there is a different beagle installation (in /usr/local/ for example) libhmsbeagle.so will use the plugins in the same directory as itself in preference to the ones in /usr/local.

  1. CMake also has the ability to set the RPATH for libhmsbeagle.so in the build directory before installation. Such RPATHS are used to run executables before installation and are erased during installation.

The benefit of setting RPATH in the build directory is so that when we run the examples (i.e. ./build/examples/hmctest) they will know how to find the plugins.

We need to be searching relative to the location of libhmsbeagle.so

When using libhmsbeagle.so in the build directory, we need to explicitly
search the CPU, GPU, and JNI subdirs.
@bredelings bredelings changed the title Find plugins correctly on linux. Find plugins on linux. Aug 23, 2025
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.

1 participant