Error ./vpdetection: /gpfs/apps/x86_64-rhel5/matla

2019-07-27 05:08发布

问题:

I am now trying to run some MATLAB code in Linux environment:

  • Linux version is Red Hat Enterprise Linux Server release 5.9 (Tikanga).
  • gcc version is 4.1.2.
  • MALTAB version is R2012b.

The statement in MALTAB that causes the problem is:

[status, result] = system('./vpdetection lines.tmp lines.out');

I got an error as follows:

./vpdetection: /gpfs/apps/x86_64-rhel5/matlab/R2012a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found

I have googled several solutions but they all require editing system files. Since I am running the code on server where I don't have sudo right to edit system files.

Are there any other workarounds that don't need to edit system files?


I have tried ldd command. The result is as follows:

[sxh415@cyberstar vpdetection]$ ldd matlab/vpdetection
matlab/vpdetection: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by matlab/vpdetection)
matlab/vpdetection: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by matlab/vpdetection)
matlab/vpdetection: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by matlab/vpdetection)
    linux-vdso.so.1 =>  (0x00007ffff7ff8000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003845400000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003840400000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003844c00000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003840000000)
    /lib64/ld-linux-x86-64.so.2 (0x000000383fc00000)

回答1:

/gpfs/apps/x86_64-rhel5/matlab/R2012a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found

This error means: libstdc++.so.6 distributed with your version of Matlab is too old, and does not provide version `GLIBCXX_3.4.14'. The matlab version corresponds to gcc-4.5 or earlier, but you have some code that was compiled with gcc-4.6 (or later).

You must arrange for your executable to pick up a newer libstdc++.so.6.

I don't have sudo right to edit system files.

You could copy a sufficiently new version of libstdc++.so.6 to ~/lib64, then
export LD_LIBRARY_PATH=$HOME/lib64.



回答2:

Run ldd on your executable both inside MATLAB and outside on the system shell:

Shell

$ ldd ./vpdetection

MATLAB

>> !ldd ./vpdetection

To solve any dependency conflicts, try using LD_PRELOAD when launching either MATLAB itself or the executable:

$ LD_PRELOAD=/path/to/libstdc++.so matlab

or

>> system('LD_PRELOAD=/path/to/libstdc++.so ./vpdetection lines.tmp lines.out')