Nabla icon indicating copy to clipboard operation
Nabla copied to clipboard

Make sure Shared Library Load order is respected on Linux/POSIX

Open devshgraphicsprogramming opened this issue 2 years ago • 0 comments

Description

On Windows we're forced to use Delay Load DLLs to make sure we try directories in the right order (current config build dir, current config & build install dir, next to EXE, then fallback to system-wide) https://github.com/Devsh-Graphics-Programming/Nabla/blob/master/include/nbl/system/IApplicationFramework.h#L19

But on Linux there exists RPATH https://github.com/Devsh-Graphics-Programming/Nabla/blob/master/include/nbl/system/IApplicationFramework.h#L30

Description of the related problem

I'm not a linux expert so I don't know if:

  1. One can set different RPATHs on a per-library basis
  2. Whether one can have a chain of fallback RPATHS to try before trying /usr/lib or whatever the systemwide dir is
  3. Whether RPATH needs to be a thing on a shared library that uses another (i.e. Nabla loading DXC) or on the very final executable (ELF)

Solution proposal

Find out if RPATH can be leveraged, else find out how to delay load on Linux without manually writing "import library" glue code.

Additional context

This is to enable us to have NBL_BUILD_SHARED across Windows and Linux