jntass / TASSL-1.1.1k

此仓库已停止维护,请移步https://github.com/jntass/TASSL-1.1.1
Other
54 stars 16 forks source link

在Mac M1上遇到Undefined symbols for architecture arm64 的问题 #4

Closed JohannaXiao closed 2 years ago

JohannaXiao commented 2 years ago

``Undefined symbols for architecture arm64:

"SM3_Update(SM3state_st, void const, unsigned long)", referenced from: SM2::sign(char const, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, unsigned char, unsigned char) in libdevcrypto.a(sm2.cpp.o) SM2::verify(unsigned char const, unsigned long, unsigned char const, unsigned long, unsigned char const) in libdevcrypto.a(sm2.cpp.o) SM3Hash::update(SM3state_st, void const, unsigned long) in libdevcrypto.a(sm3.cpp.o) "SM4_decrypt(unsigned char const, unsigned char, SM4_KEY_st const)", referenced from: SM4::decrypt(unsigned char const, unsigned char) in libdevcrypto.a(sm4.cpp.o) "SM4_encrypt(unsigned char const, unsigned char, SM4_KEY_st const)", referenced from: SM4::encrypt(unsigned char const, unsigned char) in libdevcrypto.a(sm4.cpp.o) "SM4_set_key(unsigned char const, unsigned long, SM4_KEY_st)", referenced from: SM4::setKey(unsigned char const, unsigned long) in libdevcrypto.a(sm4.cpp.o) "SM3_Transform(SM3state_st, unsigned char const)", referenced from: SM3Hash::transForm(SM3state_st, unsigned char const) in libdevcrypto.a(sm3.cpp.o) "SM4_cbc_encrypt(unsigned char const, unsigned char, unsigned long, SM4_KEY_st const, unsigned char, int)", referenced from: SM4::cbcEncrypt(unsigned char const, unsigned char, unsigned long, unsigned char, int) in libdevcrypto.a(sm4.cpp.o) "SM3(unsigned char const, unsigned long, unsigned char)", referenced from: SM3Hash::sm3(unsigned char const, unsigned long, unsigned char) in libdevcrypto.a(sm3.cpp.o) "SM3_Init(SM3state_st)", referenced from: SM2::sign(char const, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, unsigned char, unsigned char) in libdevcrypto.a(sm2.cpp.o) SM2::verify(unsigned char const, unsigned long, unsigned char const, unsigned long, unsigned char const) in libdevcrypto.a(sm2.cpp.o) SM3Hash::init(SM3state_st) in libdevcrypto.a(sm3.cpp.o) "SM3_Final(unsigned char, SM3state_st)", referenced from: SM2::sign(char const, int, std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, unsigned char, unsigned char) in libdevcrypto.a(sm2.cpp.o) SM2::verify(unsigned char const, unsigned long, unsigned char const, unsigned long, unsigned char const) in libdevcrypto.a(sm2.cpp.o) SM3Hash::final(unsigned char, SM3state_st) in libdevcrypto.a(sm3.cpp.o) "_curve25519_vrf_generate_key_pair", referenced from: dev::consensus::VRFBasedrPBFTSealer::initConsensusEngine() in libconsensus.a(VRFBasedrPBFTSealer.cpp.o) "_curve25519_vrf_is_valid_pubkey", referenced from: dev::precompiled::CryptoPrecompiled::curve25519VRFVerify(dev::vector_ref, std::1::shared_ptrdev::precompiled::PrecompiledExecResult) in libprecompiled.a(CryptoPrecompiled.cpp.o) dev::precompiled::VRFInfo::isValidVRFPublicKey() in libprecompiled.a(WorkingSealerManagerImpl.cpp.o) "_curve25519_vrf_proof", referenced from: dev::consensus::VRFBasedrPBFTSealer::generateTransactionForRotating() in libconsensus.a(VRFBasedrPBFTSealer.cpp.o) "_curve25519_vrf_proof_to_hash", referenced from: dev::precompiled::CryptoPrecompiled::curve25519VRFVerify(dev::vector_ref, std::1::shared_ptrdev::precompiled::PrecompiledExecResult) in libprecompiled.a(CryptoPrecompiled.cpp.o) dev::precompiled::VRFInfo::getHashFromProof() in libprecompiled.a(WorkingSealerManagerImpl.cpp.o) "_curve25519_vrf_verify", referenced from: dev::precompiled::CryptoPrecompiled::curve25519VRFVerify(dev::vector_ref, std::__1::shared_ptrdev::precompiled::PrecompiledExecResult) in libprecompiled.a(CryptoPrecompiled.cpp.o) dev::precompiled::VRFInfo::verifyProof() in libprecompiled.a(WorkingSealerManagerImpl.cpp.o)

ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: [bin/fisco-bcos] Error 1 make[2]: [fisco-bcos/main/CMakeFiles/fisco-bcos.dir/all] Error 2 make[1]: [fisco-bcos/main/CMakeFiles/fisco-bcos.dir/rule] Error 2 make: [fisco-bcos] Error 2`

image

请问这是因为和Mac M1不兼容导致的吗?可以怎么解决?

yanshichao0226 commented 2 years ago

是编译其它应用链接SSL库的时候报的错?

JohannaXiao commented 2 years ago

是编译其它应用链接SSL库的时候报的错?

是在编译Fisco-Bcos平台的时候遇到的错误,我看上面一部分是SSL相关的,所以想问一下有没有解决办法

yanshichao0226 commented 2 years ago

看报错日志,依赖的似乎是旧版本TASSL的库。试试这个版本https://github.com/jntass/TASSL

旧版本TASSL库是基于openssl1.0.2系列,其中的SM2/SM3/SM4相关算法函数是我们添加的; TASSL-1.1.1b/TASSL-1.1.1k分别是基于openssl-1.1.1b和openssl-1.1.1k,此时openssl已经支持了SM2/SM3/SM4算法,不过使用的函数接口不同 所以可能会不兼容

JohannaXiao commented 2 years ago

看报错日志,依赖的似乎是旧版本TASSL的库。试试这个版本https://github.com/jntass/TASSL

旧版本TASSL库是基于openssl1.0.2系列,其中的SM2/SM3/SM4相关算法函数是我们添加的; TASSL-1.1.1b/TASSL-1.1.1k分别是基于openssl-1.1.1b和openssl-1.1.1k,此时openssl已经支持了SM2/SM3/SM4算法,不过使用的函数接口不同 所以可能会不兼容

是的,但是之前的版本没有针对darwin64-arm64-cc的,之前的版本不太适用

JohannaXiao commented 2 years ago

看报错日志,依赖的似乎是旧版本TASSL的库。试试这个版本https://github.com/jntass/TASSL

旧版本TASSL库是基于openssl1.0.2系列,其中的SM2/SM3/SM4相关算法函数是我们添加的; TASSL-1.1.1b/TASSL-1.1.1k分别是基于openssl-1.1.1b和openssl-1.1.1k,此时openssl已经支持了SM2/SM3/SM4算法,不过使用的函数接口不同 所以可能会不兼容

请问对M1兼容做了哪些改动哈?

yanshichao0226 commented 2 years ago

你的意思是旧版本TASSL在darwin64-arm64-cc上无法编译是吗,具体报什么错

JohannaXiao commented 2 years ago

你的意思是旧版本TASSL在darwin64-arm64-cc上无法编译是吗,具体报什么错

他是直接默认对darwin-i386-cc进行编译,没有针对darwin64-arm64-cc这个选项 image 参考https://gist.github.com/felixbuenemann/5f4dcb30ebb3b86e1302e2ec305bac89 这个链接,问题已经解决,感谢🙏

但是上面的tassl1.1.1k在Fisco-Bcos中出现的问题尚未找到原因,可能是项目本身的问题