title: Matcaffe on Ubuntu 16.04
body: <p>I have been trying to compile Matcaffe in Ubuntu 16.04. I could successfully compile caffe and pycaffe (using gcc 5). However since Ubuntu 16.04 comes with gcc 5, and MATLAB  R2016b is compatible with gcc 4.9, I got following warning during compilation (using <em>make matcafee</em>):</p>
  
  <blockquote>
    <p>MEX matlab/+caffe/private/caffe_.cpp 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:
    <a href="http://www.mathworks.com/support/compilers/current_release" rel="nofollow">http://www.mathworks.com/support/compilers/current_release</a>.  MEX
    completed successfully.</p>
  </blockquote>
  
  <p>Even though the MEX file is created, I can not use it from MATLAB because it does not recognize them.</p>
  
  <p>To resolve this issue, I installed the gcc 4.9 and g++ 4.9 and updated the symbolic links to use them. When I try to compile matcaffe, I get the following error message: </p>
  
  <blockquote>
    <p>MEX matlab/+caffe/private/caffe_.cpp Building with 'g++'.
    /tmp/mex_286607035953408_13265/caffe_.o: In function
    <code>net_copy_from(int, mxArray_tag**, int, mxArray_tag const**)':
    caffe_.cpp:(.text+0x167d): undefined reference to
    </code>caffe::Net::CopyTrainedLayersFrom(std::string)'
    /tmp/mex_286607035953408_13265/caffe_.o: In function <code>get_net(int,
    mxArray_tag**, int, mxArray_tag const**)': caffe_.cpp:(.text+0x182b):
    undefined reference to</code>caffe::Net::Net(std::string const&amp;,
    caffe::Phase, int, std::vector > const*, caffe::Net const*)'
    /tmp/mex_286607035953408_13265/caffe_.o: In function <code>get_solver(int,
    mxArray_tag**, int, mxArray_tag const**)': caffe_.cpp:(.text+0x343f):
    undefined reference to
    </code>caffe::ReadSolverParamsFromTextFileOrDie(std::string const&amp;,
    caffe::SolverParameter*)' /tmp/mex_286607035953408_13265/caffe_.o: In
    function <code>std::string* google::MakeCheckOpString&lt;int, int&gt;(int const&amp;,
    int const&amp;, char const*)':
    caffe_.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x42):
    undefined reference to
    </code>google::base::CheckOpMessageBuilder::NewString()'
    /tmp/mex_286607035953408_13265/caffe_.o: In function <code>std::string*
    google::MakeCheckOpString&lt;unsigned long, int&gt;(unsigned long const&amp;,
    int const&amp;, char const*)':
    caffe_.cpp:(.text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc]+0x42):
    undefined reference to
    </code>google::base::CheckOpMessageBuilder::NewString()' collect2: error: ld
    returned 1 exit status</p>
    
    <p>Makefile:511: recipe for target 'matlab/+caffe/private/caffe_.mexa64'
    failed make: *** [matlab/+caffe/private/caffe_.mexa64] Error 255</p>
  </blockquote>
  
  <p>Has anyone successfully compiled Matcaffe on Ubuntu 16.04? 
  I also tried the same procedure with MATLAB R2014b and gcc 4.7 but without any success. </p>