sewenew / redis-plus-plus

Redis client written in C++
Apache License 2.0
1.64k stars 351 forks source link

[QUESTION] I am getting below error when building on mac M1, any clue? #406

Closed ghost closed 2 years ago

ghost commented 2 years ago

Note: Tries with brew install openssl@1.1 and brew install openssl too.

cmake -DCMAKE_BUILD_TYPE=Release -DREDIS_PLUS_PLUS_CXX_STANDARD=17 -DREDIS_PLUS_PLUS_USE_TLS=ON -DREDIS_PLUS_PLUS_BUILD_TEST=OFF ..

Building CXX object CMakeFiles/redis++.dir/src/sw/redis++/transaction.cpp.o [ 97%] Building CXX object CMakeFiles/redis++.dir/src/sw/redis++/tls/tls.cpp.o [100%] Linking CXX shared library libredis++.dylib Undefined symbols for architecture arm64: "_ERR_clear_error", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) "_ERR_peek_last_error", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) "_ERR_reason_error_string", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) "_OPENSSL_init_ssl", referenced from: _redisInitOpenSSL in libhiredis_ssl.a(ssl.o) "_SSL_CTX_free", referenced from: _redisFreeSSLContext in libhiredis_ssl.a(ssl.o) _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_load_verify_locations", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_new", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_set_default_verify_paths", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_set_options", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_set_verify", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_use_PrivateKey_file", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_CTX_use_certificate_chain_file", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) "_SSL_connect", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) "_SSL_ctrl", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) _redisInitiateSSLWithContext in libhiredis_ssl.a(ssl.o) "_SSL_free", referenced from: _redisInitiateSSLWithContext in libhiredis_ssl.a(ssl.o) _redisSSLFree in libhiredis_ssl.a(ssl.o) "_SSL_get_error", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) _redisSSLRead in libhiredis_ssl.a(ssl.o) _redisSSLWrite in libhiredis_ssl.a(ssl.o) "_SSL_new", referenced from: _redisInitiateSSLWithContext in libhiredis_ssl.a(ssl.o) "_SSL_read", referenced from: _redisSSLRead in libhiredis_ssl.a(ssl.o) "_SSL_set_connect_state", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) "_SSL_set_fd", referenced from: _redisSSLConnect in libhiredis_ssl.a(ssl.o) "_SSL_write", referenced from: _redisSSLWrite in libhiredis_ssl.a(ssl.o) "_TLS_client_method", referenced from: _redisCreateSSLContextWithOptions in libhiredis_ssl.a(ssl.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [libredis++.1.3.5.dylib] Error 1 make[1]: [CMakeFiles/redis++.dir/all] Error 2 make: *** [all] Error 2

sewenew commented 2 years ago

Looks like libhiredis_ssl.so has not been linked correctly.

Please check if you installed multiple hiredis? If you do, uninstall them and only keep a single installed hiredis with ssl support. Also ensure the installation path of hiredis is under a directory that cmake can find lib and headers. Otherwise, set -DCMAKE_PREFIX_PATH=/path/to/hiredis when running cmake to ensure it can find hiredis related dependencies.

Regards

ghost commented 2 years ago

thanks @sewenew , let me try that.

sewenew commented 2 years ago

Since there's no update, I'll close this issue.

Regards