Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEX/GCC Setup Problems #770

Open
JoelChev opened this issue Nov 8, 2016 · 11 comments
Open

MEX/GCC Setup Problems #770

JoelChev opened this issue Nov 8, 2016 · 11 comments

Comments

@JoelChev
Copy link

@JoelChev JoelChev commented Nov 8, 2016

Hi all,

I'm trying to setup matconvnet on my local CPU and run the v1_testnn script. During the compile process, I keep getting the following warning:

Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported
with MEX is '4.9.x'. For a list of currently supported compilers see:

I'm running on Ubuntu 16.04, I'm assuming my gcc is too new for installing this toolkit? When I run the v1test_nn script, I get a bunch of these errors:

Error occurred in nnsimplenn[dataType=single,device=cpu]/backPropDepth and it did not run to completion.

---------
Error ID:
---------
'MATLAB:mex:ErrInvalidMEXFile'

--------------
Error Details:
--------------
Invalid MEX-file '/home/joelchev/Documents/CSC2515/project/LRR/matconvnet/matlab/mex/vl_nnconv.mexa64': /usr/local/MATLAB/R2016b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/joelchev/Documents/CSC2515/project/LRR/matconvnet/matlab/mex/vl_nnconv.mexa64).

So again, I'm running into some type of errors with MEX files not being generated properly during compilation. Does anyone have any tips/steps to fix this? Thanks!

@peterpans01

This comment has been minimized.

Copy link

@peterpans01 peterpans01 commented Nov 8, 2016

Followed this issues. I have same problem.

@lenck

This comment has been minimized.

Copy link
Contributor

@lenck lenck commented Nov 11, 2016

Hi, this is old annoying issue with MATLAB shipping with an old version of the libstdc++, even though the compiler tends to use the system, newer version...
Several solutions are proposed e.g. here.

@zchrissirhcz

This comment has been minimized.

Copy link

@zchrissirhcz zchrissirhcz commented Dec 7, 2016

thanks@lenck

Here's my situation, hope it can be useful:

I use ubuntu16.04 with x64 architecture. I installed matlab2016b, with cuda7.5 and cudnn5 installed.
I faced with similar problem and handle it by executing these commands:(for me, default gcc is version 5.4)

cd /usr/local/MATLAB/R2016b/sys/os/glnxa64  #where I installed my matlab
sudo mv libstdc++.so.6.0.20 bak-libstdc++.so.6.0.20
sudo mv libstdc++.so.6 bak-libstdc++.so.6
sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 ./
sudo ln -sf ./libstdc++.so.6.0.21 ./libstdc++.so.6

Then reopen matlab and compile MatConvNet. Still have warning about gcc version but compiling can be done.

@SahilC

This comment has been minimized.

Copy link

@SahilC SahilC commented Feb 14, 2017

Thanks @zchrissirhcz!! This worked for me :)

@Ashutosh1995

This comment has been minimized.

Copy link

@Ashutosh1995 Ashutosh1995 commented Mar 24, 2017

Thanks a lot @zchrissirhcz ....it worked for me too :-)

@pilhoon

This comment has been minimized.

Copy link

@pilhoon pilhoon commented Apr 14, 2017

Thanks a lot @zchrissirhcz !!!!!!!!!!!!

(I just removed four files :
libstdc++.so.6.0.20 libgcc_s.so.1 libgfortran.so.3.0.0 libquadmath.so.0.0.0 in the MATLAB path(usually under /usr/local/MATLAB/).
README.libstdc++file is saying these files are included for only in the event that your distribution does not provide them.
So just removing them(=making MATLAB use system default library) would enough.)

@GeneL64

This comment has been minimized.

Copy link

@GeneL64 GeneL64 commented Apr 21, 2017

Hello all,
Trying to solve a similar problem with gcc incompatibility when running 'make matcaffe' to make a Matlab wrapper for Caffe.

Was trying to follow @zchrissirhcz recommendations. Got:
mv: cannot move 'libstdc++.so.6.0.20' to 'bak-libstdc++.so.6.0.20': Permission denied
The file has the following permissions
-r-xr-xr-x 1 support support 6814982 Jul 22 2016 libstdc++.so.6.0.20
Attempt to change those with 'chmod' failed
chmod: changing permissions of 'libstdc++.so.6.0.20': Operation not permitted

Interesting that after the warning during 'make matcaffe' I seem to be getting a successful compilation anyway:
chmod: changing permissions of 'libstdc++.so.6.0.20': Operation not permitted

However, a subsequent 'make mattest' run throws numerous errors like:
Warning: The following error was caught while executing 'caffe.Net' class destructor:
Error using caffe_
Usage: caffe_('delete_solver', hNet)
Error in caffe.Net/delete (line 72)
caffe_('delete_net', self.hNet_self);
Error in caffe.Net (line 31)
self = caffe.get_net(varargin{:});
Error in caffe.test.test_net (line 39)
self.net = caffe.Net(self.model_file, 'train');

And at the end:
Totals:
7 Passed, 0 Failed, 0 Incomplete.
0.6783 seconds testing time.

1.Are those error result from gcc incompatibility or something else?
2. If '1' is 'yes' how to solve those?

Thanks!!!

@thylacine1975

This comment has been minimized.

Copy link

@thylacine1975 thylacine1975 commented Nov 1, 2017

I needed to extend the advice of @zchrissirhcz to creating a symlink in the /usr/lib/x86_64-linux-gnu directory as well pointing to a .so file without the version suffix. i.e.:

sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 /usr/lib/x86_64-linux-gnu/libstdc++.so

..then all was happy :)

@soulslicer

This comment has been minimized.

Copy link

@soulslicer soulslicer commented Mar 9, 2018

i did the above fix but I get this error:

[100%] Building Matlab interface: /home/ryaadhav/caffe/matlab/+caffe/private/caffe_.mexa64
Building with 'g++'.
Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release.
In file included from /usr/local/include/caffe/common.hpp:19:0,
from /usr/local/include/caffe/blob.hpp:8,
from /usr/local/include/caffe/caffe.hpp:7,
from /home/ryaadhav/caffe/matlab/+caffe/private/caffe_.cpp:18:

@henanjun

This comment has been minimized.

Copy link

@henanjun henanjun commented Apr 23, 2018

Thanks for your useful solution @zchrissirhcz . It works for me.

@ihnorton

This comment has been minimized.

Copy link

@ihnorton ihnorton commented Apr 30, 2018

If you are on CentOS and have root or sudo, you can use these instructions to get a GCC 4.9 toolchain:

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/

(note that only yum install devtoolset-3-toolchain is really necessary -- the other stuff in the full devtoolset-3 package is unrelated Java/IDE libraries)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.