一个老问题,编译时出现以下错误

[ 91%] �[32mBuilding CXX object libraries/chain/CMakeFiles/eosio_chain.dir/chain_id_type.cpp.o�[0m

/usr/lib/x86_64-linux-gnu/libcrypto.a(threads_pthread.o): In function `fork_once_func':

(.text+0x16): undefined reference to `pthread_atfork'

clang: [0;1;31merror: [0mlinker command failed with exit code 1 (use -v to see invocation) [0m

libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/build.make:113: recipe for target 'libraries/fc/test/crypto/test_cypher_suites' failed

make[2]: *** [libraries/fc/test/crypto/test_cypher_suites] Error 1

CMakeFiles/Makefile2:783: recipe for target 'libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/all' failed

make[1]: *** [libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/all] Error 2

解决方案

~/eos1.6/eos/libraries/fc$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8056cf0..efb09db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,7 +157,7 @@ IF(APPLE)
   find_library(security_framework Security)
   find_library(corefoundation_framework CoreFoundation)
 ENDIF()
-target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ${security_framework} ${corefoundation_framework} )
+target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ${security_framework} ${corefoundation_framework} pthread )


 SET(OPENSSL_CONF_TARGET )

参考

https://github.com/EOSIO/eos/issues/7490