poco支持mysql编译过程之问题记录

2,118 阅读1分钟

1、mysql安装,请参考如下链接:

centos7安装mysql过程

2、poco编译过程:

tar -xvf poco-1.10.1-release.tar.gz
cd poco-poco-1.10.1-release
mkdir mybuild && cd mybuild
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON
make && make install

3、编译过程问题解决

  • 问题1:
[ 95%] Linking CXX shared library ../../lib/libPocoDataMySQLd.so
/usr/bin/ld:/usr/local/mysql/lib/libmysqlclient.so: file format not recognized; treating as linker script
/usr/bin/ld:/usr/local/mysql/lib/libmysqlclient.so:1: syntax error
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libPocoDataMySQLd.so.71] Error 1
make[1]: *** [Data/MySQL/CMakeFiles/DataMySQL.dir/all] Error 2
make: *** [all] Error 2
  • 问题原因:
mysql的二进制包分为glibc2.12和glibc2.17两种版本。
最开始安装时无脑安装了2.12版本,而实际我的系统为glibc2.17版本,故导致上述问题。
  • 解决方法:
重写安装glibc2.17版本,例如:mysql-8.0.21-linux-glibc2.17-x86_64-minimal.tar
PS:通过ldd --version可查看本机系统glibc版本

  • 问题2:
/usr/local/mysql/lib/libmysqlclient.so: undefined reference to `SSL_CTX_set_ciphersuites@OPENSSL_1_1_1'
/usr/local/mysql/lib/libmysqlclient.so: undefined reference to `BIO_set_callback_ex@OPENSSL_1_1_1'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/DataMySQL-testrunner] Error 1
make[1]: *** [Data/MySQL/testsuite/CMakeFiles/DataMySQL-testrunner.dir/all] Error 2
make: *** [all] Error 2
  • 问题原因:
本机系统不支持1.1.1版本的openssl导致。
  • 解决方法:
安装1.1.1版本的openssl,下载openssl-OpenSSL_1_1_1.zip源码包,并解压。
./config 
make
make install
PS:若安装的库不在环境变量中,需添加。
PS:linux环境变量设置方法参考:https://www.jianshu.com/p/d1e3fa6dbd7c