找不到版本GLIBCXX_3.4.11(buildW.mexglx需要) [英] Version GLIBCXX_3.4.11 not found (required by buildW.mexglx)

查看:1211
本文介绍了找不到版本GLIBCXX_3.4.11(buildW.mexglx需要)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过matlab编译c ++ ubuntu项目这里 a>。当我在编译make命令后尝试使用它,我得到以下错误:

 无效的MEX文件
'////fashionista_v0.2/lib/+bsr/buildW.mexglx':
//local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/ libstdc ++。so.6:版本
`GLIBCXX_3.4.11'未找到(
需要// //fashionista_v0.2/lib/+bsr/buildW.mexglx)

我不熟悉这些进程,所以我不能理解几个建议的解决方案,例如 。什么是libstdc ++和GLIBCXX,如何解决这个问题?



我试图使用建议的链接

  export LD_LIBRARY_PATH = $ {prefix} / lib:$ LD_LIBRARY_PATH 

的unix shell知识我不明白什么放在命令中。我已经找到libstdc ++ .a和.so文件,它在gcc文件夹 /usr/lib/gcc/i686-linux-gnu/4.6 ,我尝试以下:

  export LD_LIBRARY_PATH = / usr / lib / gcc / i686-linux-gnu / 4.6:$ LD_LIBRARY_PATH 

但是,我的matlab错误仍然存​​在。我使用Ubuntu 12.04版本与gcc 4.6和matlab r2011a。



编辑:我更新了matlab版本到r2012a的问题仍然是一样的。我也尝试了以下:

  sudo ln -s /usr/lib/cc/i686-linux-gnu/4.6/libstdc++ .so libstdc ++。so.6 

我无法创建文件文件已经存在。 p>

usr / lib / libstdc ++。so.6 |的输出grep GLIBC:

  GLIBCXX_3.4 
GLIBCXX_3.4.1
...
GLIBCXX_3。 4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBC_2.0
GLIBC_2.3
GLIBC_2.4
GLIBC_2.3.4
GLIBC_2.1
GLIBC_2.1.3
GLIBC_2.3.2
GLIBC_2.2
GLIBCXX_DEBUG_MESSAGE_LENGTH

如何确保我已经定义了正确的libstdc ++版本?

Matlab(和一大堆其他商业程序,如Steam,Mathematica等)发布自己的libstdc ++版本:

p>

  / usr / local / MATLAB / R2011a / bin / glnx86 /../../ sys / os / glnx86 / libstdc ++。 .6 

问题是当你启动matlab时,首先加载这个,此版本用于解析所有动态加载程序依赖项。



您使用系统GCC编译并链接到系统的libstdc ++,这是较新的。生成的二进制然后请求某个(较新)版本的符号,并且加载器不会在已经加载的版本(即Matlab的)中找到它们。



有两种方法解决方法:


  1. 删除/重命名Matlab的libstdc ++,并将系统版本符号链接到完全相同的名称:

      sudo rm /usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/libstdc++.so。 6 
    sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/ libstdc ++。so.6


  2. 删除Matlab的版本,让操作系统的加载器获取系统的libstdc ++ :

      sudo rm /usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/ glnx86 / libstdc ++。so.6 


  3. 使用环境变量 LD_PRELOAD 将系统版本的libstdc ++注入到执行环境中,以防止旧的Matlab版本被加载:

      LD_PRELOAD = / usr / lib / x86_64-linux-gnu / libstdc ++ so.6 matlab 


  4. 安装GCC版本Matlab期望并修改Mex建筑选项(或使用 update-alternatives )来使用它,而不是系统的GCC。


请注意,对于1-3,您可能需要混用其他库,例如 libgcc_s



使用新版本的原因是因为在libstdc ++中使用的符号版本化方案因此也有提及版本的详细错误消息)。类似的修复需要对蒸汽进行。 Arch Linux,其中几个系统库Steam使用链接到较新的libstdc ++。



真正的解决方案是Matlab不发运libstdc ++ so,而是使用操作系统提供的版本。


I am trying to compile a c++ ubuntu project via matlab here. When I am trying to use it after the compilation with make command, I am getting the following error:

Invalid MEX-file
'////fashionista_v0.2/lib/+bsr/buildW.mexglx':
 //local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version
`GLIBCXX_3.4.11' not found (required by
 ////fashionista_v0.2/lib/+bsr/buildW.mexglx)

I am not familiar with those processes, so I couldnt understand the several proposed solutions like that. What is exactly libstdc++ and GLIBCXX and how can I solve the problem?

I am trying to fix the problem using the proposed link from nkjt:

export LD_LIBRARY_PATH=${prefix}/lib:$LD_LIBRARY_PATH

However, due to lack of unix shell knowledge I don't understand what to put in the command. I am have locate libstdc++ .a and .so file which is in gcc folder /usr/lib/gcc/i686-linux-gnu/4.6 and I am trying the following:

 export LD_LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/4.6:$LD_LIBRARY_PATH

However, my matlab error still exist. I am using Ubuntu 12.04 version with gcc 4.6 and matlab r2011a.

EDIT: I ve updated the matlab version to r2012a the problem still the same. I also tried the following:

sudo ln -s /usr/lib/cc/i686-linux-gnu/4.6/libstdc++.so libstdc++.so.6 

I got failed to create the file the file already exists.

The output of usr/lib/libstdc++.so.6 | grep GLIBC:

        GLIBCXX_3.4
        GLIBCXX_3.4.1
        ...
        GLIBCXX_3.4.10
        GLIBCXX_3.4.11
        GLIBCXX_3.4.12
        GLIBCXX_3.4.13
        GLIBCXX_3.4.14
        GLIBCXX_3.4.15
        GLIBCXX_3.4.16
        GLIBC_2.0
        GLIBC_2.3
        GLIBC_2.4
        GLIBC_2.3.4
        GLIBC_2.1
        GLIBC_2.1.3
        GLIBC_2.3.2
        GLIBC_2.2
        GLIBCXX_DEBUG_MESSAGE_LENGTH

How can I ensure that I ve defined the right version of libstdc++?

解决方案

Matlab (and a ton of other commercial programs like Steam, Mathematica, etc.) ships its own version of the libstdc++ so:

/usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6

The problem is that when you start matlab, it loads this one first, and since it is loaded, this version is used to resolve all dynamic loader dependencies.

You compiled with your system GCC and linked to your system's libstdc++, which is newer. The resulting binary then requests symbols of a certain (newer) version and the loader does not find them in the already loaded version (i.e. Matlab's).

There are two ways to solve this:

  1. Delete/rename Matlab's libstdc++ so and symlink your system's version to the exact same name:

    sudo rm /usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6
    sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6
    

  2. Delete Matlab's version and let your OS's loader pick up the system's libstdc++:

    sudo rm /usr/local/MATLAB/R2011a/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6
    

  3. Use the environment variable LD_PRELOAD to "inject" the system's version of libstdc++ into the execution environment before anything else, which prevents the old Matlab version to be loaded:

    LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab
    

  4. Install the GCC version Matlab expects and modify the Mex building options (or use update-alternatives) to use that instead of the system's GCC.

Note that for 1-3, you may need to mess with additional libraries like libgcc_s.so, in the same way.

The reason that using the new version works is because of the symbol versioning scheme employed in libstdc++ internally (hence also the detailed error message mentioning the version). A similar "fix" needs to be done for Steam on e.g. Arch Linux, where several system libraries Steam uses are linked to the newer libstdc++.

The real solution is for Matlab not to ship the libstdc++ so and instead use the OS provided version.

这篇关于找不到版本GLIBCXX_3.4.11(buildW.mexglx需要)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆