RedisLabs/memtier_benchmark

Build error on Mac M1

caipengbo opened this issue · 4 comments

I found some error when make on Macbook Pro(M1 inside):

/Library/Developer/CommandLineTools/usr/bin/make  all-am
  CXXLD    memtier_benchmark
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1i/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1i/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_CRYPTO_free", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_ERR_print_errors_fp", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_ERR_reason_error_string", referenced from:
      shard_connection::handle_event(short) in memtier_benchmark-shard_connection.o
  "_OPENSSL_init_ssl", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_RAND_poll", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_free", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_load_verify_locations", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_new", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_set_options", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_set_verify", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_use_PrivateKey_file", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_CTX_use_certificate_file", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
  "_SSL_ctrl", referenced from:
      shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
  "_SSL_new", referenced from:
      shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
  "_TLS_client_method", referenced from:
      _main in memtier_benchmark-memtier_benchmark.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [memtier_benchmark] Error 1
make: *** [all] Error 2

hi @caipengbo did you try to change the PKG_CONFIG_PATH when running the ./configure:
PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig ./configure

I solved this issue. Because I set the wrong PKG_CONFIG_PATH. I used homebrew to install lib, the default install path it's not /usr/local/opt/

To find the correct PKG_CONFIG_PATH value (because you missed caveats during installation) you can run brew info openssl@1.1. Which will show you something like the following at the end of the output:

[...]
For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
[...]

(You can of course use brew info openssl@1.1 | grep PKG_CONFIG_PATH if you are only interested in that specific line.)

Maybe this could be added to the README.

I am facing the same issue!

I tried setting the correct path for PKG_CONFIG_PATH while configuring but still facing the same issue when i try to make.

/Library/Developer/CommandLineTools/usr/bin/make all-am
CXX memtier_benchmark-memtier_benchmark.o
CXX memtier_benchmark-client.o
CXX memtier_benchmark-cluster_client.o
CXX memtier_benchmark-shard_connection.o
CXX memtier_benchmark-run_stats_types.o
CXX memtier_benchmark-run_stats.o
CXX memtier_benchmark-JSON_handler.o
CXX memtier_benchmark-protocol.o
CXX memtier_benchmark-obj_gen.o
CXX memtier_benchmark-item.o
CXX memtier_benchmark-file_io.o
CXX memtier_benchmark-config_types.o
CC deps/hdr_histogram/memtier_benchmark-hdr_histogram_log.o
CC deps/hdr_histogram/memtier_benchmark-hdr_histogram.o
CC deps/hdr_histogram/memtier_benchmark-hdr_time.o
CC deps/hdr_histogram/memtier_benchmark-hdr_encoding.o
CXXLD memtier_benchmark
ld: warning: ignoring file /usr/local/Cellar/libevent/2.1.12_1/lib/libevent_openssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/libevent/2.1.12_1/lib/libevent.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1u/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1u/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_CRYPTO_free", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_ERR_print_errors_fp", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_ERR_reason_error_string", referenced from:
shard_connection::handle_event(short) in memtier_benchmark-shard_connection.o
"_OPENSSL_init_crypto", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_OPENSSL_init_ssl", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_RAND_poll", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_free", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_load_verify_locations", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_new", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_set_options", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_set_verify", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_use_PrivateKey_file", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_CTX_use_certificate_chain_file", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_SSL_ctrl", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
"_SSL_new", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
"_TLS_client_method", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
"_bufferevent_disable", referenced from:
shard_connection::fill_pipeline() in memtier_benchmark-shard_connection.o
"_bufferevent_enable", referenced from:
shard_connection::handle_event(short) in memtier_benchmark-shard_connection.o
"_bufferevent_free", referenced from:
shard_connection::handle_event(short) in memtier_benchmark-shard_connection.o
shard_connection::~shard_connection() in memtier_benchmark-shard_connection.o
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
shard_connection::connect(connect_info*) in memtier_benchmark-shard_connection.o
shard_connection::disconnect() in memtier_benchmark-shard_connection.o
"_bufferevent_get_input", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
"_bufferevent_get_openssl_error", referenced from:
shard_connection::handle_event(short) in memtier_benchmark-shard_connection.o
"_bufferevent_get_output", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
shard_connection::fill_pipeline() in memtier_benchmark-shard_connection.o
"_bufferevent_openssl_socket_new", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
"_bufferevent_setcb", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
"_bufferevent_socket_connect", referenced from:
shard_connection::connect(connect_info*) in memtier_benchmark-shard_connection.o
"_bufferevent_socket_new", referenced from:
shard_connection::setup_event(int) in memtier_benchmark-shard_connection.o
"_evbuffer_add", referenced from:
redis_protocol::write_command_cluster_slots() in memtier_benchmark-protocol.o
redis_protocol::write_command_set(char const*, int, char const*, int, int, unsigned int) in memtier_benchmark-protocol.o
redis_protocol::write_command_get(char const*, int, unsigned int) in memtier_benchmark-protocol.o
redis_protocol::write_arbitrary_command(command_arg const*) in memtier_benchmark-protocol.o
redis_protocol::write_arbitrary_command(char const*, int) in memtier_benchmark-protocol.o
memcache_text_protocol::write_command_set(char const*, int, char const*, int, int, unsigned int) in memtier_benchmark-protocol.o
memcache_text_protocol::write_command_multi_get(keylist const*) in memtier_benchmark-protocol.o
...
"_evbuffer_add_printf", referenced from:
redis_protocol::select_db(int) in memtier_benchmark-protocol.o
redis_protocol::authenticate(char const*) in memtier_benchmark-protocol.o
redis_protocol::configure_protocol(PROTOCOL_TYPE) in memtier_benchmark-protocol.o
redis_protocol::write_command_set(char const*, int, char const*, int, int, unsigned int) in memtier_benchmark-protocol.o
redis_protocol::write_command_get(char const*, int, unsigned int) in memtier_benchmark-protocol.o
redis_protocol::write_command_wait(unsigned int, unsigned int) in memtier_benchmark-protocol.o
redis_protocol::write_arbitrary_command(char const*, int) in memtier_benchmark-protocol.o
...
"_evbuffer_drain", referenced from:
redis_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_text_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_binary_protocol::parse_response() in memtier_benchmark-protocol.o
"_evbuffer_get_length", referenced from:
shard_connection::fill_pipeline() in memtier_benchmark-shard_connection.o
redis_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_text_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_binary_protocol::parse_response() in memtier_benchmark-protocol.o
"_evbuffer_readln", referenced from:
redis_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_text_protocol::parse_response() in memtier_benchmark-protocol.o
"_evbuffer_remove", referenced from:
redis_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_text_protocol::parse_response() in memtier_benchmark-protocol.o
memcache_binary_protocol::parse_response() in memtier_benchmark-protocol.o
"_event_base_dispatch", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
client_group::run() in memtier_benchmark-client.o
"_event_base_free", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
client_group::~client_group() in memtier_benchmark-client.o
"_event_base_new", referenced from:
_main in memtier_benchmark-memtier_benchmark.o
client_group::client_group(benchmark_config*, abstract_protocol*, object_generator*) in memtier_benchmark-client.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [memtier_benchmark] Error 1
make: *** [all] Error 2