Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
856 stars 233 forks source link

Issue with openssl install on amazon linux 2 with CMake #285

Closed doramar97 closed 1 year ago

doramar97 commented 1 year ago

What happened?

I have OpenSSL 3.0.0-alpha17 20 May 2021 (Library: OpenSSL 3.0.0-alpha17 20 May 2021) and cmake version 3.26.0-rc6 installed on my amazon linux machine. when trying to make install im getting the following error:

[ 75%] Linking CXX executable rsa-create
CMakeFiles/rsa-create.dir/rsa-create.cpp.o: In function `jwt::algorithm::rsa::sign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::error_code&) const':
rsa-create.cpp:(.text._ZNK3jwt9algorithm3rsa4signERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_code[_ZNK3jwt9algorithm3rsa4signERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_code]+0x2b): undefined reference to `EVP_MD_CTX_free'
rsa-create.cpp:(.text._ZNK3jwt9algorithm3rsa4signERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_code[_ZNK3jwt9algorithm3rsa4signERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt10error_code]+0x30): undefined reference to `EVP_MD_CTX_new'

when running cmake .. , might be an issue with the openssl version it finds: Found OpenSSL: /usr/lib64/libcrypto.so (found suitable version "1.0.2k", minimum required is "1.0.1")

How To Reproduce?

No response

Version

0.6.0

What OS are you seeing the problem on?

Linux

What compiler are you seeing the problem on?

GCC

Relevant log output

No response

Code of Conduct

prince-chrismc commented 1 year ago

It seems your environment has two different versions, CMake is finding the the system dev headers for an older version while passing in the libs to the new one.

You should double check you OpenSSL install, you can also direct CMake with find_package with hints or other paths to direct the search.

I personally work on Conan which is a package manager and jwt-cpp is available in several of them and it a much better way of avoid these types of problems IMO :)

prince-chrismc commented 1 year ago

I will mark this as closed since its a linker error with CMake find different openssl on the system, feel free to ask questions :)