如何找到共享对象的'_GLIBCXX_USE_CXX11_ABI'的值?

问题描述 投票:0回答:1

我在使用 gcc 4.8.4 构建的 Redhat 7.5 ppc64le 上使用 Anaconda3 v5.3 中的 Python 3.7,它是使用 gcc 7.2 构建的。

我在这个环境中构建了 pyarrow,但是在执行 import pyarrow 时不断收到以下错误。

$ python
Python 3.7.0 (default, Jun 28 2018, 13:02:24)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyarrow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bsyu/files/arrow/python/pyarrow/__init__.py", line 54, in <module>
 from pyarrow.lib import cpu_count, set_cpu_count
 ImportError: /home/bsyu/files/arrow/python/pyarrow/lib.cpython-37m-powerpc64le-linux-gnu.so: undefined symbol: _ZNK5arrow11StructArray14GetFieldByNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

我发现这是链接使用不同版本的 gcc 构建的共享对象时出现的一个非常常见的错误。我尝试使用 gcc 7.2 构建 pyarrow,但最终出现另一个未定义符号错误。

ImportError: /home/bsyu/anaconda3/lib/python3.7/site-packages/pyarrow/libparquet.so.12: undefined symbol: _ZN5boost13match_resultsIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISB_EEEE12maybe_assignERKSF_

我有两个问题:

  1. 当我们在Redhat 7.5上使用Anaconda3 v5.3时,一般建议是什么?使用海湾合作委员会7.2?使用

    -D_GLIBCXX_USE_CXX11_ABI=0
    ?这些未定义的符号错误不会困扰您吗?

  2. 我们如何找到用于共享对象的 _GLIBCXX_USE_CXX11_ABI 的值?我尝试了字符串,但它只显示一堆内容。

$ strings /home/bsyu/anaconda3/lib/python3.7/site-packages/pyarrow/libparquet.so.12.0.0 | grep CXXABI
CXXABI_1.3.11
CXXABI_1.3.2
CXXABI_1.3
CXXABI_1.3.3
CXXABI_1.3.5
python-3.x gcc anaconda
1个回答
0
投票

您可以尝试

strings your.so | grep cxx11
,因为 std::string 在 cxx11 abi 中被破坏为名称
...cxx1112basic_string...
,而在旧版 abi 中为
...s...

但请记住,如果您的程序不使用

std::string
,您可能无法分辨
_GLIBCXX_USE_CXX11_ABI
的值,例如:在旧版和 cxx11 ABI 中,
int myfun(int num)
都被损坏为
_Z5myfuni

© www.soinside.com 2019 - 2024. All rights reserved.