MySQL Connector/C++ 8.0 源碼編譯


 

平台 

ubuntu 16.04

 

參考文檔: 

https://dev.mysql.com/doc/dev/connector-cpp/8.0/building.html

 

下載源碼

訪問 https://dev.mysql.com/downloads/connector/cpp/ ,選擇source code 下載

 

依賴

編譯 MySQL Connector/C++ 需要 依賴於openssl,mysql,cmake ,boost,libz 等組件,需要事先安裝

 

步驟

以下 以編譯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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM