title: MATLAB Invalid MEX-file error: missing symbol invalid_argument
body: <p>I have this problem where MATLAB (R2017a) fails loading a certain MEX-file:</p>
  
  <pre><code>Invalid MEX-file '/home/travis/local/lib/acadosMEX.mexa64': 
  
  Missing symbol '_ZdlPvm' required by '/home/travis/local/lib/acadosMEX.mexa64'
  Missing symbol '_ZNSt13runtime_errorC1EPKc' required by '/home/travis/local/lib/acadosMEX.mexa64'
  Missing symbol '_ZNSt16invalid_argumentC1EPKc' required by '/home/travis/local/lib/acadosMEX.mexa64'.
  </code></pre>
  
  <p>Running <code>ldd</code> on that MEX-file gives me </p>
  
  <pre><code>&gt; ldd $HOME/local/lib/acadosMEX.mexa64
  
  linux-vdso.so.1 =&gt;  (0x00007ffe3fab2000)
  libmex.so =&gt; not found
  libmx.so =&gt; not found
  libdl.so.2 =&gt; /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9adb90a000)
  libstdc++.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9adb5f8000)
  libblas.so.3 =&gt; /usr/lib/libblas.so.3 (0x00007f9ad9def000)
  libgfortran.so.3 =&gt; /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f9ad9ac7000)
  libm.so.6 =&gt; /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9ad97c1000)
  libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9ad93f9000)
  libgcc_s.so.1 =&gt; /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9ad91e1000)
  /lib64/ld-linux-x86-64.so.2 (0x000056477b9a3000)
  libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9ad8fc3000)
  libquadmath.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f9ad8d84000)
  </code></pre>
  
  <p>Now if I <code>grep _ZNSt16invalid_argumentC1EPKc</code>:</p>
  
  <pre><code>&gt; nm -D /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep _ZNSt16invalid_argumentC1EPKc
  000000000008b520 T _ZNSt16invalid_argumentC1EPKc
  </code></pre>
  
  <p>so the symbol is definitely there; thus I set my <code>LD_LIBRARY_PATH</code> to point to that directory, i.e. <code>/usr/lib/x86_64-linux-gnu/</code> (this should not be necessary, right?). </p>
  
  <p>I should also say that I try all of this with <code>g++-5</code> (<code>g++-6</code> gives same error), but with <code>g++-4.9</code> it works as required.</p>
  
  <p>Is all of this the cause that MATLAB does not support <code>g++&gt;=5</code> <a href="https://www.mathworks.com/support/compilers.html" rel="nofollow noreferrer">(link)</a>? Or is there still some way of making it work?</p>