bbopt / nomad

NOMAD - A blackbox optimization software
https://nomad-4-user-guide.readthedocs.io/
GNU Lesser General Public License v3.0
120 stars 23 forks source link

Invaling MEX-file when running nomadOpt() in MATLAB interface for Linux #159

Open ctribes opened 9 months ago

ctribes commented 9 months ago

On linux, after successfully building the Matlab interface to Nomad (cmake commands) and setting the Matlab path to where the NOMAD libraries are located (Matlab addpath command) we can obtain the following error

image

This can happen even if the version of the gcc version matches the one recommended for the Matlab version at hand.

In the above example, I used gcc 11.4.1 (Red Hat 11.4.1-2) and Matlab 2023b.

ctribes commented 9 months ago

The problem is that when Matlab starts it loads its own version of the libstdc++ library. This can be incompatible with the libstdc++ that the Nomad libraries require. In our case we have use the gcc of the system and the libraries is in /lib64

It is possible to preload some libraries while launching Matlab with the command:

LD_PRELOAD=/lib64/libstdc++.so.6 matlab