Q: Я пытаюсь собрать буст с питоном уже неделю. Может решение в неправильно собранном бусте? Какой должна быть конфигурация Boost? Я смотрел репозитории с boost + python, но в них, я так и не нашел решения. Менял 100 раз переменные среды. Копировал чужие Cmakelist. Пробовал скачивать уже собранный boost под MinGW. Хотелось бы писать числодробилки и параллельные вычисления на c++ , а получать результат в Python.
Вот мой  CMakeLists:
project (MyProject)
cmake_minimum_required(VERSION 3.5)

find_package(PythonLibs 3.9 REQUIRED)
find_package(Python 3.9 REQUIRED COMPONENTS Development)
find_package(PythonInterp 3.9 REQUIRED)

find_package(Boost COMPONENTS python)

add_library (
    Liba SHARED  
    main.cpp
)

include_directories (${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})

target_link_libraries (Liba
    ${PYTHON_LIBRARIES}
    ${Boost_LIBRARIES}
)

С помощью скрипта пытаюсь его собрать:
import os

os.system(' cmake . ' +
          ' -G"MinGW Makefiles" ' +
          ' -D CMAKE_MAKE_PROGRAM:FILEPATH="C:/Users/oleja/desktop/gcc/bin/make.exe" ' +
          ' -D CMAKE_CXX_COMPILER:PATH="C:/Users/oleja/desktop/gcc/bin/g++.exe" ' +
          ' -D CMAKE_C_COMPILER:PATH="C:/Users/oleja/desktop/gcc/bin/gcc.exe" ' +
          ' -D Boost_INCLUDE_DIR:PATH="C:/boost_1_78_0/boost" ' +
          ' -D Boost_LIBRARY_DIR:PATH="C:/boost_1_78_0/stage/lib" ' +
          ' -D Python_INCLUDE_DIRS:PATH="C:/Users/oleja/AppData/Local/Programs/Python/Python39/include" '+
          ' -D Python_LIBRARY_DIRS:PATH="C:/Users/oleja/AppData/Local/Programs/Python/Python39/libs" ' +
          ' -D CMAKE_CXX_FLAGS:STRING="-O3" ' +
          ' -D CMAKE_CXX_FLAGS:STRING="-fpic" ' +
          ' -D Boost_DIR:PATH="C:/boost_1_78_0/stage/lib/cmake/Boost-1.78.0" ' +
          ' -D CMAKE_BUILD_TYPE:STRING="RELEASE" ' +
          ' -D CMAKE_CXX_FLAGS:STRING="-shared" ' +
          ' -D CMAKE_CXX_FLAGS:STRING="-export-dynamic" ' 
         )

exit = input()

Пример взял с boost.org:
#include <boost/python.hpp>

char const* greet()
{
   return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

Вывод CMakeLists успешно собран:
python setup.py
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/oleja/desktop/gcc/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/oleja/desktop/gcc/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: C:/Users/oleja/AppData/Local/Programs/Python/Python39/libs/python39.lib (found suitable version "3.9.11", minimum required is "3.9")
-- Found Python: C:/Users/oleja/AppData/Local/Programs/Python/Python39/libs/python39.lib (found suitable version "3.9.11", minimum required is "3.9") found components: Development Development.Module Development.Embed
-- Found PythonInterp: C:/Users/oleja/AppData/Local/Programs/Python/Python39/python.exe (found suitable version "3.9.11", minimum required is "3.9")
-- Found Boost: C:/boost_1_78_0/stage/lib/cmake/Boost-1.78.0/BoostConfig.cmake (found version "1.78.0") found components: python
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    Boost_LIBRARY_DIR

Но при попытке собрать команндой make выдает ошибку:
 make
[ 50%] Building CXX object CMakeFiles/Liba.dir/main.cpp.obj
[100%] Linking CXX shared library libLiba.dll
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text+0xfd): undefined reference to `__imp__ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZNK5boost6python9type_info4nameEv[_ZNK5boost6python9type_info4nameEv]+0x21): undefined reference to `__imp__ZN5boost6python6detail12gcc_demangleEPKc'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZNK5boost6python15to_python_valueIRKPKcEclES5_[_ZNK5boost6python15to_python_valueIRKPKcEclES5_]+0x1d): undefined reference to `__imp__ZN5boost6python9converter19do_return_to_pythonEPKc'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5boost6python3defIPFPKcvEEEvS3_T_[_ZN5boost6python3defIPFPKcvEEEvS3_T_]+0x3e): undefined reference to `__imp__ZN5boost6python6detail17scope_setattr_docEPKcRKNS0_3api6objectES3_'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5boost6python6detail17make_function_auxIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS4_EEEENS0_3api6objectET_RKT0_RKT1_[_ZN5boost6python6detail17make_function_auxIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS4_EEEENS0_3api6objectET_RKT0_RKT1_]+0x4c): undefined reference to `__imp__ZN5boost6python7objects15function_objectERKNS1_11py_functionE'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5boost6python7objects21py_function_impl_baseC2Ev[_ZN5boost6python7objects21py_function_impl_baseC2Ev]+0xb): undefined reference to `__imp__ZTVN5boost6python7objects21py_function_impl_baseE'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS6_EEEEED1Ev[_ZN5boost6python7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS6_EEEEED1Ev]+0x24): undefined reference to `__imp__ZN5boost6python7objects21py_function_impl_baseD2Ev'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5boost6python9converter23expected_pytype_for_argIPKcE10get_pytypeEv[_ZN5boost6python9converter23expected_pytype_for_argIPKcE10get_pytypeEv]+0x1d): undefined reference to `__imp__ZN5boost6python9converter8registry5queryENS0_9type_infoE'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Liba.dir/objects.a(main.cpp.obj):main.cpp:(.text$_ZN5boost6python9converter23expected_pytype_for_argIPKcE10get_pytypeEv[_ZN5boost6python9converter23expected_pytype_for_argIPKcE10get_pytypeEv]+0x38): undefined reference to `__imp__ZNK5boost6python9converter12registration25expected_from_python_typeEv'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: DWARF error: could not find variable specification at offset 223de
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: DWARF error: could not find variable specification at offset 223fa
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: DWARF error: could not find variable specification at offset 22418
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: DWARF error: could not find variable specification at offset 16c75
C:/boost_1_78_0/stage/lib/libboost_python39-mgw10-mt-d-x64-1_78.a(function.o):C:/Users/oleja/AppData/Local/Programs/Python/Python39/Include/cpython/objimpl.h:69: undefined reference to `__imp_PyType_GetFlags'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/boost_1_78_0/stage/lib/libboost_python39-mgw10-mt-d-x64-1_78.a(function.o): in function `_PyObject_INIT':
C:/Users/oleja/AppData/Local/Programs/Python/Python39/Include/cpython/objimpl.h:72: undefined reference to `__imp__Py_NewReference'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/boost_1_78_0/stage/lib/libboost_python39-mgw10-mt-d-x64-1_78.a(function.o): in function `boost::python::objects::function::function(boost::python::objects::py_function const&, boost::python::detail::keyword const*, unsigned int)':
C:\boost_1_78_0/libs/python/src/object/function.cpp:76: undefined reference to `__imp_PyTuple_New'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:110: undefined reference to `__imp_PyType_Type'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:111: undefined reference to `__imp_PyType_Ready'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/boost_1_78_0/stage/lib/libboost_python39-mgw10-mt-d-x64-1_78.a(function.o): in function `boost::python::objects::function::call(_object*, _object*) const':
C:\boost_1_78_0/libs/python/src/object/function.cpp:126: undefined reference to `__imp_PyDict_Size'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:157: undefined reference to `__imp_PyTuple_Size'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:165: undefined reference to `__imp_PyTuple_New'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:184: undefined reference to `__imp_PyDict_GetItem'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:196: undefined reference to `__imp_PyErr_Clear'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\boost_1_78_0/libs/python/src/object/function.cpp:229: undefined reference to `__imp_PyErr_Occurred'
c:/users/oleja/desktop/gcc/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/boost_1_78_0/stage/lib/libboost_python39-mgw10-mt-d-x64-1_78.a(function.o): in function `boost::python::objects::function::argument_error(_object*, _object*) 

Собирал Boost коммадой:
b2 toolset=gcc threading=multi address-model=64


A: Я пытался использовать msys2, но к сожалению ничего не вышло. Для меня выходом стало использование ctypes.
