[cmake-developers] Introduction and volunteering for the Matlab package

Brad King brad.king at kitware.com
Thu Oct 16 10:28:26 EDT 2014


On 10/13/2014 02:23 PM, Raffi Enficiaud wrote:
> I had a hard time making some stuff compile again with Matlab under Linux.
> The fact is that Matlab is shipped with its own version of libC, libhdf5,
> libboost etc, and sometimes the filenames are the same (eg. hdf5, or libc)
> but the subminor versions are not. If I understand properly, the fact that
> the filenames are the same prevents the dynamic loader of Linux to load the
> files that are referred by the mex file in their respective rpath (there
> is only one libhdf51.8.2.so in the matlab process).

It's the SONAME that matters for the dynamic loader to find the libraries
at runtime.  It is a string copied into the dependents and used by the
dynamic loader to find the matching file at runtime.

> Beside that, the
> symbols also may clash: I had an implementation with a dynamic loader under
> linux, but yet the boost symbols of my mex files were not loaded because
> same symbols were already there in the process.
> I found a technical solution to this on Linux:
> - the use of -Wl,--exclude-libs,ALL for the linker.

According to "man ld" that option is only available on specific systems
(i386 PE).  As you pointed out it is not available on OS X.

I think the only reliable way to do this is to make sure your plugins
are built against the same libraries as Matlab, or to mangle the
symbols in your dependencies so they don't conflict with Matlab.

This is outside the scope of what I think the FindMatlab module can
achieve, so it will have to be left to the application author.
For now please leave out the REDUCE_VISIBILITY option.  I think
functionality like that, if provided by CMake, should be a more
general feature not specific to FindMatlab.

> I am using this FindMatlab in two projects now, under OSX 10.9,
> Win7 Visual2013 and Ubuntu12.04.

Great.  In order to keep the module working, we will also need tests
for it.  Please look at adding to the Tests/ directory a case for
using this module.  The test case can be something we enable with
some explicit option.  Then you can run a nightly build of CMake on
a machine of each platform with Matlab installed and enable the test.
Ideally you would have one for Windows, OS X, and Linux, at least.
Without regular testing the functionality is bound to regress as
changes are made to CMake.

Thanks,
-Brad



More information about the cmake-developers mailing list