Mir

Code review comment for lp:~raof/mir/probe-client-drivers

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> Set MIR_CLIENT_PLATFORM_PATH=$(pwd)/lib/client-modules and it'll work uninstalled.

Note that it's not just the examples but also the tests that need this.

This is bad in two ways:

1. It's more complicated to run executables from inside the build dir.
2. Forgetting to set the proper path may lead to platform libraries from the system being used inadvertently, instead of the expected ones from inside the build dir.

Until now, executing anything from inside the build dir was guaranteed to prefer code from that directory (due to cmake setting RPATH). This setup has served us well and I think we should keep it, even if doing so involves some hackery.

One way would be to search for platform libs in all the places the dynamic linker would look for, but unfortunately there doesn't seem to be a way to access the shared library search paths directly.

Another way would be to take advantage of the RPATH setting, for example:

1. Create a mir/libmirtestconfig.so which exports symbols/functions to get the test platform search path
2. Build it in build/lib/, but don't install it.
3. When figuring out where to search for the platform libs ([1]), try to load the mir/libmirtestconfig.so library and get the test path.
  3.1. In case of an executable/library from the build dir, mir/libmirtestconfig.so will be found (due to RPATH) and the test values will be used.
  3.2. In case of an installed executable/library no RPATH is present and mir/libmirtestconfig.so will not be found.

[1] In mcl::DefaultConnectionConfiguration::the_client_platform_factory()

review: Needs Fixing

« Back to merge proposal