mysql connector c 源码_MySQL Connector/C++ 8.0 源码编译

平台

ubuntu 16.04

下载源码

访问 https://dev.mysql.com/downloads/connector/cpp/ ,选择source code 下载

依赖

编译 MySQL Connector/C++ 需要 依赖于openssl,mysql,cmake ,boost 等组件,需要事先安装

步骤

以下 以编译jdbc 静态库 为例,说明步骤。

1. 解压缩源码包

2. 在源码包之外建立构建目录 build

3. 执行命令:(详细的编译配置可以参考官方文档:https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-source-configuration-options.html#option_cmake_with_jdbc)

cmake   源码包路径  -DCMAKE_INSTALL_PREFIX=mysql-connector/c++的安装目录  -DBUILD_STATIC=true    -DCMAKE_BUILD_TYPE=Release  -DWITH_JDBC=true -WITH_BOOST=boost的安装目录

4.  make && make install

5. 编译完成后在 安装目录下的 lib64 目录下会生成两个静态库 libmysqlcppconn8-static.a  和   libmysqlcppconn-static.a  。

按照官方文档的说法:

If you enabled the WITH_JDBC option to include the legacy JDBC connector in the build, the following additional library files are created.

If you build legacy dynamic libraries, they have these names:

libmysqlcppconn.so.7 (Unix)

libmysqlcppconn.7.dylib (macOS)

mysqlcppconn-7-vs14.dll (Windows)

If you build legacy static libraries, they have these names:

libmysqlcppconn-static.a (Unix, macOS)

mysqlcppconn-static.lib (Windows)

这里因为只使用jdbc,所有选择使用libmysqlcppconn-static.a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值