Bug #108959 MinGW build - cannot find boost
Submitted: 1 Nov 2022 19:09 Modified: 2 Nov 2022 14:13
Reporter: Lyubomir Filipov Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:mysql-server-mysql-8.0.31 OS:Ubuntu (Ubuntu 20.10, cmake version 3.16.3)
Assigned to: CPU Architecture:x86
Tags: mingw cmake

[1 Nov 2022 19:09] Lyubomir Filipov
Description:
When trying to configure for MinGW build, cmake cannot find boost, even if it has downloaded it already. Here is the configure log:

nuclear@korhal:~/Downloads/mysql-server-mysql-8.0.31/build$ cmake ..  -DWITH_BOOST=/home/nuclear/boost -DCMAKE_TOOLCHAIN_FILE=/home/nuclear/workspace/mingw-w64-libs/mingw-w64-x86_64.cmake -DLOCAL_BOOST_DIR=/home/nuclear/boost/boost_1_77_0 -DLOCAL_BOOST_ZIP=/home/nuclear/boost/boost_1_77_0.tar.bz2
-- Running cmake version 3.16.3
-- Found Git: /usr/local/bin/git (found version "2.33.0") 
-- CMAKE_MODULE_PATH is /home/nuclear/Downloads/mysql-server-mysql-8.0.31/cmake
-- MySQL 8.0.31
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Source directory /home/nuclear/Downloads/mysql-server-mysql-8.0.31
-- Binary directory /home/nuclear/Downloads/mysql-server-mysql-8.0.31/build
-- CMAKE_GENERATOR: Unix Makefiles
-- MSVC_VERSION is 
-- Check size of void *
-- Check size of void * - done
-- SIZEOF_VOIDP 8
-- Performing Test HAVE_C_FLOATING_POINT_FUSED_MADD
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_C_FLOATING_POINT_FUSED_MADD_EXITCODE (advanced)
   HAVE_C_FLOATING_POINT_FUSED_MADD_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see /home/nuclear/Downloads/mysql-server-mysql-8.0.31/build/TryRunResults.cmake
-- Performing Test HAVE_C_FLOATING_POINT_FUSED_MADD - Failed
-- Performing Test HAVE_CXX_FLOATING_POINT_FUSED_MADD
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_CXX_FLOATING_POINT_FUSED_MADD_EXITCODE (advanced)
   HAVE_CXX_FLOATING_POINT_FUSED_MADD_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see /home/nuclear/Downloads/mysql-server-mysql-8.0.31/build/TryRunResults.cmake
-- Performing Test HAVE_CXX_FLOATING_POINT_FUSED_MADD - Failed
-- Packaging as: mysql-8.0.31-winx64
-- Local boost dir /home/nuclear/boost/boost_1_77_0
-- Local boost zip /home/nuclear/boost/boost_1_77_0.tar.bz2
/home/nuclear/Downloads/mysql-server-mysql-8.0.31/cmake/filesize.bat: 1: @echo: not found
/home/nuclear/Downloads/mysql-server-mysql-8.0.31/cmake/filesize.bat: 2: Syntax error: "(" unexpected
-- Looked for boost/version.hpp in /home/nuclear/boost/boost_1_77_0 and /home/nuclear/boost
-- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND
-- LOCAL_BOOST_DIR /home/nuclear/boost/boost_1_77_0
-- LOCAL_BOOST_ZIP /home/nuclear/boost/boost_1_77_0.tar.bz2
-- Could not find (the correct version of) boost.
-- MySQL currently requires boost_1_77_0

CMake Error at cmake/boost.cmake:108 (MESSAGE):
  You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>

  This CMake script will look for boost in <directory>.  If it is not there,
  it will download and unpack it (in that directory) for you.

  You can also download boost manually, from
  https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2

  If you are inside a firewall, you may need to use an https proxy:

  export https_proxy=http://example.com:80

Call Stack (most recent call first):
  cmake/boost.cmake:277 (COULD_NOT_FIND_BOOST)
  CMakeLists.txt:1540 (INCLUDE)

-- Configuring incomplete, errors occurred!
See also "/home/nuclear/Downloads/mysql-server-mysql-8.0.31/build/CMakeFiles/CMakeOutput.log".
See also "/home/nuclear/Downloads/mysql-server-mysql-8.0.31/build/CMakeFiles/CMakeError.log".

Boost is available at the given location:

nuclear@korhal:~/Downloads/mysql-server-mysql-8.0.31/build$ grep VERSION /home/nuclear/boost/boost_1_77_0/boost/version.hpp 
#ifndef BOOST_VERSION_HPP
#define BOOST_VERSION_HPP
//  BOOST_VERSION % 100 is the patch level
//  BOOST_VERSION / 100 % 1000 is the minor version
//  BOOST_VERSION / 100000 is the major version
#define BOOST_VERSION 107700
//  BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_77"
nuclear@korhal:~/Downloads/mysql-server-mysql-8.0.31/build$ 

The CMake toolchain file that I am using, contains the following:

nuclear@korhal:~/Downloads/mysql-server-mysql-8.0.31/build$ cat ~/workspace/mingw-w64-libs/mingw-w64-x86_64.cmake 
# Sample toolchain file for building for Windows from an Ubuntu Linux system.
#
# Typical usage:
#    *) install cross compiler: `sudo apt-get install mingw-w64`
#    *) cd build
#    *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake ..

set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)

# cross compilers to use for C, C++ and Fortran
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)

# target environment on the build host system
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})

# modify default behavior of FIND_XXX() commands
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

I use this toolchain file for other CMake projects and they build without any problems.

How to repeat:
Happens every time when trying to run cmake
[2 Nov 2022 14:13] MySQL Verification Team
Hi Mr. Filipov,

Thank you for your bug report.

However, we do not support MinGW on Windows. Instead, you should use native tools.

You also can not build on any platform without CMake environment and without proper configuring of all options within our CMake system.

Unsupported.