EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

Build error happened in libcrypto.a (threads_pthread.o), How to fix it? #6650

Closed laravel1112 closed 5 years ago

laravel1112 commented 5 years ago

When I use "git clone https://github.com/eosio/eos --recursive", and then run "./eosio_build.sh". everythings look ok until meet the following errors.

What should I do to fix such problems?

[ 91%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/resource_limits.cpp.o [ 91%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/chain_config.cpp.o [ 91%] Linking CXX executable test_cypher_suites /usr/lib/x86_64-linux-gnu/libcrypto.a(threads_pthread.o): In function fork_once_func': (.text+0x16): undefined reference topthread_atfork' clang: error: linker command failed with exit code 1 (use -v to see invocation) 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 make[1]: * Waiting for unfinished jobs....* [ 91%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/chain_id_type.cpp.o [ 91%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/genesis_state.cpp.o [ 91%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/genesis_state_root_key.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/wast_to_wasm.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/wasm_interface.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/wasm_eosio_validation.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/wasm_eosio_injection.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/apply_context.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/abi_serializer.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/asset.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/snapshot.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/webassembly/wavm.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/webassembly/wabt.cpp.o [ 92%] Building CXX object libraries/chain/CMakeFiles/eosio_chain.dir/transaction_metadata.cpp.o [ 92%] Linking CXX static library libeosio_chain.a [ 92%] Built target eosio_chain Makefile:138: recipe for target 'all' failed make: [all] Error 2

    >>>>>>>>>>>>>>>>>>>> MAKE building EOSIO has exited with the above error.

I'm using Ubuntu 16.04. I already tried to remove, clone the fresh repo and retried ./eosio_build.sh several times but no luck. I researched all other issues and no case seems to be match.

taokayan commented 5 years ago

what's your OS version?

laravel1112 commented 5 years ago

Ubuntu 16.04

jgiszczak commented 5 years ago

What's the result of dpkg -l | grep pthread? You should have libpthread-stubs0-dev installed.

laravel1112 commented 5 years ago

ii libpthread-stubs0-dev:amd64 0.3-4 amd64 pthread stubs not provided by native libc, development files

jgiszczak commented 5 years ago

What's the result of dpkg -S /usr/lib/x86_64-linux-gnu/libcrypto.a? If it's libssl-dev:amd64:, what's the output of dpkg -l | grep libssl-dev?

laravel1112 commented 5 years ago

The result of dpkg -S /usr/lib/x86_64-linux-gnu/libcrypto.a is libssl-dev:amd64: /usr/lib/x86_64-linux-gnu/libcrypto.a.

The output of dpkg -l | grep libssl-dev is

ii libssl-dev:amd64 1.1.1a-2+ubuntu16.04.1+deb.sury.org+1 amd64 Secure Sockets Layer toolkit - development files

jgiszczak commented 5 years ago

That's very much unexpected and is probably the problem. It should be

ii  libssl-dev:amd64                           1.0.2g-1ubuntu4.14                           amd64        Secure Sockets Layer toolkit - development files

I don't know how you got 1.1.1a on Ubuntu 16. Are you sure you're still running Ubuntu 16?

laravel1112 commented 5 years ago

yes, It's Ubuntu 16 as it is in the result. But the weird thing is that, it says ubuntu 16.04.1 in the output of dpkg -l | grep libssl-dev. But when I access to the server via putty, it says like this.

Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-141-generic x86_64)

As you can see, the versions are bit different, one is 16.04.1 and another is 16.04.5. I hope this can be a hint for you.

quanhuynh2007 commented 5 years ago

I meet same problem above. May I help you???

Scanning dependencies of target test_cypher_suites [ 9%] Building CXX object libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/test_cypher_suites.cpp.o [ 9%] Linking CXX executable test_cypher_suites libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/build.make:113: recipe for target 'libraries/fc/test/crypto/test_cypher_suites' failed CMakeFiles/Makefile2:783: recipe for target 'libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/all' failed Makefile:138: recipe for target 'all' failed

>>>>>>>>>>>>>>>>>>>> MAKE building EOSIO has exited with the above error.

clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [libraries/fc/test/crypto/test_cypher_suites] Error 1 make[1]: [libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/all] Error 2 make: *** [all] Error 2

quanhuynh2007 commented 5 years ago

Who can help me??? Thank you very much

Maybe I failed cause fc libraries....

[ 8%] Built target fc Scanning dependencies of target test_cypher_suites [ 9%] Building CXX object libraries/fc/test/crypto/CMakeFiles/test_cypher_suites.dir/test_cypher_suites.cpp.o [ 9%] Linking CXX executable test_cypher_suites CMakeFiles/test_cypher_suites.dir/test_cypher_suites.cpp.o: In function cypher_suites::test_k1::test_method()': /home/quanbh/aWork/eos/libraries/fc/test/crypto/test_cypher_suites.cpp:(.text+0xb76): undefined reference tofc::crypto::private_key::private_key(std::string const&)' /home/quanbh/aWork/eos/libraries/fc/test/crypto/test_cypher_suites.cpp:(.text+0xc6f): undefined reference to fc::crypto::private_key::operator std::string() const' /home/quanbh/aWork/eos/libraries/fc/test/crypto/test_cypher_suites.cpp:(.text+0xda7): undefined reference tofc::crypto::public_key::operator std::string() const' /home/quanbh/aWork/eos/libraries/fc/test/crypto/test_cypher_suites.cpp:(.text+0x10f4): undefined reference to fc::logger::get(std::string const&)' /home/quanbh/aWork/eos/libraries/fc/test/crypto/test_cypher_suites.cpp:(.text+0x1151): undefined reference tofc::logger::get(std::string const&)' /home/quanbh/aWork/eos/libraries/fc/test/crypto/test_cypher_suites.cpp:(.text+0x11ba): undefined reference to `fc::exception::to_detail_string(fc::log_level) const'

jgiszczak commented 5 years ago

@hbquan93 Try git submodule update --init --recursive at the top level of your eos checkout and rebuild.

crazybits commented 5 years ago

same issue here on ubuntu 18 , but osx is fine

crazybits commented 5 years ago

fyi, add --pthread options while compiling could fix the issue

i-love-to-code commented 5 years ago

You can downgrade OpenSSL to the expected version on that machine as follows:

sudo apt-get purge -y libssl1.0.0 libssl-dev sudo apt-get install -y libssl1.0.0=1.0.2g-1ubuntu4.15 libssl-dev=1.0.2g-1ubuntu4.15

heifner commented 5 years ago

Old issue, closing.