@FabioBergonti commented on Wed May 18 2022
I tried to install mystica on a linux machine (see documentation).
I ran the autogenerated deps/setup.m
file that configure matlabpath (see documentation)
But when I call a basic casadi function I got an error
>> casadi.SX.sym('x')
Invalid MEX-file '/home/icub/Software/fbergonti/mystica/deps/envs/imorph/mex/casadiMEX.mexa64':
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by
/home/icub/Software/fbergonti/mystica/deps/envs/imorph/mex/casadiMEX.mexa64)
Error in casadi.GenSX.sym (line 432)
[varargout{1:nargout}] = casadiMEX(315, varargin{:});
@FabioBergonti commented on Wed May 18 2022
Here the autogenerated setup.m
% Specify OS-specific locations
if ispc
env_sep = ";";
else
env_sep = ":";
end
% Install prefix (hardcoded at generation time)
pckgs_install_prefix = "/home/icub/Software/fbergonti/mystica/deps/envs/imorph";
install_prefix = "/home/icub/Software/fbergonti/mystica/deps";
mystica_fullpath = "/home/icub/Software/fbergonti/mystica";
% AddPath packages installed with conda
addpath(fullfile(pckgs_install_prefix,"mex"));
% AddPath github repositories
addpath(fullfile(install_prefix,"yamlmatlab"));
% AddPath mystica
addpath(mystica_fullpath);
% Add to the env:"PATH" the directory with the packages installed with conda
setenv("PATH",strcat(fullfile(pckgs_install_prefix,"bin"), env_sep, getenv("PATH")));
@FabioBergonti commented on Wed May 18 2022
@traversaro
Have you ever seen something similar?
@traversaro commented on Wed May 18 2022
It is probably an incompatibility problem between libstdc++ of either:
- MATLAB
- System
- conda-forge
Can you provide more info (operating system, mamba list
, MATLAB version) to simplify the debugging?
@traversaro commented on Wed May 18 2022
Related errors:
@FabioBergonti commented on Thu May 19 2022
Hi @traversaro
Here the requested info
# packages in environment at /home/ironcub/code/fbergonti/mystica/deps/envs/mystica:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
ampl-mp 3.1.0 h2cc385e_1006 conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2022.5.18 ha878542_0 conda-forge
casadi 3.5.5 py310h597d7ca_9 conda-forge
casadi-matlab-bindings 3.5.5.2 h27087fc_53 robotology
ipopt 3.14.6 h630875f_0 conda-forge
ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge
libblas 3.9.0 14_linux64_openblas conda-forge
libcblas 3.9.0 14_linux64_openblas conda-forge
libedit 3.1.20191231 he28a2e2_2 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 12.1.0 h8d9b700_16 conda-forge
libgfortran-ng 12.1.0 h69a702a_16 conda-forge
libgfortran5 12.1.0 hdcd56e2_16 conda-forge
libgomp 12.1.0 h8d9b700_16 conda-forge
libiconv 1.16 h516909a_0 conda-forge
liblapack 3.9.0 14_linux64_openblas conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libopenblas 0.3.20 pthreads_h78a6416_0 conda-forge
libosqp 0.6.2 h9c3ff4c_3 conda-forge
libstdcxx-ng 12.1.0 ha89aaad_16 conda-forge
libuuid 2.32.1 h7f98852_1000 conda-forge
libzlib 1.2.11 h166bdaf_1014 conda-forge
metis 5.1.0 h58526e2_1006 conda-forge
mumps-include 5.2.1 ha770c72_11 conda-forge
mumps-seq 5.2.1 h2104b81_11 conda-forge
ncurses 6.3 h27087fc_1 conda-forge
numpy 1.22.3 py310h4ef5377_2 conda-forge
openssl 3.0.3 h166bdaf_0 conda-forge
pip 22.1 pyhd8ed1ab_0 conda-forge
python 3.10.4 h2660328_0_cpython conda-forge
python_abi 3.10 2_cp310 conda-forge
readline 8.1 h46c0cb4_0 conda-forge
scotch 6.0.9 hb2e6521_2 conda-forge
setuptools 62.3.1 py310hff52083_0 conda-forge
sqlite 3.38.5 h4ff8645_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
tzdata 2022a h191b570_0 conda-forge
unixodbc 2.3.10 h583eb01_0 conda-forge
wheel 0.37.1 pyhd8ed1ab_0 conda-forge
xz 5.2.5 h516909a_1 conda-forge
zlib 1.2.11 h166bdaf_1014 conda-forge
- system:
Ubuntu 20.04.3 LTS
- matlab:
r2020b
@traversaro commented on Thu May 19 2022
So, GLIBCXX_3.4.26
was added in gcc/libstcxx in 2018 : https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/ChangeLog-2018#L1072 and release in GCC 9.1 that was released in May 2019 (see https://gcc.gnu.org/gcc-9/). Apparently casadiMEX.so
requires at least that version, but something is not providing it.
I have a version similar to yours, and I tried to see which version of libstdcxx is not providing it.
The apt version has ~430 symbols with that version:
readelf -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep "GLIBCXX_3.4.26" | wc -l
The conda version has ~431 symbols
(casadi) traversaro@IITICUBLAP257:~/mambaforge/envs/casadi/lib$ readelf -s $CONDA_PREFIX/lib/libstdc++.so.6 | grep "GLIB
CXX_3.4.26" | wc -l
431
The MATLAB vendored version has ~0 symbols:
readelf -s /usr/local/MATLAB/R2020b/sys/os/glnxa64/libstdc++.so.6.0.25 | grep "GLIBCXX_3.4.26" | wc -l
0
So, it is clear that the problem is in the MATLAB vendored version that is not new enough, i.e. the problem usually described in robotology/robotology-superbuild#64 , I think it can be solved with one of this three tricks that are widespread in the lab:
- Install the
matlab-support
package with apt
(sudo apt install matlab-support
, I am not sure this actually works)
- Always launch
matlab
with LD_PRELOAD, i.e. add
alias matlab="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab"
in .bashrc
- Rename
/usr/local/MATLAB/R2020b/sys/os/glnxa64/libstdc++.so.6
to /usr/local/MATLAB/R2020b/sys/os/glnxa64/libstdc++.so.6.back
@FabioBergonti commented on Thu May 19 2022
I tried to run matlab with LD_PRELOAD
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab
and it worked ππ
Thanks @traversaro
@FabioBergonti commented on Thu May 19 2022
I opened a PR in mystica to document this problem #5
Closing this issue
@FabioBergonti commented on Fri May 20 2022
I continued the investigation by installing only casadi via mamba.
mamba create -p casadi
mamba activate ./casadi
mamba install -y -c conda-forge -c robotology casadi-matlab-bindings "libblas=*=*openblas"
matlab
I executed this test with these machines:
iiticubws022
with Ubuntu 20.04.3 LTS
and Matlab R2021a
casadi worked without the need of running matlab with LD_PRELOAD
iiticubws050
with Ubuntu 18.04.6 LTS
and Matlab R2019b
it didn't work even with LD_PRELOAD. I got the same error
>> casadi.SX.sym('x')
Invalid MEX-file '/home/icub/Software/fbergonti/mystica/casadi/mex/casadiMEX.mexa64':
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by
/home/icub/Software/fbergonti/mystica/casadi/mex/casadiMEX.mexa64)
Error in casadi.GenSX.sym (line 432)
[varargout{1:nargout}] = casadiMEX(315, varargin{:});
Here the mamba list
# packages in environment at /home/icub/Software/fbergonti/mystica/casadi:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
ampl-mp 3.1.0 h2cc385e_1006 conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2022.5.18.1 ha878542_0 conda-forge
casadi 3.5.5 py310h597d7ca_9 conda-forge
casadi-matlab-bindings 3.5.5.2 h27087fc_53 robotology
ipopt 3.14.6 h630875f_0 conda-forge
ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge
libblas 3.9.0 14_linux64_openblas conda-forge
libcblas 3.9.0 14_linux64_openblas conda-forge
libedit 3.1.20191231 he28a2e2_2 conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc-ng 12.1.0 h8d9b700_16 conda-forge
libgfortran-ng 12.1.0 h69a702a_16 conda-forge
libgfortran5 12.1.0 hdcd56e2_16 conda-forge
libgomp 12.1.0 h8d9b700_16 conda-forge
libiconv 1.16 h516909a_0 conda-forge
liblapack 3.9.0 14_linux64_openblas conda-forge
libnsl 2.0.0 h7f98852_0 conda-forge
libopenblas 0.3.20 pthreads_h78a6416_0 conda-forge
libosqp 0.6.2 h9c3ff4c_3 conda-forge
libstdcxx-ng 12.1.0 ha89aaad_16 conda-forge
libuuid 2.32.1 h7f98852_1000 conda-forge
libzlib 1.2.11 h166bdaf_1014 conda-forge
metis 5.1.0 h58526e2_1006 conda-forge
mumps-include 5.2.1 ha770c72_11 conda-forge
mumps-seq 5.2.1 h2104b81_11 conda-forge
ncurses 6.3 h27087fc_1 conda-forge
numpy 1.22.3 py310h4ef5377_2 conda-forge
openssl 3.0.3 h166bdaf_0 conda-forge
pip 22.0.4 pyhd8ed1ab_0 conda-forge
python 3.10.4 h2660328_0_cpython conda-forge
python_abi 3.10 2_cp310 conda-forge
readline 8.1 h46c0cb4_0 conda-forge
scotch 6.0.9 hb2e6521_2 conda-forge
setuptools 62.3.2 py310hff52083_0 conda-forge
sqlite 3.38.5 h4ff8645_0 conda-forge
tk 8.6.12 h27826a3_0 conda-forge
tzdata 2022a h191b570_0 conda-forge
unixodbc 2.3.10 h583eb01_0 conda-forge
wheel 0.37.1 pyhd8ed1ab_0 conda-forge
xz 5.2.5 h516909a_1 conda-forge
zlib 1.2.11 h166bdaf_1014 conda-forge
@FabioBergonti commented on Fri May 20 2022
I tried to repeat on iiticubws050
the analysis done by @traversaro before
readelf -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep "GLIBCXX_3.4.26" | wc -l
> 0
Does this mean that GLIBCXX_3.4.26
is not available in the installed library libstdc++.so.6
?
readelf -s $CONDA_PREFIX/lib/libstdc++.so.6 | grep "GLIBCXX_3.4.26" | wc -l
> 431
readelf -s /usr/local/MATLAB/R2019b/sys/os/glnxa64/libstdc++.so.6.0.22 | grep "GLIBCXX_3.4.26" | wc -l
> 0
@traversaro commented on Fri May 20 2022
It seems that iiticubws050
is a Ubuntu 18.04, that so has an older GCC/libstdc++.so.6 . If there you are getting the same error, probably it is better to do the LD_PREALOAD trick with $CONDA_PREFIX/lib/libstdc++.so.6
.
@FabioBergonti commented on Fri May 20 2022
It seems that iiticubws050
is a Ubuntu 18.04
indeed
If there you are getting the same error, probably it is better to do the LD_PREALOAD trick with $CONDA_PREFIX/lib/libstdc++.so.6
Yes! Running Matlab with LD_PRELOAD=$CONDA_PREFIX/lib/libstdc++.so.6 matlab
solved the issue.
Thanks @traversaro