最后的链接阶段出现如下错误
Closed this issue · 1 comments
环境:
- Ubuntu20.04
- 编译器:eos编译使用的是clang4.0,fibos.cpp使用的是默认的/usr/bin/c++,也尝试过使用clang4.0编译fibos.cpp,但是得到同样的错误(注:clang在编译时遇到了一个错误,参考了https://github.com/sunziping2016/aur-llvm39/blob/master/0004-fix-lambda-parameter-name-redeclared.patch修改过clang的源码)
- arm64的树莓派4b和amd64的虚拟机上最后编译都遇到如下问题:
.......
/usr/bin/ld: /home/entropy/fibos/eos/plugins/history_plugin/history_plugin.cpp:(.text._ZN5boost11multi_index6detail25ordered_index_equal_rangeINS1_18ordered_index_nodeINS1_19null_augment_policyENS3_IS4_NS1_15index_node_baseIN5eosio25public_key_history_objectENS_12interprocess9allocatorIS7_NS8_15segment_managerIcNS8_15rbtree_best_fitINS8_12mutex_familyENS8_10offset_ptrIvlmLm0EEELm0EEENS8_10iset_indexEEEEEEEEEEENS0_13composite_keyIS7_NS0_6memberIS7_N2fc6crypto10public_keyEXadL_ZNS7_10public_keyEEEEENSN_IS7_N9chainbase3oidIS7_EEXadL_ZNS7_2idEEEEENS_6tuples9null_typeESX_SX_SX_SX_SX_SX_SX_EESQ_St4lessINS0_20composite_key_resultISY_EEEEESt4pairIPT_S15_ES15_S15_RKT0_RKT1_RKT2_N4mpl_5bool_ILb0EEE[_ZN5boost11multi_index6detail25ordered_index_equal_rangeINS1_18ordered_index_nodeINS1_19null_augment_policyENS3_IS4_NS1_15index_node_baseIN5eosio25public_key_history_objectENS_12interprocess9allocatorIS7_NS8_15segment_managerIcNS8_15rbtree_best_fitINS8_12mutex_familyENS8_10offset_ptrIvlmLm0EEELm0EEENS8_10iset_indexEEEEEEEEEEENS0_13composite_keyIS7_NS0_6memberIS7_N2fc6crypto10public_keyEXadL_ZNS7_10public_keyEEEEENSN_IS7_N9chainbase3oidIS7_EEXadL_ZNS7_2idEEEEENS_6tuples9null_typeESX_SX_SX_SX_SX_SX_SX_EESQ_St4lessINS0_20composite_key_resultISY_EEEEESt4pairIPT_S15_ES15_S15_RKT0_RKT1_RKT2_N4mpl_5bool_ILb0EEE]+0x119): undefined reference to fc::crypto::operator<(fc::crypto::public_key const&, fc::crypto::public_key const&)' /usr/bin/ld: /home/entropy/fibos/eos/plugins/history_plugin/history_plugin.cpp:(.text._ZN5boost11multi_index6detail25ordered_index_equal_rangeINS1_18ordered_index_nodeINS1_19null_augment_policyENS3_IS4_NS1_15index_node_baseIN5eosio25public_key_history_objectENS_12interprocess9allocatorIS7_NS8_15segment_managerIcNS8_15rbtree_best_fitINS8_12mutex_familyENS8_10offset_ptrIvlmLm0EEELm0EEENS8_10iset_indexEEEEEEEEEEENS0_13composite_keyIS7_NS0_6memberIS7_N2fc6crypto10public_keyEXadL_ZNS7_10public_keyEEEEENSN_IS7_N9chainbase3oidIS7_EEXadL_ZNS7_2idEEEEENS_6tuples9null_typeESX_SX_SX_SX_SX_SX_SX_EESQ_St4lessINS0_20composite_key_resultISY_EEEEESt4pairIPT_S15_ES15_S15_RKT0_RKT1_RKT2_N4mpl_5bool_ILb0EEE[_ZN5boost11multi_index6detail25ordered_index_equal_rangeINS1_18ordered_index_nodeINS1_19null_augment_policyENS3_IS4_NS1_15index_node_baseIN5eosio25public_key_history_objectENS_12interprocess9allocatorIS7_NS8_15segment_managerIcNS8_15rbtree_best_fitINS8_12mutex_familyENS8_10offset_ptrIvlmLm0EEELm0EEENS8_10iset_indexEEEEEEEEEEENS0_13composite_keyIS7_NS0_6memberIS7_N2fc6crypto10public_keyEXadL_ZNS7_10public_keyEEEEENSN_IS7_N9chainbase3oidIS7_EEXadL_ZNS7_2idEEEEENS_6tuples9null_typeESX_SX_SX_SX_SX_SX_SX_EESQ_St4lessINS0_20composite_key_resultISY_EEEEESt4pairIPT_S15_ES15_S15_RKT0_RKT1_RKT2_N4mpl_5bool_ILb0EEE]+0x19b): undefined reference to
fc::crypto::operator<(fc::crypto::public_key const&, fc::crypto::public_key const&)'
/usr/bin/ld: ../../../eos/build/plugins/history_plugin/libhistory_plugin.a(history_plugin.cpp.o):/home/entropy/fibos/eos/plugins/history_plugin/history_plugin.cpp:(.text._ZN5boost11multi_index6detail25ordered_index_equal_rangeINS1_18ordered_index_nodeINS1_19null_augment_policyENS3_IS4_NS1_15index_node_baseIN5eosio25public_key_history_objectENS_12interprocess9allocatorIS7_NS8_15segment_managerIcNS8_15rbtree_best_fitINS8_12mutex_familyENS8_10offset_ptrIvlmLm0EEELm0EEENS8_10iset_indexEEEEEEEEEEENS0_13composite_keyIS7_NS0_6memberIS7_N2fc6crypto10public_keyEXadL_ZNS7_10public_keyEEEEENSN_IS7_N9chainbase3oidIS7_EEXadL_ZNS7_2idEEEEENS_6tuples9null_typeESX_SX_SX_SX_SX_SX_SX_EESQ_St4lessINS0_20composite_key_resultISY_EEEEESt4pairIPT_S15_ES15_S15_RKT0_RKT1_RKT2_N4mpl_5bool_ILb0EEE[_ZN5boost11multi_index6detail25ordered_index_equal_rangeINS1_18ordered_index_nodeINS1_19null_augment_policyENS3_IS4_NS1_15index_node_baseIN5eosio25public_key_history_objectENS_12interprocess9allocatorIS7_NS8_15segment_managerIcNS8_15rbtree_best_fitINS8_12mutex_familyENS8_10offset_ptrIvlmLm0EEELm0EEENS8_10iset_indexEEEEEEEEEEENS0_13composite_keyIS7_NS0_6memberIS7_N2fc6crypto10public_keyEXadL_ZNS7_10public_keyEEEEENSN_IS7_N9chainbase3oidIS7_EEXadL_ZNS7_2idEEEEENS_6tuples9null_typeESX_SX_SX_SX_SX_SX_SX_EESQ_St4lessINS0_20composite_key_resultISY_EEEEESt4pairIPT_S15_ES15_S15_RKT0_RKT1_RKT2_N4mpl_5bool_ILb0EEE]+0x1ee): more undefined references to fc::crypto::operator<(fc::crypto::public_key const&, fc::crypto::public_key const&)' follow /usr/bin/ld: ../../../eos/build/plugins/history_plugin/libhistory_plugin.a(history_plugin.cpp.o):(.data.rel.ro._ZTIN2fc21invalid_arg_exceptionE[_ZTIN2fc21invalid_arg_exceptionE]+0x10): undefined reference to
typeinfo for fc::exception'
/usr/bin/ld: ../../../eos/build/plugins/history_plugin/libhistory_plugin.a(history_plugin.cpp.o):(.data.rel.ro._ZTVN2fc21invalid_arg_exceptionE[_ZTVN2fc21invalid_arg_exceptionE]+0x10): undefined reference to fc::exception::~exception()' /usr/bin/ld: ../../../eos/build/plugins/history_plugin/libhistory_plugin.a(history_plugin.cpp.o):(.data.rel.ro._ZTVN2fc21invalid_arg_exceptionE[_ZTVN2fc21invalid_arg_exceptionE]+0x20): undefined reference to
fc::exception::what() const'
/usr/bin/ld: ../../../eos/build/plugins/history_plugin/libhistory_plugin.a(history_plugin.cpp.o):(.data+0x0): undefined reference to `typeinfo for fc::exception'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/fibos.dir/build.make:216: ../../../bin/Linux_amd64_release/fibos] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/fibos.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
报错前最后的信息:
==== GLIBC ====
GLIBC_2.17
GLIBC_2.2.5
GLIBC_2.28
GLIBC_2.29
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.7
[ 50%] Linking CXX executable ../../../bin/Linux_amd64_release/fibos
eos和fibjs都已经编译成功无报错,链接阶段还遇到另外两个报错:
- [ 50%] Linking CXX executable ../../../bin/Linux_amd64_release/fibos
/usr/bin/ld: ../../../eos/externals/binaryen/test/linker/archive/barlong.a: error adding symbols: archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/fibos.dir/build.make:216: ../../../bin/Linux_amd64_release/fibos] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/fibos.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
这里因为这两个文件不是自己编译的而是eos库中自带的,好像也没什么用,于是我就把
./fibos/out/Linux_amd64_release/program/CMakeFiles/fibos.dir/link.txt
中barlong.a和foobar.a这两个路径直接删掉了,不知道这样做有没有问题。
- [ 50%] Linking CXX executable ../../../bin/Linux_amd64_release/fibos
/usr/bin/ld: ../../../eos/build/libraries/appbase/libappbase.a(application.cpp.o): relocation R_X86_64_32S against symbol `_ZTVSt23_Sp_counted_ptr_inplaceIN5boost4asio10io_contextESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/fibos.dir/build.make:216: ../../../bin/Linux_amd64_release/fibos] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/fibos.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
这里根据提示在eos的编译参数里加上了 -fPIE(arm64上是-fPIC),然后链接就通过了,通过之后就遇到了最上面的问题,自己尝试了很久也不知道怎么解决,恳请开发者提供一点帮助。
你 fork 一个库,把你的修改代码和编译环境完整提交一下,这样方便查看。