Building percona mysql shell 8.0 from percona src rpm

Facing issue building the percona shell, compiling it source code requires percona server source code as input, but it keeps failing while linking libmysqlclient, libmysqlxclient and many other binaries during build. I’m using a rhel9 env, been few days and not been able to figure it out,

  • Is there an ideal way or documentation on percona mysql shell
  • If it doesn’t work can we just use the mysql shell instead of percona shell (same version)
  • Does underlying env is issue, does one face issue with rhel and works on fedora ( ubuntu ).

Hi @Ranit_Goyal

Could you provide some logs of the issue?
It’s used the original upstream code so you may use mysql shell packages.
We use oraclelinux:9 for preparing packages.

Thanks a lot for response, here are the logs

/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'getopt_double_limit_value(double, my_option const*, bool*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_handle_options2(int*, char***, my_option const*, bool (*)(int, my_option const*, char*), char const**, bool, bool)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_getopt_skip_unknown'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_getopt_print_errors'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'disabled_my_option'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_handle_options(int*, char***, my_option const*, bool (*)(int, my_option const*, char*), char const**, bool)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'handle_options'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_cleanup_options(my_option const*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_print_help(my_option const*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_print_variables_ex(my_option const*, _IO_FILE*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): multiple definition of 'my_print_variables(my_option const*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getopt.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_hkdf_function::derive_key(unsigned char const*, unsigned int, unsigned char*, unsigned int)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_pbkdf2_hmac_function::derive_key(unsigned char const*, unsigned int, unsigned char*, unsigned int)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_hkdf_function::Key_hkdf_function(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_hkdf_function::Key_hkdf_function(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_pbkdf2_hmac_function::Key_pbkdf2_hmac_function(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_pbkdf2_hmac_function::Key_pbkdf2_hmac_function(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'create_kdf_key(unsigned char const*, unsigned int, unsigned char*, unsigned int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_hkdf_function::validate_options()'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): multiple definition of 'Key_pbkdf2_hmac_function::validate_options()'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_kdf.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getpwnam.cc.o): multiple definition of 'my_getpwnam(char const*)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getpwnam.cc.o): previous definition here
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: error: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getpwnam.cc.o): multiple definition of 'my_getpwuid(unsigned int)'
/opt/rh/gcc-toolset-12/root/usr/bin/ld.gold: /root/rpmbuild/BUILD/percona-server-8.0.40-31/release/archive_output_directory/libmysqlclient.a(my_getpwnam.cc.o): previous definition here
../../generated/protobuf/mysqlx_connection.pb.cc:541: error: undefined reference to 'google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20230802::once_flag*, google::protobuf::Metadata const&)'
../../generated/protobuf/mysqlx_connection.pb.cc:715: error: undefined reference to 'google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20230802::once_flag*, google::protobuf::Metadata const&)'
../../generated/protobuf/mysqlx_connection.pb.cc:754: error: undefined reference to 'google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20230802::once_flag*, google::protobuf::Metadata const&)'
../../generated/protobuf/mysqlx_connection.pb.cc:961: error: undefined reference to 'google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20230802::once_flag*, google::protobuf::Metadata const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [mysql-secret-store/login-path/CMakeFiles/mysql-secret-store-login-path.dir/build.make:155: bin/mysql-secret-store-login-path] Error 1
make[1]: *** [CMakeFiles/Makefile2:2118: mysql-secret-store/login-path/CMakeFiles/mysql-secret-store-login-path.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 99%] Built target api_modules_objlib
make: *** [Makefile:156: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.7703Pe (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.7703Pe (%build)

I have few other clarifications

  • I saw that percona shell have build wrapper commands for xtrabackup is that correct, won’t using mysql shell cause failures.
  • If you can guide me with exact cmake flags used to build percona mysql8.0 server and then the way source code is provided to the percona client and then what cmake flags does percona shell build needs. As these info are open source, should be okay to provide.

We are using the original code for packaging. No changes have been added.

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_LD_LLD=0 -DLIB_SUFFIX=64 -DMYSQLCLIENT_STATIC_LINKING=ON -DMYSQL_SOURCE_DIR=/mnt/jenkins/workspace/mysql-shell-8.0-RELEASE/test/percona-server -DMYSQL_BUILD_DIR=/mnt/jenkins/workspace/mysql-shell-8.0-RELEASE/test/percona-server/bld -DBUNDLED_PYTHON_DIR=/usr/local/python311/ -DBUNDLED_ANTLR_DIR=/opt/antlr4/usr/local/ -DJIT_EXECUTOR_LIB=/mnt/jenkins/workspace/mysql-shell-8.0-RELEASE/test/polyglot-nativeapi-native-library/ -DHAVE_PYTHON=2 '-DCMAKE_CXX_FLAGS_INIT=-Wno-error=stringop-overflow -Wno-error=maybe-uninitialized' -DPACKAGE_YEAR=2025 -DWITH_PROTOBUF=system -DPROTOBUF_INCLUDE_DIRS=/usr/local/include -DPROTOBUF_LIBRARIES=/usr/local/lib/libprotobuf.a -DWITH_STATIC_LINKING=ON '-DMYSQL_EXTRA_LIBRARIES=-lz -ldl -lssl -lcrypto -licui18n -licuuc -licudata' -DUSE_LD_GOLD=0 -DLIBEXECDIR=libexec

Thanks let me check this and validate, meanwhile you are saying that if I build the server my own and then just fetch the mysql client for same mysql version it should work perfectly ?
also can you provide the cmake flags used to build server

So as per this cmake command we do not need to server source code at all for building the shell, is that true ?

We just need to use the src rpm from percona and use these cmake flags on the source repo of the shell and then should have a successful compilation ?

I see you are using server source code as i though, and I have build the percona server source code using src rpm spec file cmake commands, and when I provide msyql shell the server source code and build , it fails while linking it