在我们的项目中,我们使用在其实现中非常紧密地使用libc ++的库.当我们添加Google Maps SDK时,我们遇到了链接错误:
Undefined symbols for architecture i386:
"std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
"std::string::_Rep::_S_empty_rep_storage", referenced from:
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in …Run Code Online (Sandbox Code Playgroud) 所以我一直在尝试安装一个名为igraph. 最后,当它尝试加载包时,出现以下错误:
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /tools/R/2.15.2/lib64/R/library/igraph/libs/igraph.so)
Run Code Online (Sandbox Code Playgroud)
对我来说,这个错误意味着libstdc++.so.6. 但是,我没有使用该文件。快速浏览一下我的 LD_LIBRARY_PATH:
echo $LD_LIBRARY_PATH
/tools/gcc/4.7.0/lib64
Run Code Online (Sandbox Code Playgroud)
在该目录中有一个名为 libstdc++.so.6 的文件,以下显示 GLIBCXX_3.4.15 实际上存在:
strings /tools/gcc/4.7.0/lib64/libstdc++.so.6 | grep GLIB
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
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
GLIBCXX_3.4.17
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
Run Code Online (Sandbox Code Playgroud)
我不明白为什么 R 很顽固,不使用 gcc 目录下的文件,并不断尝试引用 /user/lib64 目录。有没有人有想法?
让 clang++ 使用 GCC 的 libstdc++ ( -stdlib=stdc++)是很容易的,但是我该如何做相反的事情呢?在 OS X Mavericks 上,c++ 系统库是 libc++,这意味着基本上不能使用 libstdc++(如果你与其他 c++ 库如已经用 libc++ 编译的 boost 混合)。所以,粗略地说,这意味着 G++ 不可用......除非我可以要求它使用 libc++ 而不是 libstdc++。
谢谢。
我正在使用以下脚本g++-libc++在带有 MacPorts 的 Mac OS X 上在 libc++ 之上运行 g++(因此-mp名称。
#! /bin/sh
clangxx=clang++-mp-3.5
gxx=g++-mp-4.9
libcxx_includes=$($clangxx -print-search-dirs |
perl -ne 's{^libraries: =(.*)}{$1/../../../} && print')
exec $gxx -std=c++11 \
-isystem ${libcxx_includes}/include/c++/v1 \
-nostdinc++ -nodefaultlibs \
-lc -lc++ -lc++abi -lgcc_s.10.5 \
-Wl,-no_compact_unwind \
"$@"
Run Code Online (Sandbox Code Playgroud) 我很难配置iOS项目,该项目使用与gcc使用的旧libstdc ++链接的静态库.该库是32位和64位.
有6个库(例如libssl.a)是32位的,必须更新.如果我从源代码编译这些库,它们将自动与libc ++链接,这将导致我的链接器抱怨.
因此,这是我的问题:
1)有没有办法让项目中的单个静态库使用libstdc ++,让其他人使用libc ++?
2)如何从源代码编译库(如libcrypto和libssh)并强制它们使用旧的libstdc ++标准库?
3)这个烂摊子还有其他方法吗?
宏__GLIBCXX__包含libstdc ++版本的时间戳,例如,来自gcc文档(https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html)
__GLIBCXX__压缩ISO日期格式的libstdc ++当前版本,为无符号长整数。有关特定版本的特定宏的价值的详细信息,请查阅ABI政策和准则附录。
我正在寻找自4.9.0版本以来的所有版本的值(包括4.8.x等较小版本的版本)。
libstdc ++的文档似乎没有提供此信息(它仅提供gcc 4.7.0之前的日期)。
在哪里可以找到的值__GLIBCXX__?有人有吗?
ABI政策和准则附录(https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html)表示
库预定义宏的增量增加。对于3.4.0之前的版本,宏为GLIBCPP。对于更高版本,它是GLIBCXX。(libstdc ++项目在整个源代码中从CPP慷慨地更改为CXX,以允许“ C”预处理器使用CPP宏命名空间。)这些宏定义为库的发布日期,采用压缩ISO日期格式,为无符号长整数。 。
但随后最多只能提供GCC 4.7.0之前的宏值。仍在此处列出特定GCC发布的日期:
https://gcc.gnu.org/releases.html
但是例如,对于发布日期为“ 2014年7月16日”的GCC 4.9.1,ISO日期格式为20140716,其值为__GLIBCXX__20140617(注意已更改7和6)。
我在 RHEL6 和 RHEL7 上安装了 gcc 5.2.1,看起来 _GLIBCXX_USE_CXX11_ABI 被禁用了。即使我手动运行它也不起作用-D_GLIBCXX_USE_CXX11_ABI=1 -std=c++14。这意味着我不会获得小字符串优化功能。例如,以下代码的输出始终为 8 和“micro not set”。对于 SSO,如果我们查看代码 bits/basic_string.h,std::string 的大小应至少为 16。有什么解决办法吗?
#include <string>
#include <iostream>
int main()
{
std::cout << sizeof(std::string) << std::endl;
#if _GLIBCXX_USE_CXX11_ABI
std::cout << "macro set" << std::endl;
#else
std::cout << "macro not set" << std::endl;
#endif
}
Run Code Online (Sandbox Code Playgroud) 最近,我在其动态部分(readelf -d)中看到了libstdc ++和libc ++的C++程序列表.
我很困惑,因为一个来自GNU,另一个来自LLVM,它们都是STL的实现.那么一个程序如何链接呢?那是什么意思?
它如何解决std::string链接时提供的符号(例如)?
我正在尝试使用机器学习库在debian服务器上部署一个Flask应用程序,到目前为止,我使用大多数 ML 库进行了管理,但是由于TensorFlow,我对它进行了大量研究,但没有对我有用的解决方案。
PS:我正在为我的应用程序使用 3.7 python venv
导入错误:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:未找到版本“GLIBCXX_3.4.21”(/flask/wstest/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal 需要) .so) Mar 01 15:32:11 django gunicorn[8803]:无法加载本机 TensorFlow 运行时。
我清楚地错过了GLIBCXX 3.4.21因为strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX节目3.4.20为最新版本。
尝试了这个修复add-apt-repository ppa:ubuntu-toolchain-r/test
给出了这个:
工具链添加尝试的结果
尝试 apt-get 更新,得到这个
W:无法获取http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found
还尝试更新 libgcc 和 libstdc++6,说我有最新版本。
编辑:我怀疑 Debian 8 Jessie 不支持比 3.4.20 更高的 glibcxx 版本。
我有一个项目(此处的代码),我在其中运行基准测试来比较计算点积的不同方法(朴素方法、特征库、SIMD 实现等)的性能。我正在新的 Centos 7.6 VM 上进行测试。我注意到当我使用不同版本的 时libstdc++.so.6,我得到的性能明显不同。
当我启动一个新的 Centos 7.6 实例时,默认的 C++ 标准库是libstdc++.so.6.0.19. 当我运行我的基准测试可执行文件(链接到这个版本的libstdc++)时,输出如下:
Naive Implementation, 1000000 iterations: 1448.74 ns average time
Optimized Implementation, 1000000 iterations: 1094.2 ns average time
AVX2 implementation, 1000000 iterations: 1069.57 ns average time
Eigen Implementation, 1000000 iterations: 1027.21 ns average time
AVX & FMA implementation 1, 1000000 iterations: 1028.68 ns average time
AVX & FMA implementation 2, 1000000 iterations: 1021.26 ns average time
Run Code Online (Sandbox Code Playgroud)
如果我下载libstdc++.so.6.0.26并更改符号链接libstdc++.so.6 …
我正在尝试执行以下操作:
#include <memory>
#include <vector>
#include <queue>
int main() {
std::vector<std::queue<std::unique_ptr<int>>> v;
v.resize(10);
}
Run Code Online (Sandbox Code Playgroud)
但是我在 GCC 10.2 中得到了这个:
$ g++ test.cpp -o test
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/g++-v10/memory:66,
from test.cpp:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/g++-v10/bits/stl_uninitialized.h: In instantiation of '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::_Deque_iterator<std::unique_ptr<int>, const std::unique_ptr<int>&, const std::unique_ptr<int>*>; _ForwardIterator = std::_Deque_iterator<std::unique_ptr<int>, std::unique_ptr<int>&, std::unique_ptr<int>*>]':
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/g++-v10/bits/stl_uninitialized.h:325:37: required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::_Deque_iterator<std::unique_ptr<int>, const std::unique_ptr<int>&, const std::unique_ptr<int>*>; _ForwardIterator = std::_Deque_iterator<std::unique_ptr<int>, std::unique_ptr<int>&, std::unique_ptr<int>*>; _Tp = std::unique_ptr<int>]'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/g++-v10/bits/stl_deque.h:896:36: required from 'std::deque<_Tp, _Alloc>::deque(const …Run Code Online (Sandbox Code Playgroud) libstdc++ ×10
c++ ×5
libc++ ×4
gcc ×3
ios ×2
clang++ ×1
compiler-bug ×1
debian ×1
devtoolset ×1
g++ ×1
linux ×1
optimization ×1
python ×1
r ×1
rhel6 ×1
rhel7 ×1
tensorflow ×1
xcode ×1