-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac compile error - undefined symbols #6
Comments
The error suggests that the version of OpenSSL you use does not include _EVP_sha256 and _HMAC. In case it is just the test cases that fail and you're not using any of the HS* algorithms in your project you might not need to change anything since the should not trigger a linker error when not used. If you need HS256, HS384 or HS512 support it looks like your best bet is recompiling OpenSSL. Please let me know if you solved it so I can add a note in the Readme to inform users about this. |
the openssl installed by brew |
@DLTech21 Make sure the version installed by brew is actually used when building and if it is, check if it contains those two symbols. I suspect it is using either the wrong library (i.e. system default, not the brew one) or the brew lib does not contain sha256 support. I'm sorry for not being really helpful. I'll try to compile it once I have access to a Mac again but it might take until the beginning of next month and really hope to solve this issue long before this time. |
solved by link compiled librarys |
thx |
I'll add a note to Readme and link this issue in case of somebody running into the same issue. |
I was also facing the same issues in mu ubuntu 16.04, resolved it by Including -libssl -llibcrypto dependencies in Makefile |
Can you make it clearly ? What should i do if use cmake, Thanks very much. |
According to the article, replace brew openssl to the default successfully : https://www.zhihu.com/question/36693783 But the problem still hasn't been solved.
The code snippet is as follows:
|
The quiet old CMake 🙈 I would strongly recommend using targets instead like Line 92 in c9a511f
Should look like this find_package(OpenSSL REQUIRED)
add_executable(your_app_here main.cpp)
target_link_libraries(your_app_here OpenSSL::SSL OpenSSL::Crypto) |
LibreSSL 3.5.3 has the same problem on mac:
|
Thanks ! but some error occur as follows when using targets instead, what's other should i do ?
The sub cmake snippet look like this (by copy jwt-cpp includes and using include_directories command):
When using find_package(jwt-cpp REQUIRED)
The sub cmake snippet look like this (by find_package):
|
while compiling on mac, comes error
Undefined symbols for architecture x86_64:
"_EVP_sha256", referenced from:
jwt::algorithm::hs256::hs256(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in main.cpp.o
"_HMAC", referenced from:
jwt::algorithm::hmacsha::sign(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const in main.cpp.o
ld: symbol(s) not found for architecture x86_64
The text was updated successfully, but these errors were encountered: