Skip to content

Windows v1.4.0

Inada Naoki edited this page Jan 18, 2019 · 2 revisions

How I built Windows wheel for v1.4.0

Prerequirements

  • Python 3.7.2 (amd64), 3.6.8 (amd64).
  • Visual Studio Community (C++, CMake, Git for Windows)

Prepare static library for MariaDB Connector/C 3.0.8

> cd c:\mariadb-connector
c:\mariadb-connector> ren mariadb-connector-c-3.0.8-src src
c:\mariadb-connector> mkdir build
c:\mariadb-connector> cd build

c:\mariadb-connector\build>cmake -A x64 ..\src -DCMAKE_BUILD_TYPE=Release -DCLIENT_PLUGIN_DIALOG=static -DCLIENT_PLUGIN_SHA256_PASSWORD=static -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=static
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.16.27026.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_C_FLAGS_DEBUG= /MDd /Z7 /Ob0 /Od /RTC1
-- CMAKE_C_FLAGS_RELEASE= /MD /O2 /Ob2 /DNDEBUG
-- CMAKE_C_FLAGS_RELWITHDEBINFO= /MD /Z7 /O2 /Ob1 /DNDEBUG
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.17.1.windows.2")
-- Looking for include file signal.h
-- Looking for include file signal.h - found
-- Looking for include file ucontext.h
-- Looking for include file ucontext.h - not found
-- Looking for gmtime_r
-- Looking for gmtime_r - not found
-- Looking for localtime_r
-- Looking for localtime_r - not found
-- Looking for snprintf
-- Looking for snprintf - not found
-- Check size of u_int32_t
-- Check size of u_int32_t - failed
-- TLS library/version: Schannel 10.0.17763
-- SYSTEM_LIBS ws2_32;advapi32;kernel32;shlwapi;crypt32;secur32
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
-- Dynamic column API support: ON
-- SYSTEM processor: AMD64
-- MariaDB Connector/c configuration:
-- Static PLUGINS mysql_native_password;dialog;caching_sha2_password;sha256_password;mysql_old_password;pvio_socket
-- Dynamic PLUGINS auth_gssapi_client;mysql_clear_password;pvio_npipe;pvio_shmem
-- CPack generation: ZIP
-- SSL support: SCHANNEL Libs: secur32
-- Zlib support: yes (using bundled zlib)
-- Installation layout: DEFAULT
-- Include files will be installed in include/mariadb
-- Libraries will be installed in lib/mariadb
-- Binaries will be installed in bin
-- Documentation included from
-- Required:
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mariadb-connector/build

c:\mariadb-connector\build>cmake --build . -j 8 --config Release
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/18/2019 11:33:14 AM.
     1>Project "C:\mariadb-connector\build\ALL_BUILD.vcxproj" on node 1 (default targets).
     1>Project "C:\mariadb-connector\build\ALL_BUILD.vcxproj" (1) is building "C:\mariadb-connector\build\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
...
     1>Done Building Project "C:\mariadb-connector\build\ALL_BUILD.vcxproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:27.77

c:\mariadb-connector\build>cmake -DCMAKE_INSTALL_PREFIX=c:\mariadb-connector -DCMAKE_INSTALL_COMPONENT=Development -DCMAKE_BUILD_TYPE=Release -P cmake_install.cmake
-- Install configuration: "Release"
-- Installing: c:\mariadb-connector/include/mariadb/mariadb_com.h
-- Installing: c:\mariadb-connector/include/mariadb/mysql.h
-- Installing: c:\mariadb-connector/include/mariadb/mariadb_stmt.h
-- Installing: c:\mariadb-connector/include/mariadb/ma_pvio.h
-- Installing: c:\mariadb-connector/include/mariadb/ma_tls.h
-- Installing: c:\mariadb-connector/include/mariadb/mariadb_version.h
-- Installing: c:\mariadb-connector/include/mariadb/ma_list.h
-- Installing: c:\mariadb-connector/include/mariadb/errmsg.h
-- Installing: c:\mariadb-connector/include/mariadb/mariadb_dyncol.h
-- Installing: c:\mariadb-connector/include/mariadb/mariadb_ctype.h
-- Installing: c:\mariadb-connector/include/mariadb/mysqld_error.h
-- Installing: c:\mariadb-connector/include/mariadb/mysql/client_plugin.h
-- Installing: c:\mariadb-connector/include/mariadb/mysql/plugin_auth_common.h
-- Installing: c:\mariadb-connector/include/mariadb/mysql/plugin_auth.h
-- Installing: c:\mariadb-connector/include/mariadb/mariadb/ma_io.h
-- Installing: c:\mariadb-connector/lib/mariadb/mariadbclient.lib

Build and release binary wheel

  • check out mysqlclient-python source.

  • edit site.cfg:

diff --git a/site.cfg b/site.cfg
index 6b4596a..bff70d0 100644
--- a/site.cfg
+++ b/site.cfg
@@ -1,6 +1,6 @@
 [options]
 # static: link against a static library
-static = False
+static = True

 # The path to mysql_config.
 # Only use this if mysql_config is not on your PATH, or you have some weird
@@ -9,4 +9,4 @@ static = False

 # http://stackoverflow.com/questions/1972259/mysql-python-install-problem-using-virtualenv-windows-pip
 # Windows connector libs for MySQL. You need a 32-bit connector for your 32-bit Python build.
-connector = C:\Program Files (x86)\MySQL\MySQL Connector C 6.1
+connector = C:\mariadb-connector
> py -3.7 -m pip install -U pip
> py -3.7 -m pip install -U setuptools wheel twine
> py -3.7 setup.py bdist_wheel
> py -3.6 -m pip install -U pip
> py -3.6 -m pip install -U setuptools wheel
> py -3.6 setup.py bdist_wheel
> cd dist
> py -3.7 -m twine upload *.whl
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.