From 1c414f9192e49963c15bd64cdc2eb308cd046194 Mon Sep 17 00:00:00 2001 From: yurybura Date: Mon, 2 Mar 2020 21:41:27 +0300 Subject: [PATCH] [boost-python] Try to fix build issue on Linux (#9780) * [boost-python] Try to fix build issue on Linux * Update baseline: enable boost-python:x64-linux * Fix number of processor detection on Linux: use CMake module * Fix user-config.jam configuration on Linux * Update baseline: enable boost-mpi:x64-linux * Fix build boost-regex[icu] on Linux, issue #4962 --- .../boost-modular-build-helper/CMakeLists.txt | 13 +----- .../boost-modular-build.cmake | 40 +++++++++++------- .../user-config.jam | 41 +++++++++++++------ ports/boost-python/CONTROL | 4 +- ports/boost-python/portfile.cmake | 13 +++--- scripts/boost/generate-ports.ps1 | 6 +-- scripts/boost/post-source-stubs/python.cmake | 13 +++--- scripts/ci.baseline.txt | 2 - 8 files changed, 76 insertions(+), 56 deletions(-) diff --git a/ports/boost-modular-build-helper/CMakeLists.txt b/ports/boost-modular-build-helper/CMakeLists.txt index dfdd6374e6..8c91184a4b 100644 --- a/ports/boost-modular-build-helper/CMakeLists.txt +++ b/ports/boost-modular-build-helper/CMakeLists.txt @@ -122,17 +122,8 @@ endif() configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam ${CMAKE_CURRENT_BINARY_DIR}/user-config.jam @ONLY) -set(NUMBER_OF_PROCESSORS 1) -if(DEFINED ENV{NUMBER_OF_PROCESSORS}) - set(NUMBER_OF_PROCESSORS $ENV{NUMBER_OF_PROCESSORS}) -elseif(CMAKE_HOST_LINUX) - execute_process( - COMMAND nproc - OUTPUT_VARIABLE NUMBER_OF_PROCESSORS - ) - string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}") - string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}") -endif() +include(ProcessorCount) +ProcessorCount(NUMBER_OF_PROCESSORS) if(NOT NUMBER_OF_PROCESSORS) set(NUMBER_OF_PROCESSORS 1) endif() diff --git a/ports/boost-modular-build-helper/boost-modular-build.cmake b/ports/boost-modular-build-helper/boost-modular-build.cmake index d5529c1273..f254cb5a39 100644 --- a/ports/boost-modular-build-helper/boost-modular-build.cmake +++ b/ports/boost-modular-build-helper/boost-modular-build.cmake @@ -75,17 +75,35 @@ function(boost_modular_build) # endif() if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(configure_option) if(DEFINED _bm_BOOST_CMAKE_FRAGMENT) - set(fragment_option "-DBOOST_CMAKE_FRAGMENT=${_bm_BOOST_CMAKE_FRAGMENT}") + list(APPEND configure_option "-DBOOST_CMAKE_FRAGMENT=${_bm_BOOST_CMAKE_FRAGMENT}") + endif() + if(DEFINED VCPKG_PYTHON_EXECUTABLE) + list(APPEND configure_option "-DVCPKG_PYTHON_EXECUTABLE=${VCPKG_PYTHON_EXECUTABLE}") + endif() + if(DEFINED VCPKG_PYTHON_INCLUDE) + list(APPEND configure_option "-DVCPKG_PYTHON_INCLUDE=${VCPKG_PYTHON_INCLUDE}") + endif() + if(DEFINED VCPKG_PYTHON_LIBS_RELEASE) + list(APPEND configure_option "-DVCPKG_PYTHON_LIBS_RELEASE=${VCPKG_PYTHON_LIBS_RELEASE}") + endif() + if(DEFINED VCPKG_PYTHON_LIBS_DEBUG) + list(APPEND configure_option "-DVCPKG_PYTHON_LIBS_DEBUG=${VCPKG_PYTHON_LIBS_DEBUG}") + endif() + if(DEFINED VCPKG_PYTHON_VERSION) + list(APPEND configure_option "-DVCPKG_PYTHON_VERSION=${VCPKG_PYTHON_VERSION}") endif() vcpkg_configure_cmake( SOURCE_PATH ${CURRENT_INSTALLED_DIR}/share/boost-build PREFER_NINJA OPTIONS + "-DPORT=${PORT}" + "-DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}" "-DB2_EXE=${B2_EXE}" "-DSOURCE_PATH=${_bm_SOURCE_PATH}" "-DBOOST_BUILD_PATH=${BOOST_BUILD_PATH}" - ${fragment_option} + ${configure_option} ) vcpkg_install_cmake() @@ -126,15 +144,10 @@ function(boost_modular_build) ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ) - if(DEFINED ENV{NUMBER_OF_PROCESSORS}) - set(NUMBER_OF_PROCESSORS $ENV{NUMBER_OF_PROCESSORS}) - else() - execute_process( - COMMAND nproc - OUTPUT_VARIABLE NUMBER_OF_PROCESSORS - ) - string(REPLACE "\n" "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}") - string(REPLACE " " "" NUMBER_OF_PROCESSORS "${NUMBER_OF_PROCESSORS}") + include(ProcessorCount) + ProcessorCount(NUMBER_OF_PROCESSORS) + if(NOT NUMBER_OF_PROCESSORS) + set(NUMBER_OF_PROCESSORS 1) endif() ###################### @@ -195,7 +208,6 @@ function(boost_modular_build) list(APPEND _bm_OPTIONS_DBG "cxxflags=${VCPKG_CXX_FLAGS_DEBUG}") endif() - if(VCPKG_C_FLAGS) list(APPEND _bm_OPTIONS "cflags=${VCPKG_C_FLAGS}") endif() @@ -208,7 +220,6 @@ function(boost_modular_build) list(APPEND _bm_OPTIONS_DBG "cflags=${VCPKG_C_FLAGS_DEBUG}") endif() - if(VCPKG_LINKER_FLAGS) list(APPEND _bm_OPTIONS "linkflags=${VCPKG_LINKER_FLAGS}") endif() @@ -221,7 +232,6 @@ function(boost_modular_build) list(APPEND _bm_OPTIONS_DBG "linkflags=${VCPKG_LINKER_FLAGS_DEBUG}") endif() - # Add build type specific options if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") list(APPEND _bm_OPTIONS runtime-link=shared) @@ -246,7 +256,7 @@ function(boost_modular_build) endif() file(TO_CMAKE_PATH "${_bm_DIR}/nothing.bat" NOTHING_BAT) - set(TOOLSET_OPTIONS " /EHsc -Zm800 -nologo") + set(TOOLSET_OPTIONS "/EHsc -Zm800 -nologo") if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") if(NOT VCPKG_PLATFORM_TOOLSET MATCHES "v140") find_path(PATH_TO_CL cl.exe) diff --git a/ports/boost-modular-build-helper/user-config.jam b/ports/boost-modular-build-helper/user-config.jam index 78677c0ab2..9f485fee20 100644 --- a/ports/boost-modular-build-helper/user-config.jam +++ b/ports/boost-modular-build-helper/user-config.jam @@ -2,10 +2,11 @@ import toolset ; if "@VCPKG_PLATFORM_TOOLSET@" != "external" { - using msvc : : cl.exe : - "@NOTHING_BAT@" - @TOOLSET_OPTIONS@ - ; + using msvc : : cl.exe + : + "@NOTHING_BAT@" + @TOOLSET_OPTIONS@ + ; } else { @@ -23,8 +24,8 @@ else if "@PORT@" = "boost-python" { - using python : @PYTHON_VERSION@ : : "@PYTHON_INCLUDE_PATH@" : "@PYTHONLIBS_RELEASE@" ; - using python : @PYTHON_VERSION@ : : "@PYTHON_INCLUDE_PATH@" : "@PYTHONLIBS_DEBUG@" : on ; + using python : @VCPKG_PYTHON_VERSION@ : "@VCPKG_PYTHON_EXECUTABLE@" : "@VCPKG_PYTHON_INCLUDE@" : "@VCPKG_PYTHON_LIBS_RELEASE@" ; + using python : @VCPKG_PYTHON_VERSION@ : "@VCPKG_PYTHON_EXECUTABLE@" : "@VCPKG_PYTHON_INCLUDE@" : "@VCPKG_PYTHON_LIBS_DEBUG@" : on ; } if "@PORT@" = "boost-mpi" @@ -37,16 +38,30 @@ if "@PORT@" = "boost-mpi" project user-config : ; -lib advapi32 ; +if "@VCPKG_PLATFORM_TOOLSET@" != "external" +{ + lib advapi32 ; -lib icuuc : : "@CURRENT_INSTALLED_DIR@/lib/icuuc.lib" release : : advapi32 ; -lib icuuc : : "@CURRENT_INSTALLED_DIR@/debug/lib/icuucd.lib" debug : : advapi32 ; + lib icuuc : : "@CURRENT_INSTALLED_DIR@/lib/icuuc.lib" release : : advapi32 ; + lib icuuc : : "@CURRENT_INSTALLED_DIR@/debug/lib/icuucd.lib" debug : : advapi32 ; -lib icuin : : "@CURRENT_INSTALLED_DIR@/lib/icuin.lib" release : : ; -lib icuin : : "@CURRENT_INSTALLED_DIR@/debug/lib/icuind.lib" debug : : ; + lib icuin : : "@CURRENT_INSTALLED_DIR@/lib/icuin.lib" release : : ; + lib icuin : : "@CURRENT_INSTALLED_DIR@/debug/lib/icuind.lib" debug : : ; -lib icudt : : "@CURRENT_INSTALLED_DIR@/lib/icudt.lib" release : : ; -lib icudt : : "@CURRENT_INSTALLED_DIR@/debug/lib/icudtd.lib" debug : : ; + lib icudt : : "@CURRENT_INSTALLED_DIR@/lib/icudt.lib" release : : ; + lib icudt : : "@CURRENT_INSTALLED_DIR@/debug/lib/icudtd.lib" debug : : ; +} +else +{ + lib icuuc : : "@CURRENT_INSTALLED_DIR@/lib/libicuuc.a" release : : ; + lib icuuc : : "@CURRENT_INSTALLED_DIR@/debug/lib/libicuuc.a" debug : : ; + + lib icuin : : "@CURRENT_INSTALLED_DIR@/lib/libicui18n.a" release : : ; + lib icuin : : "@CURRENT_INSTALLED_DIR@/debug/lib/libicui18n.a" debug : : ; + + lib icudt : : "@CURRENT_INSTALLED_DIR@/lib/libicudata.a" release : : ; + lib icudt : : "@CURRENT_INSTALLED_DIR@/debug/lib/libicudata.a" debug : : ; +} lib iconv : : "@LIBICONV_LIBRARY@" shared shared release : : ; lib iconv : : "@LIBICONV_LIBRARY@" shared shared debug : : ; diff --git a/ports/boost-python/CONTROL b/ports/boost-python/CONTROL index 84e4434a26..b1e0cba236 100644 --- a/ports/boost-python/CONTROL +++ b/ports/boost-python/CONTROL @@ -1,6 +1,6 @@ # Automatically generated by boost-vcpkg-helpers/generate-ports.ps1 Source: boost-python -Version: 1.72.0 -Build-Depends: boost-bind, boost-compatibility, boost-config, boost-conversion, boost-core, boost-detail, boost-foreach, boost-function, boost-graph, boost-integer, boost-iterator, boost-lexical-cast, boost-math, boost-mpl, boost-numeric-conversion, boost-preprocessor, boost-property-map, boost-smart-ptr, boost-static-assert, boost-tuple, boost-type-traits, boost-utility, boost-vcpkg-helpers, python3 (!osx&!linux) +Version: 1.72.0-1 +Build-Depends: boost-bind, boost-compatibility, boost-config, boost-conversion, boost-core, boost-detail, boost-foreach, boost-function, boost-graph, boost-integer, boost-iterator, boost-lexical-cast, boost-math, boost-mpl, boost-numeric-conversion, boost-preprocessor, boost-property-map, boost-smart-ptr, boost-static-assert, boost-tuple, boost-type-traits, boost-utility, boost-vcpkg-helpers, python3 Homepage: https://github.com/boostorg/python Description: Boost python module diff --git a/ports/boost-python/portfile.cmake b/ports/boost-python/portfile.cmake index ec1f706a01..d81d6889cd 100644 --- a/ports/boost-python/portfile.cmake +++ b/ports/boost-python/portfile.cmake @@ -10,11 +10,14 @@ vcpkg_from_github( HEAD_REF master ) -# Find Python. Can't use find_package here, but we already know where everything is -file(GLOB PYTHON_INCLUDE_PATH "${CURRENT_INSTALLED_DIR}/include/python3.*") -set(PYTHONLIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib") -set(PYTHONLIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib") -string(REGEX REPLACE ".*python([0-9\.]+)$" "\\1" PYTHON_VERSION "${PYTHON_INCLUDE_PATH}") +# Find Python3 executable +vcpkg_find_acquire_program(PYTHON3) +set(VCPKG_PYTHON_EXECUTABLE "${PYTHON3}") +# Find Python3 libraries. Can't use find_package here, but we already know where everything is +file(GLOB VCPKG_PYTHON_INCLUDE "${CURRENT_INSTALLED_DIR}/include/python3.*") +set(VCPKG_PYTHON_LIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib") +set(VCPKG_PYTHON_LIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib") +string(REGEX REPLACE ".*python([0-9\.]+).*" "\\1" VCPKG_PYTHON_VERSION "${VCPKG_PYTHON_INCLUDE}") include(${CURRENT_INSTALLED_DIR}/share/boost-build/boost-modular-build.cmake) boost_modular_build(SOURCE_PATH ${SOURCE_PATH}) include(${CURRENT_INSTALLED_DIR}/share/boost-vcpkg-helpers/boost-modular-headers.cmake) diff --git a/scripts/boost/generate-ports.ps1 b/scripts/boost/generate-ports.ps1 index 36ddfe66ea..ec32e53fb3 100644 --- a/scripts/boost/generate-ports.ps1 +++ b/scripts/boost/generate-ports.ps1 @@ -46,9 +46,9 @@ function Generate() $controlDeps = ($Depends | sort) -join ", " $versionSuffix = "" - if ($Name -eq "iostreams") + if ($PortName -eq "iostreams" -or $PortName -eq "python") { - $versionsuffix = "-1" + $versionSuffix = "-1" } mkdir "$portsDir/boost-$PortName" -erroraction SilentlyContinue | out-null @@ -363,7 +363,7 @@ foreach ($library in $libraries) if ($library -eq "python") { - $deps += @("python3 (!osx&!linux)") + $deps += @("python3") $needsBuild = $true } elseif ($library -eq "iostreams") diff --git a/scripts/boost/post-source-stubs/python.cmake b/scripts/boost/post-source-stubs/python.cmake index 5610c489da..5e2ae2b765 100644 --- a/scripts/boost/post-source-stubs/python.cmake +++ b/scripts/boost/post-source-stubs/python.cmake @@ -1,5 +1,8 @@ -# Find Python. Can't use find_package here, but we already know where everything is -file(GLOB PYTHON_INCLUDE_PATH "${CURRENT_INSTALLED_DIR}/include/python3.*") -set(PYTHONLIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib") -set(PYTHONLIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib") -string(REGEX REPLACE ".*python([0-9\.]+)$" "\\1" PYTHON_VERSION "${PYTHON_INCLUDE_PATH}") +# Find Python3 executable +vcpkg_find_acquire_program(PYTHON3) +set(VCPKG_PYTHON_EXECUTABLE "${PYTHON3}") +# Find Python3 libraries. Can't use find_package here, but we already know where everything is +file(GLOB VCPKG_PYTHON_INCLUDE "${CURRENT_INSTALLED_DIR}/include/python3.*") +set(VCPKG_PYTHON_LIBS_RELEASE "${CURRENT_INSTALLED_DIR}/lib") +set(VCPKG_PYTHON_LIBS_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib") +string(REGEX REPLACE ".*python([0-9\.]+).*" "\\1" VCPKG_PYTHON_VERSION "${VCPKG_PYTHON_INCLUDE}") diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 2d51cf5461..6c459506bf 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -171,8 +171,6 @@ boost-locale:arm-uwp=fail boost-locale:x64-uwp=fail boost-log:arm-uwp=fail boost-log:x64-uwp=fail -boost-python:x64-linux=ignore -boost-mpi:x64-linux=fail boost-mpi:x64-osx=fail boost-stacktrace:arm-uwp=fail boost-stacktrace:x64-uwp=fail