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

error on matlab 2017a, ubunu #967

Open
sjsy opened this issue Apr 23, 2017 · 6 comments
Open

error on matlab 2017a, ubunu #967

sjsy opened this issue Apr 23, 2017 · 6 comments

Comments

@sjsy
Copy link

sjsy commented Apr 23, 2017

Hi!
System configuration:

  • OS: Ubuntu 16.04
  • Matlab: 20017a
  • gcc version: 5.4.0

MatConvNet error:

>> cnn_mnist_experiments

parameter memory| 2MB (4.3e+05 parameters)|
data memory|14MB (for batch size 100)|
... (table omitted)
train: epoch 01: 1/600:Invalid MEX-file '/home/user/Code/matlab/matconvnet-1.0-beta24/matlab/mex/vl_nnconv.mexa64':
Missing symbol 'ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4swapERS4' required by
'/home/user/Code/matlab/matconvnet-1.0-beta24/matlab/mex/vl_nnconv.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm' required by
'/home/user/Code/matlab/matconvnet-1.0-beta24/matlab/mex/vl_nnconv.mexa64'
Missing symbol 'ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_assignERKS4' required by
'/home/user/Code/matlab/matconvnet-1.0-beta24/matlab/mex/vl_nnconv.mexa64'
Missing symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm' required by
'/home/user/Code/matlab/matconvnet-1.0-beta24/matlab/mex/vl_nnconv.mexa64'.

Error in vl_simplenn (line 300)
res(i+1).x = vl_nnconv(res(i).x, l.weights{1}, l.weights{2}, ...

Error in cnn_train>processEpoch (line 350)
res = vl_simplenn(net, im, dzdy, res, ...

Error in cnn_train (line 150)
[net, state] = processEpoch(net, state, params, 'train') ;

Error in cnn_mnist (line 54)
[net, info] = trainfn(net, imdb, getBatch(opts), ...

Error in cnn_mnist_experiments (line 4)
[net_bn, info_bn] = cnn_mnist(...

Any help?
Thanks.

@daa233
Copy link

daa233 commented Apr 29, 2017

I had the same problem with ubuntu 16.04, matlab 2017a, g++/gcc 5.4 and without GPU. Refering to this: #937, I added the following content in ~/.bashrc and fixed the problem.

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libprotobuf.so.9

By the way, don't forget to execute source ~/.bashrc in the terminal to make the changes work immediately.

@agpoyraz
Copy link

Gcc 5.4 is not supported for compiling(vl_nncompilenn) for matlab 2017a. You have to use 4.9 .. version gcc

@ankitkp4056
Copy link

ankitkp4056 commented May 30, 2017

Problem

Ubuntu 16.04 has [g++/gcc-5] as the default compiler but "Matlab 2017a" supports upto [g++/gcc - 4.9 ] only.

Solution-1

You could change your ~/.bashrc file to make [g++/gcc-4.9] as your default compiler.
simply follow the steps mentioned by DAA233 .

but this is not a very wise choice as some day, some other program just might not be compatible with [g++/gcc-4.9] and you will end up juggling the contents of your ~/.bashrc file.

Solution-2

You could set priority to use [g++/gcc-4.9] before [g++/gcc-5] .

Follow these steps:

--> Make sure gcc-4.9 and g++-4.9 are installed.
~$ sudo apt-get install gcc-4.9 g++-4.9

--> Set "priority=100" for gcc-4.9 and "priority=50" for gcc-5.
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 100
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5.0 50

--> Set "priority=100" for g++-4.9 and "priority=50" for g++-5.
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 100
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5.0 50

--> Verify the priority settings using:
~$ update-alternatives --query gcc

Name: gcc
Link: /usr/bin/gcc
Status: auto
Best: /usr/bin/gcc-4.9
Value: /usr/bin/gcc-4.9

Alternative: /usr/bin/gcc-4.9
Priority: 100

Alternative: /usr/bin/gcc-5
Priority: 50

~$ update-alternatives --query g++

Name: g++
Link: /usr/bin/g++
Status: auto
Best: /usr/bin/g++-4.9
Value: /usr/bin/g++-4.9

Alternative: /usr/bin/g++-4.9
Priority: 100

Alternative: /usr/bin/g++-5
Priority: 50

Make sure you have your compilers in /usr/bin/ directory.
PS: You will need to recompile matconvnet after this .

EDIT: "corrected command for g++" (...thanks Haini)

@Haini
Copy link

Haini commented Jun 21, 2017

For g++ alternatives one should change the compiler names from

--> Set "priority=100" for g++-4.9 and "priority=50" for g++-5.
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/g++-4.9 100
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/g++-5.0 50

to
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 100
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5.0 50

At least that would make sense, as we later query for g++ too.
As a sidenote: On Ubuntu the path for the compiler version 5.0 is just /usr/bin/g++-5.

@ankitkp4056
Copy link

Thanks Haini...I made the changes.

@mcimpoi
Copy link

mcimpoi commented Nov 12, 2017

Following matconvnet documentation setting up the mex compiler seems to fix the problem:
mex -setup C++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants