MySQL Forums
Forum List  »  Connector/C++

mysqlcppconn-static.lib not being generated in CMake build
Posted by: YoungRack Choi
Date: May 12, 2025 06:26AM

Hello, I am trying to clone MySQL Connector/C++ 8.4.0 source from the official GitHub repository and build it with CMake and Visual Studio 2022 on Windows.



Goal:
Create a static library (mysqlcppconn-static.lib)

Get the required libraries through direct source build without binary distribution

Environment:
OS: Windows 10

CMake: 3.29.0

Visual Studio: 2022 (v17)

Boost: 1.88.0 (prebuilt)

OpenSSL: 3.x (built from source)

zlib: Manually build and specify path



CMake commands tried:

cmake .. -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=../install -DBUILD_STATIC=ON -DBUILD_SHARED_LIBS=OFF -DMYSQLCPPCONN_BUILD_EXAMPLES=OFF -DMYSQLCPPCONN_DO_BUILD_TESTS=OFF -DBOOST_ROOT=../../boost_1_88_0 -DWITH_SSL=openssl3 -DOPENSSL_ROOT_DIR=C:/dev/openssl -DOPENSSL_INCLUDE_DIR=C:/dev/openssl/include -DOPENSSL_LIBRARIES="C:/dev/openssl/lib/libssl.lib;C:/dev/openssl/lib/libcrypto.lib" -DWITH_ZLIB=C:/dev/zlib -DWITH_ZLIB_INCLUDE_DIR=C:/dev/zlib/include -DWITH_ZLIB_LIB_DIR=C:/dev/zlib/lib -DCMAKE_VERBOSE_MAKEFILE=ON


Issue:
The above command is configured successfully, and the solution file is generated with Visual Studio, but mysqlcppconn-static.lib is not generated in the final build output.

The static library does not exist in the install directory, nor in the lib subfolder.

Related options such as BUILD_STATIC=ON and MYSQLCPPCONN_DO_BUILD_STATIC_JDBC=0 are enabled.

Observation:
The include directory on GitHub does not contain the jdbc folder that exists in the binary distribution (C:/Program Files/MySQL/MySQL Connector C++ 8.4/include).

It also seems that the JDBC-related include path in CMakeLists.txt is not complete.

❓Question:
Are there any additional conditions or preprocessing required for mysqlcppconn-static.lib to be built properly?

Is the include/jdbc folder automatically created when building the binary, or is it something that needs to be secured separately?

I wonder if a separate JDBC source is needed due to differences between the binary distribution and the GitHub source.

Thank you.

P.S.

I have used several OpenSources,
and CMake.

I used OPENSSL and Aslisk SIP with CMake, but I usually used the recommended build options from the official website.

However, this is the first time that it supports so many options as Mysql Connector C++ 8.4, and I have used CMake to bundle several packages, but after trying many times, I felt that Mysql requires many options to link with many packages compared to any Open Source I have used so far.

That is, I am a very beginner developer, so I politely inform you that I need a detailed explanation, so I have written a long introduction.

Also, since I do not have an environment like the above, I would like to build the generated "mysqlcppconn-static.lib" from your company's git hub or from "mysql-connector-c++-8.4.0-src.zip" on the official site when installing the binary distribution file (mysql-connector-c++-8.4.0-winx64.msi) provided on the official site.


However, I have read all the official websites to gain the relevant knowledge, but due to time constraints and my poor English skills, I have reached my limit. Please understand this question.

Options: ReplyQuote


Subject
Views
Written By
Posted
mysqlcppconn-static.lib not being generated in CMake build
238
May 12, 2025 06:26AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.