Chinaunix首页 | 论坛 | 博客
  • 博客访问: 525163
  • 博文数量: 80
  • 博客积分: 1496
  • 博客等级: 上尉
  • 技术积分: 1292
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-18 11:24
个人简介

IT码农一个~

文章分类

全部博文(80)

文章存档

2020年(3)

2019年(7)

2017年(1)

2016年(2)

2015年(2)

2014年(26)

2013年(26)

2012年(2)

2011年(1)

2010年(1)

2008年(9)

我的朋友

分类: LINUX

2015-11-21 15:14:44

1. 编译安装 




2. 导出LD_LIBRARY_PATH 是非常必要的, 不然很多时候link会出现找不到 GLIBCXX 3.4 这种错误。

3. gcc 5.1 以后 使用了双重标准的ABI, 也就是引入了新的ABI, 详见


In the GCC 5.1 release libstdc++ introduced a new library ABI that includes new implementations of std::string and std::list.
These changes were necessary to conform to the 2011 C++ standard which forbids Copy-On-Write strings and requires lists to keep track of their size.


重新实现了string 和 list, 主要是为了c11 标准的禁止写时复制和需要lists跟踪自身size大小,提供了 O(1) 的size函数。

正常情况下 ,可以通过在include标准库文件之前,设置宏 _GLIBCXX_USE_CXX11_ABI 为0来禁止新的ABI, 此ABI不受 -std=xxx 的影响。

但是我们在使用之前版本编译的第三方库的时候,可能会出现未定义的错误, 比如我在用gcc 5.2 开发工程的时候,
链接了一个gcc 4.4 编译的protobuf, 然后就出现了一堆未定义的错误。这时候就需要将protobuf 用新的gcc 5.2 再编译一遍,就可以了。
否则需要 将全部工程都使用旧的ABI。

Troubleshooting

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.


 

refer:



阅读(2033) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~