mysql-client@8: 安装报错 ruby/rbenv/openssl1.1/3

自己的电脑安装mysql-client 报错处理
更新于: 2024-11-17 06:45:50

安装

安装 rbenv install 2.6.5 的时候,需要这个

brew install mysql-client@8.0

# 加入以下环境变量到当前的 bash session 中
  export LDFLAGS="-L$(brew --prefix mysql-client@8.0)/lib"
  export CPPFLAGS="-I$(brew --prefix mysql-client@8.0)/include"
  export PKG_CONFIG_PATH="$(brew --prefix mysql-client@8.0)/lib/pkgconfig"

报错现场

Last 15 lines from /Users/aric/Library/Logs/Homebrew/mysql-client@8.0/02.make:
[ 46%] Linking CXX executable ../runtime_output_directory/mysql_ssl_rsa_setup
cd /tmp/mysql-clientA8.0-20241110-45394-4g96l5/mysql-8.0.40/client && /usr/local/Cellar/cmake/3.31.0/bin/cmake -E cmake_link_script CMakeFiles/mysql_ssl_rsa_setup.dir/link.txt --verbose=1
Undefined symbols for architecture x86_64:
  "_EVP_CIPHER_block_size", referenced from:
      my_aes_get_size(unsigned int, my_aes_opmode) in libmysys.a(my_aes_openssl.cc.o)
  "_EVP_CIPHER_iv_length", referenced from:
      my_aes_encrypt(unsigned char const*, unsigned int, unsigned char*, unsigned char const*, unsigned int, my_aes_opmode, unsigned char const*, bool, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libmysys.a(my_aes_openssl.cc.o)
      my_aes_decrypt(unsigned char const*, unsigned int, unsigned char*, unsigned char const*, unsigned int, my_aes_opmode, unsigned char const*, bool, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in libmysys.a(my_aes_openssl.cc.o)
      my_aes_needs_iv(my_aes_opmode) in libmysys.a(my_aes_openssl.cc.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ -std=c++17 -fno-omit-frame-pointer -ftls-model=initial-exec  -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Woverloaded-virtual -Wcast-qual -Wno-null-conversion -Wno-unused-private-field -Wconditional-uninitialized -Wdeprecated -Wno-deprecated-declarations -Wno-shorten-64-to-32 -Wextra-semi -Wheader-hygiene -Wnon-virtual-dtor -Wundefined-reinterpret-cast -Wrange-loop-analysis -Winconsistent-missing-destructor-override -Winconsistent-missing-override -Wshadow-field -ffunction-sections -fdata-sections -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/mysql_ssl_rsa_setup.dir/logger.cc.o CMakeFiles/mysql_ssl_rsa_setup.dir/mysql_ssl_rsa_setup.cc.o CMakeFiles/mysql_ssl_rsa_setup.dir/path.cc.o -o ../runtime_output_directory/mysql_ssl_rsa_setup  ../archive_output_directory/libmysys.a ../archive_output_directory/libstrings.a ../archive_output_directory/libmysys.a ../archive_output_directory/libstrings.a ../archive_output_directory/libmytime.a /usr/local/opt/zlib/lib/libz.dylib /usr/local/lib/libzstd.dylib /usr/local/lib/libssl.dylib /usr/local/lib/libcrypto.dylib
make[2]: *** [runtime_output_directory/mysql_ssl_rsa_setup] Error 1
make[1]: *** [client/CMakeFiles/mysql_ssl_rsa_setup.dir/all] Error 2
make: *** [all] Error 2

解决方案

brew unlink openssl@3
brew link --overwrite openssl@1.1
Linking /usr/local/Cellar/openssl@1.1/1.1.1w... 3999 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.profile

ERROR

LDFLAGS="-L/opt/homebrew/opt/mysql-client@8.0/lib" 报错

checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... yes
checking whether LDFLAGS is valid... no
configure: error: something wrong with LDFLAGS="-L/opt/homebrew/opt/mysql-client@8.0/lib"
external command failed with status 1