未定义的符号:_ZNK6google8protobuf7Message25InitializationErrorStringEv

undefined symbol: _ZNK6google8protobuf7Message25InitializationErrorStringEv

当我尝试导入库时,出现错误:

>>> import reverb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.6/site-packages/reverb/__init__.py", line 27, in <module>
    from reverb import item_selectors as selectors
  File "/home/ubuntu/.local/lib/python3.6/site-packages/reverb/item_selectors.py", line 19, in <module>
    from reverb import pybind
  File "/home/ubuntu/.local/lib/python3.6/site-packages/reverb/pybind.py", line 1, in <module>
    import tensorflow as _tf; from .libpybind import *; del _tf
ImportError: /home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so: undefined symbol: _ZNK6google8protobuf7Message25InitializationErrorStringEv

ldd 分析后,我发现在寻找通往 libtensorflow_framework.so.2 的路径时出错:

ubuntu@NVIDIA-01:/usr/local/lib/python3.6/dist-packages/tensorflow$ ldd -r /home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so
    linux-vdso.so.1 (0x0000007f8ebe0000)
    libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007f8e9bb000)
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007f8e902000)
    libtensorflow_framework.so.2 => not found
    libpython3.6m.so.1.0 => /usr/lib/aarch64-linux-gnu/libpython3.6m.so.1.0 (0x0000007f8e444000)
    librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000007f8e42d000)
    libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007f8e409000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f8e2b0000)
    /lib/ld-linux-aarch64.so.1 (0x0000007f8ebb4000)
    libexpat.so.1 => /lib/aarch64-linux-gnu/libexpat.so.1 (0x0000007f8e271000)
    libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000007f8e244000)
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007f8e218000)
    libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007f8e203000)
    libutil.so.1 => /lib/aarch64-linux-gnu/libutil.so.1 (0x0000007f8e1f0000)
undefined symbol: scc_info_DictValue_tensorflow_2fcore_2fprotobuf_2fstruct_2eproto  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: scc_info_Duration_google_2fprotobuf_2fduration_2eproto    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: scc_info_TensorProto_tensorflow_2fcore_2fframework_2ftensor_2eproto   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: descriptor_table_tensorflow_2fcore_2fprotobuf_2fstruct_2eproto    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: descriptor_table_tensorflow_2fcore_2fframework_2ftensor_2eproto   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: descriptor_table_google_2fprotobuf_2ftimestamp_2eproto    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: descriptor_table_google_2fprotobuf_2fduration_2eproto (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf7Message13SpaceUsedLongEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf7Message20DiscardUnknownFieldsEv   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf11MessageLite31SerializeWithCachedSizesToArrayEPh (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf7Message21CheckTypeAndMergeFromERKNS0_11MessageLiteE   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf7Message25InitializationErrorStringEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf7Message11GetTypeNameEv   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZTIN6google8protobuf7MessageE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZTIN6google8protobuf7MessageE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf27_Duration_default_instance_E (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow34_StructuredValue_default_instance_E  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf28_Timestamp_default_instance_E    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14DestroyMessageEPKv  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal26fixed_address_empty_stringE (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal10WireFormat22SerializeUnknownFieldsERKNS0_15UnknownFieldSetEPNS0_2io17CodedOutputStreamE (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite9WriteBoolEibPNS0_2io17CodedOutputStreamE (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite11WriteUInt64EimPNS0_2io17CodedOutputStreamE  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal10WireFormat29SerializeUnknownFieldsToArrayERKNS0_15UnknownFieldSetEPh    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal10WireFormat24ComputeUnknownFieldsSizeERKNS0_15UnknownFieldSetE   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal17AssignDescriptorsEPKNS1_15DescriptorTableE  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite10WriteInt32EiiPNS0_2io17CodedOutputStreamE   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite11WriteDoubleEidPNS0_2io17CodedOutputStreamE  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite10WriteInt64EilPNS0_2io17CodedOutputStreamE   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf15UnknownFieldSet13ClearFallbackEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf13RepeatedFieldImED1Ev (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite24WriteMessageMaybeToArrayEiRKNS0_11MessageLiteEPNS0_2io17CodedOutputStreamE  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal11InitSCCImplEPNS1_11SCCInfoBaseE (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal13VerifyVersionEiiPKc (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal13OnShutdownRunEPFvPKvES3_    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io17CodedOutputStream21WriteVarint64SlowPathEm    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite16VerifyUtf8StringEPKciNS2_9OperationES4_ (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite23WriteStringMaybeAliasedEiRKSsPNS0_2io17CodedOutputStreamE   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io17CodedOutputStream21WriteVarint32SlowPathEj    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal9ArenaImpl28AllocateAlignedAndAddCleanupEmPFvPvE  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf5Arena17OnArenaAllocationEPKSt9type_infom (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal10WireFormat9SkipFieldEPNS0_2io16CodedInputStreamEjPNS0_15UnknownFieldSetE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream15ReadTagFallbackEj   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream20ReadVarint32FallbackEj  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream20ReadVarint64FallbackEv  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream26ReadLittleEndian64FallbackEPm   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream27ReadVarintSizeAsIntFallbackEv   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream35IncrementRecursionDepthAndPushLimitEi   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream34DecrementRecursionDepthAndPopLimitEi    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf15UnknownFieldSet9MergeFromERKS1_  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal13ReflectionOps5MergeERKNS0_7MessageEPS3_ (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8Duration9MergeFromERKS1_  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf5Arena18CreateMaybeMessageINS0_8DurationEJEEEPT_PS1_DpOT0_ (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8DurationC1ERKS1_  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf13RepeatedFieldImE7ReserveEi   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf9Timestamp9MergeFromERKS1_ (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf5Arena18CreateMaybeMessageINS0_9TimestampEJEEEPT_PS1_DpOT0_    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow15StructuredValue9MergeFromERKS0_  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf5Arena18CreateMaybeMessageIN10tensorflow15StructuredValueEJEEEPT_PS1_DpOT0_    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf9TimestampC1ERKS1_ (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow15StructuredValueC1ERKS0_  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow11TensorProto9MergeFromERKS0_  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf5Arena18CreateMaybeMessageIN10tensorflow11TensorProtoEJEEEPT_PS1_DpOT0_    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal20RepeatedPtrFieldBase14InternalExtendEi  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14AddDescriptorsEPKNS1_15DescriptorTableE (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow11TensorProto5ClearEv  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow11TensorProto27MergePartialFromCodedStreamEPN6google8protobuf2io16CodedInputStreamE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal20RepeatedPtrFieldBase7ReserveEi  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK10tensorflow11TensorProto39InternalSerializeWithCachedSizesToArrayEPh (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK10tensorflow11TensorProto12ByteSizeLongEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite9ReadBytesEPNS0_2io16CodedInputStreamEPSs (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream9PushLimitEi  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf2io16CodedInputStream15BytesUntilLimitEv  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf9Timestamp27MergePartialFromCodedStreamEPNS0_2io16CodedInputStreamE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io16CodedInputStream8PopLimitEi   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf9Timestamp39InternalSerializeWithCachedSizesToArrayEPh    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf2io17CodedOutputStream26WriteStringWithSizeToArrayERKSsPh  (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8internal14WireFormatLite10UInt64SizeERKNS0_13RepeatedFieldImEE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf9Timestamp12ByteSizeLongEv    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf8Duration27MergePartialFromCodedStreamEPNS0_2io16CodedInputStreamE (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN10tensorflow15StructuredValue27MergePartialFromCodedStreamEPN6google8protobuf2io16CodedInputStreamE    (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf8Duration39InternalSerializeWithCachedSizesToArrayEPh (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK10tensorflow15StructuredValue39InternalSerializeWithCachedSizesToArrayEPh (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf8Duration12ByteSizeLongEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK10tensorflow15StructuredValue12ByteSizeLongEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf7Message21CheckTypeAndMergeFromERKNS0_11MessageLiteE   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf11MessageLite31SerializeWithCachedSizesToArrayEPh (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZN6google8protobuf7Message20DiscardUnknownFieldsEv   (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)
undefined symbol: _ZNK6google8protobuf7Message13SpaceUsedLongEv (/home/ubuntu/.local/lib/python3.6/site-packages/reverb/libschema_cc_proto.so)

而不是

build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"

设置

build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1"