weidai11 / cryptopp

free C++ class library of cryptographic schemes
https://cryptopp.com
Other
4.89k stars 1.51k forks source link

Failure to link version 8.7.0 on Centos 7 #1166

Closed daniel-heater-imprivata closed 1 year ago

daniel-heater-imprivata commented 2 years ago

Crypto++ Issue Report

I am getting link errors when building on a CentOS 7 based Docker container using devtoolset-11 i.e. gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) with Crytpo++ version 8.7.0

The application builds and links fine on Ubuntu 22.04 with compiler: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0

The same application builds fine within the Docker image using Crytpo++ 8.6.0

I am using Conan and building Crypto++ from source so I am using the same compiler for the library and the application. I don't think this is a Conan issue since the same code works fine on Ubuntu with cryptopp/8.6.0 and cryptopp/8.7.0 and crytpopp/8.6.0 works fine on CentOS 7.

I am also using Qt in the application. I have seen SO threads that mention problems when using Qt, but it doesn't appear to be those issues. Besides, it works in the scenarios stated above.

This is not critical for me since I can fall back to version 8.6.0.

Here are the link errors

/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o: in function `AESDecrypt(std::string const&, unsigned char const*)':
/root/code/sources/demangle.cpp:61: undefined reference to `CryptoPP::StringSinkTemplate<std::string>::StringSinkTemplate(std::string&)'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE[_ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE]+0xa0): undefined reference to `CryptoPP::Rijndael::Base::AlgorithmProvider() const'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE[_ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE]+0x100): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Base::AlgorithmProvider() const'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE[_ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE]+0xa0): undefined reference to `CryptoPP::Rijndael::Base::AlgorithmProvider() const'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE[_ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE]+0xf8): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Base::AlgorithmProvider() const'
collect2: error: ld returned 1 exit status
noloader commented 2 years ago

I'm not a good resource for Conan or CMake. Maybe @abdes can help with CMake. Abdessattar handles CMake nowadays at https://github.com/abdes/cryptopp-cmake . I don't know who can help with Conan. You may need to reach out to the person or team who supplied the Conan files.

abdes commented 2 years ago

If you are using abdes/cryptopp-cmake, ensure you are using the latest from master branch and report the error if it happens again. We've seen similar errors on other archs and platforms that we've already fixed.

Eventually try to build in the same environment with just the cryptopp-cmake project, no Conan, so that we can isolate the root cause.