Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build boost/1.85.0 recipe with latest Visual Studio 2022 build tools (version 17.10) due to known issue with b2/4.10.1 #16465

Closed
marvin-the-mathematician opened this issue Jun 12, 2024 · 16 comments
Assignees

Comments

@marvin-the-mathematician
Copy link

marvin-the-mathematician commented Jun 12, 2024

Describe the bug

When attempting to build boost/1.85.0 using an invocation of conan install ... in a Windows docker build step (which has access to the latest Visual Studio 2022 build tools at version 17.10) the build fails with the error message:
...
boost/1.85.0: ERROR:
Package '5b206d5bc0af0b57e57d2785127443f36883ffbb' build failed
boost/1.85.0: WARN: Build folder C:\Users\ContainerAdministrator.conan2\p\b\booste815830283dfd\b\build-release
ERROR: boost/1.85.0: Error in build() method, line 1130
self.run(full_command)
ConanException: Error 1 while executing

How to reproduce it

The docker file is as follows:

# escape=`

# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.

FROM mcr.microsoft.com/windows/servercore:10.0.20348.1249

# Reset the shell.
SHELL ["cmd", "/S", "/C"]

# Set up environment to collect install errors.
COPY .\docker\Install.cmd C:\TEMP\
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe

# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/17/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman

# Download and install Build Tools for Visual Studio 2022 for native desktop workload.
ADD https://aka.ms/vs/17/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
    --channelUri C:\TEMP\VisualStudio.chman `
    --installChannelUri C:\TEMP\VisualStudio.chman `
    --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools `
    --add Microsoft.VisualStudio.Workload.VCTools `
    --add Microsoft.VisualStudio.Component.VC.ATLMFC `
    --includeRecommended `
    --installPath C:\BuildTools

# Reset the shell.
SHELL ["powershell.exe", "-Command"]

# Install chocolatey...
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; `
    [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
    iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Install git using chocolatey...
RUN choco install git.install -y

# Install cmake using chocolatey and add it to system path...
RUN choco install cmake.install --installargs '"ADD_CMAKE_TO_PATH=System"' -y

ARG PYTHON_VERSION=3.12.3

# Install pyenv...
RUN Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; `
    ./install-pyenv-win.ps1

# Install Python using pyenv...
RUN pyenv install $Env:PYTHON_VERSION; `
    pyenv global $Env:PYTHON_VERSION

ARG CONAN_VERSION=2.4.1

# Install conan from Python...
RUN python -m pip install --upgrade pip; `
    pip install conan==$Env:CONAN_VERSION; `
    conan profile detect

COPY .\conan\profiles\windows-x86_64-msvc194-release C:\TEMP\
RUN conan config install C:\TEMP\windows-x86_64-msvc194-release --type=file --target-folder=profiles; `
    Remove-Item -Path C:\TEMP\windows-x86_64-msvc194-release

RUN Import-Module C:\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll; `
    Enter-VsDevShell -VsInstallPath C:\BuildTools -SkipAutomaticLocation -DevCmdArguments '"-arch=x64 -no_logo"'; `
    conan install `
      --requires=boost/1.85.0 `
      --profile:all=windows-x86_64-msvc194-release `
      --options:all='*:shared=False' `
      --build='missing:*'

# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

The windows-x86_64-msvc194-release conan profile that is installed and used is simply:

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.version=194
os=Windows

The final failing step in the docker build log is:

Step 20/21 : RUN Import-Module C:\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll;     Enter-VsDevShell -VsInstallPath C:\BuildTools -SkipAutomaticLocation -DevCmdArguments '"-arch=x64 -no_logo"';     conan install       --requires=boost/1.85.0       --profile:all=windows-x86_64-msvc194-release       --options:all='*:shared=False'       --build='missing:*'
 ---> Running in ee385ca10aac
 ...
boost/1.85.0: Sources downloaded from 'conancenter'
boost/1.85.0: Calling source() in C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src
boost/1.85.0: Downloading 124.0MB boost_1_85_0.tar.bz2
boost/1.85.0: Apply patch (conan): Optional flag to specify iconv from either libc of libiconv
-------- Installing package boost/1.85.0 (4 of 4) --------
boost/1.85.0: Building from source
boost/1.85.0: Package boost/1.85.0:5b206d5bc0af0b57e57d2785127443f36883ffbb
boost/1.85.0: Building your package in C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\b
boost/1.85.0: Calling generate()
boost/1.85.0: Generators folder: C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\b\build-release\conan
boost/1.85.0: Generating aggregated env files
boost/1.85.0: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
boost/1.85.0: Calling build()
boost/1.85.0: WARN: replace_in_file didn't find pattern '/* thread_local */' in 'C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.85.0: WARN: replace_in_file didn't find pattern '/* static __thread */' in 'C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\boost\stacktrace\detail\libbacktrace_impls.hpp' file.
boost/1.85.0: WARN: replace_in_file didn't find pattern 'local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;' in 'C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.85.0: WARN: replace_in_file didn't find pattern 'local no-threading = android beos haiku sgi darwin vxworks ;' in 'C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\tools\build\src\tools\gcc.jam' file.
boost/1.85.0: WARN: Patching user-config.jam
boost/1.85.0: WARN: 
using zlib : 1.3.1 : <include>"C:/Users/ContainerAdministrator/.conan2/p/b/zlib912a6d980884f/p/include" <search>"C:/Users/ContainerAdministrator/.conan2/p/b/zlib912a6d980884f/p/lib" <name>zlib ;
using bzip2 : 1.0.8 : <include>"C:/Users/ContainerAdministrator/.conan2/p/b/bzip2d198e062ae404/p/include" <search>"C:/Users/ContainerAdministrator/.conan2/p/b/bzip2d198e062ae404/p/lib" <name>bz2 ;
using "msvc" : 14.3 :  : 
 ;
boost/1.85.0: WARN: b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=shared runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\p -j16 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\b\build-release"
boost/1.85.0: RUN: b2 -q target-os=windows architecture=x86 address-model=64 binary-format=pe abi=ms --layout=system --user-config=C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\tools\build\user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.icu=off --disable-icu boost.locale.iconv=off --disable-iconv runtime-link=shared runtime-debugging=off threading=multi visibility=hidden link=static variant=release --with-atomic --with-charconv --with-chrono --with-cobalt --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-url --with-wave toolset=msvc cxxstd=20 pch=on linkflags="" cxxflags="-fPIC" install --prefix=C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\p -j16 --abbreviate-paths -d0 --debug-configuration --build-dir="C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\b\build-release"
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
[vcvarsall.bat] Environment initialized for: 'x64'
notice: found boost-build.jam at C:/Users/ContainerAdministrator/.conan2/p/boostf75e2cd16815f/s/src/boost-build.jam
notice: loading B2 from C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/kernel/bootstrap.jam
notice: Searching 'C:\Windows' 'C:\Users\ContainerAdministrator' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/kernel' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/util' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/build' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/tools' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/contrib' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/.' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in 'C:\Windows' 'C:\Users\ContainerAdministrator' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/kernel' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/util' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/build' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/tools' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/contrib' 'C:/Users/ContainerAdministrator/.conan2/p/b282792f1d1bde7/p/bin/.b2/.'.
notice: Loading explicitly specified user configuration file:
    C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\tools\build\user-config.jam
notice: Searching 'C:\Users\ContainerAdministrator\.conan2\p\boostf75e2cd16815f\s\src\tools\build' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from 'C:/Users/ContainerAdministrator/.conan2/p/boostf75e2cd16815f/s/src/tools/build'.
notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: [bzip2] Using pre-installed library
notice: [bzip2] Condition
notice: [msvc-cfg] msvc-14.3 detected, command: 'C:\BuildTools\VC\Tools\MSVC\14.40.3[380](https://gitlab.corp.five.ai/pipelines/scenario-database-and-sdl/scenario-definition-cpp/-/jobs/9792942#L380)7\bin\Hostx64\x64\cl.exe'
notice: will use 'C:\BuildTools\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe' for msvc, condition <toolset>msvc-14.3
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>x86/<address-model>32', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>/<address-model>32', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>x86/<address-model>64', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>/<address-model>64', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>x86/<address-model>', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>/<address-model>', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>ia64/<address-model>64', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>ia64/<address-model>', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>arm/<address-model>32', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>arm/<address-model>64', setup: 'C:/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/vcvarsall.bat'
notice: [zlib] zlib is already configured
notice: [bzip2] bzip is already configured
notice: iostreams: not using lzma compression 
notice: iostreams: not using zstd compression 
notice: [python-cfg] Configuring python...
notice: [python-cfg] Checking interpreter command "python"...
notice: [python-cfg] running command 'DIR /-C /A:S "C:\Users\ContainerAdministrator\.pyenv\pyenv-win\versions\3.12.3\python.exe" 2>&1'
notice: [python-cfg] running command 'python -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg]   interpreter command: "python"
notice: [python-cfg]   include path: "C:\Users\ContainerAdministrator\.pyenv\pyenv-win\versions\3.12.3\Include"
notice: [python-cfg]   library path: "C:\Users\ContainerAdministrator\.pyenv\pyenv-win\versions\3.12.3\libs"
notice: [python-cfg]   DLL search path: "C:\Users\ContainerAdministrator\.pyenv\pyenv-win\versions\3.12.3"
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command 'python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
notice: [python-cfg] NumPy disabled. Reason:
notice: [python-cfg]   python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())" aborted with 
notice: [python-cfg]   Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
Performing configuration checks
    - default address-model    : none [1]
    - default architecture     : none [1]
    - compiler supports SSE2   : no [2]
    - compiler supports SSE4.1 : no [2]
    - cxx11_static_assert      : no [2]
    - compiler supports SSE2   : no [3]
    - compiler supports SSE4.1 : no [3]
    - cxx11_static_assert      : no [3]
    - cxx11_variadic_templates : no [2]
    - cxx11_variadic_templates : no [3]
    - cxx11_hdr_ratio          : no [2]
    - cxx11_hdr_ratio          : no [3]
    - cxx20_hdr_concepts       : no [2]
    - cxx20_hdr_concepts       : no [3]
    - has std::atomic_ref      : no [2]
    - has statx                : no [2]
    - has statx syscall        : no [2]
    - has BCrypt API           : no [2]
    - is Windows CE            : no [2]
    - has init_priority attribute : no [2]
    - has stat::st_blksize     : no [2]
    - has stat::st_mtim        : no [2]
    - has stat::st_mtimensec   : no [2]
    - has stat::st_mtimespec   : no [2]
    - has stat::st_birthtim    : no [2]
    - has stat::st_birthtimensec : no [2]
    - has stat::st_birthtimespec : no [2]
    - has fdopendir(O_NOFOLLOW) : no [2]
    - has dirent::d_type       : no [2]
    - has POSIX *at APIs       : no [2]
    - has fallocate            : no [2]
    - cxx11_rvalue_references  : no [2]
    - has std::atomic_ref      : no [3]
    - has statx                : no [3]
    - has statx syscall        : no [3]
    - has BCrypt API           : no [3]
    - is Windows CE            : no [3]
    - cxx11_rvalue_references  : no [3]
    - has_icu builds           : no [2]
    - zlib                     : no [4]
    - bzip2                    : no [4]
    - cxx11_constexpr          : no [2]
    - cxx11_constexpr          : no [3]
    - cxx11_auto_declarations  : no [2]
    - cxx11_auto_declarations  : no [3]
    - native atomic int32 supported : no [2]
    - has message compiler     : no [2]
    - native syslog supported  : no [2]
    - pthread supports robust mutexes : no [2]
    - Boost.Regex is header-only : no [2]
    - compiler supports SSSE3  : no [2]
    - compiler supports AVX2   : no [2]
    - compiler supports SSSE3  : no [3]
    - compiler supports AVX2   : no [3]
    - native atomic int32 supported : no [3]
    - has message compiler     : no [3]
    - native syslog supported  : no [3]
    - pthread supports robust mutexes : no [3]
    - cxx11_lambdas            : no [2]
    - cxx11_lambdas            : no [3]
    - gcc visibility           : no [2]
    - cxx11_noexcept           : no [2]
    - gcc visibility           : no [3]
    - cxx11_noexcept           : no [3]
    - std_wstreambuf builds    : no [2]
    - std_wstreambuf           : no [2]
    - std_wstreambuf           : no [3]
    - BOOST_COMP_GNUC >= 4.3.0 : no [2]
[1] msvc-14.3
[2] msvc-14.3/rls/adrs-mdl-64/archt-x86/bst.l-off/bst.l-off/cxstd-20-iso/lnk-sttc/pythn-3.12/thrdp-wn32/thrd-mlt/vsblt-hdn
[3] msvc-14.3/rls/adrs-mdl-64/archt-x86/bst.l-off/bst.l-off/bld-no/cxstd-20-iso/lnk-sttc/pythn-3.12/thrdp-wn32/thrd-mlt/vsblt-hdn
[4] lnk-sttc
Component configuration:
    - atomic                   : building
    - charconv                 : building
    - chrono                   : building
    - cobalt                   : building
    - container                : building
    - context                  : building
    - contract                 : building
    - coroutine                : building
    - date_time                : building
    - exception                : building
    - fiber                    : not building
    - filesystem               : building
    - graph                    : building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : building
    - json                     : building
    - locale                   : building
    - log                      : building
    - math                     : building
    - mpi                      : not building
    - nowide                   : building
    - program_options          : building
    - python                   : not building
    - random                   : building
    - regex                    : building
    - serialization            : building
    - stacktrace               : building
    - system                   : building
    - test                     : building
    - thread                   : building
    - timer                    : building
    - type_erasure             : building
    - url                      : building
    - wave                     : building
...

boost/1.85.0: ERROR: 
Package '5b206d5bc0af0b57e57d2785127443f36883ffbb' build failed
boost/1.85.0: WARN: Build folder C:\Users\ContainerAdministrator\.conan2\p\b\booste815830283dfd\b\build-release
ERROR: boost/1.85.0: Error in build() method, line 1130
	self.run(full_command)
	ConanException: Error 1 while executing
The command 'powershell.exe -Command Import-Module C:\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll;     Enter-VsDevShell -VsInstallPath C:\BuildTools -SkipAutomaticLocation -DevCmdArguments '"-arch=x64 -no_logo"';     conan install       --requires=boost/1.85.0       --profile:all=windows-x86_64-msvc194-release       --options:all='*:shared=False'       --build='missing:*'' returned a non-zero code: 1
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1

It looks to me that the msvc toolset isn't being properly identified by b2 since all of the compiler sanity checks performed by b2 above return no (or none) I suspect it has to do with the b2 issues fixed here (bfgroup/b2#394).

My question is how do I work around this in the short term - until the b2 fix makes its way into the conan boost recipe? Everything is working fine with the Visual Studio 2022 build tools version 17.9.7, but it seems very involved to try to specify a non-latest version of the Visual Studio vs_buildtools.exe bootstrapper in my docker file (I am looking into it) and so it seems I am stuck with version 17.10+ (what I get when using the https://aka.ms/vs/17/release/channel and https://aka.ms/vs/17/release/vs_buildtools.exe URLs in the docker file) for now unfortunately. I would think this will affect a good number of users in any case, so should probably be addressed as part of the boost conan recipe anyway (if possible). Unfortunately, it seems b2/5.0.0 is the next release after b2/4.10.1 and that seems to drop backwards compatibility in some way - not sure if that is a problem for building boost or not and not yet sure whether that release contains the necessary patch anyway (I will take a quick look now).

Any suggestions gratefully received. Thanks.

@marvin-the-mathematician
Copy link
Author

It seems the b2 fix (bfgroup/b2@f695420) is only present in the latest release of b2, that is 5.2.0 (and not in either 5.0.0 or in 5.1.0):

git merge-base 2d756eb245e9898cbeb3212ca1716038927329a8 --is-ancestor 5.2.0 && echo yes || echo no
yes

and

git merge-base 2d756eb245e9898cbeb3212ca1716038927329a8 --is-ancestor 5.1.0 && echo yes || echo no
no

@marvin-the-mathematician
Copy link
Author

marvin-the-mathematician commented Jun 12, 2024

So is there any chance of adding a recipe for b2/5.2.0 and then making that a dependency of boost/1.85.0? If not, any chance that I could be pointed at the relevant docs to help me achieve a similar outcome at my end? I am relatively new to Conan package management so I might need a bit of hand-holding (sorry). I do have a Conan repo set up in a private Artifactory instance though and so forking (https://github.com/conan-io/conan-center-index), making the necessary changes, and pushing the resulting packages up to my private conan repository is definitely a possibility. Many thanks.

@memsharded memsharded self-assigned this Jun 12, 2024
@memsharded
Copy link
Member

Hi @marvin-the-mathematician

The PR conan-io/conan-center-index#24288 was merged hours ago, so the new b2/5.2.0 version should already be in ConanCenter. Can you please try updating your dependencies? In your case, if working from a fork, it means pulling the latest conan-center-index changes, and building latest b2 from source.

@marvin-the-mathematician
Copy link
Author

Thanks for the prompt reply (I really appreciate it).

I did see that there was a b2/5.2.0 recipe here (https://github.com/conan-io/conan-center-index/blob/master/recipes/b2/config.yml), but the boost/1.85.0 recipe currently looks to have a pinned tool_requires dependency on b2/4.10.1 (https://conan.io/center/recipes/boost?version=). And so I am currently relying on that pinned dependency to pick up the right version of b2. I am only requiring boost/1.85.0 in my current conan install ... invocation.

Apologies, but my Conan skills don't currently stretch to figuring out how to override that pinned dependency. Is there a way to override it?

@memsharded
Copy link
Member

You might be able to overwrite it adding to your profile:

...
[tool_requires]
b2/5.2.0

And then passing that profile to your conan command.
I guess the recipe for boost in conan-center-index will soon update to the latest b2, but in the meantime that might help.

@marvin-the-mathematician
Copy link
Author

marvin-the-mathematician commented Jun 12, 2024

Unfortunately using to following conan install ... invocation below doesn't work:

RUN Import-Module C:\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll; `
    Enter-VsDevShell -VsInstallPath C:\BuildTools -SkipAutomaticLocation -DevCmdArguments '"-arch=x64 -no_logo"'; `
    cmake --version; `
    python --version; `
    conan --version; `
    conan install `
      --requires=boost/1.85.0 `
      --tool-requires=b2/5.2.0 `
      --profile:all=windows-x86_64-msvc194-release `
      --options:all='*:shared=False' `
      --build='missing:*'

Both b2/4.10.1 and b2/5.2.0 are installed side by side and the former gets used during the boost/1.85.0 build (leading to the issue as reported). I will try overriding the version of b2 in the profile, but I suspect I'll get a similar result.

There is a narrow possibility that I may be able to specify the vc143 toolset through a b2 option, but if that doesn't work I suspect I'll have to fork the recipe, make the necessary patch and host the resulting packages (and recipes) in a private remote Conan cache. A little annoying that such a standard dependency, i.e. boost, is causing me so much trouble (it has to be said) and I suspect this will impact many Windows CI pipelines that use the Visual Studio 2022 version 17.x build tools. But until I figure out how to control the exact version of the Visual Studio 2022 build tools that get installed into the Windows Docker image I am somewhat at the mercy of Microsoft's (strange) versioning strategies. Thanks for the help in any case.

I would appreciate this issue being kept open until the vanilla Visual Studio 2022 version 17.10 build of boost/1.850 is possible without issue. Thanks.

@marvin-the-mathematician
Copy link
Author

marvin-the-mathematician commented Jun 12, 2024

Good news! You were right (and I was wrong) :-) Adding:

...
[tool_requires]
b2/5.2.0

to the windows-x86_64-msvc194-release conan profile used in the conan install ... invocation above did have the effect of overriding the b2/4.10.1 dependency of the boost/1.85.0 recipe. I am currently waiting to see if the actual build succeeds... Fingers crossed. Is this behaviour (that profile settings override other settings) documented somewhere? It would be good to cement my new found knowledge on the subject of setting precedence. In any case, I'll let you know whether the build succeeds in due course. Thanks again.

@memsharded
Copy link
Member

Yes, the difference is that

--requires=boost/1.85.0 `
      --tool-requires=b2/5.2.0 `

Installs the tool-requires for yourself but not for boost, while the profile [tool_requires] inject the tool-requires in all packages, including boost.

@marvin-the-mathematician
Copy link
Author

marvin-the-mathematician commented Jun 12, 2024

Okay. Thanks for the clarification. Just to confirm, I was able to build and package boost/1.85.0 using the Visual Studio 2022 version 17.10 build tools (and the given conan profile - arch=x86_64, build_type=Release, compiler=msvc, compiler.cppstd=20, compiler.version=194, os=Windows, etc.) using the suggested workaround above. See the logs below:

...
Performing configuration checks
    - default address-model    : 64-bit [1]
    - default architecture     : x86 [1]
    - compiler supports SSE2   : yes [2]
    - compiler supports SSE4.1 : yes [2]
    - cxx11_static_assert      : yes [2]
    - has synchronization.lib  : yes [2]
    - cxx11_variadic_templates : yes [2]
    - cxx11_decltype           : yes [2]
    - GCC libquadmath and __float128 support : no [2]
    - cxx11_hdr_ratio          : yes [2]
    - cxx11_template_aliases   : yes [2]
    - cxx11_char16_t           : yes [2]
    - cxx11_char32_t           : yes [2]
    - cxx20_hdr_concepts       : yes [2]
    - cpp_lib_memory_resource  : yes [2]
warning: non-free usage requirements <boost.cobalt.pmr>std ignored
warning: in main-target boost_cobalt at libs\cobalt\build\Jamfile:73
    - has std::atomic_ref      : yes [2]
    - has statx                : no [2]
    - has statx syscall        : no [2]
    - has BCrypt API           : yes [2]
    - has init_priority attribute : no [2]
    - has stat::st_blksize     : no [2]
    - has stat::st_mtim        : no [2]
    - has stat::st_mtimensec   : no [2]
    - has stat::st_mtimespec   : no [2]
    - has stat::st_birthtim    : no [2]
    - has stat::st_birthtimensec : no [2]
    - has stat::st_birthtimespec : no [2]
    - has fdopendir(O_NOFOLLOW) : no [2]
    - has dirent::d_type       : no [2]
    - has POSIX *at APIs       : no [2]
    - has fallocate            : no [2]
    - cxx11_rvalue_references  : yes [2]
    - cxx11_scoped_enums       : yes [2]
    - cxx11_noexcept           : yes [2]
    - cxx11_nullptr            : yes [2]
    - cxx11_defaulted_functions : yes [2]
    - cxx11_defaulted_moves    : yes [2]
    - cxx11_deleted_functions  : yes [2]
    - cxx11_function_template_default_args : yes [2]
    - cxx11_final              : yes [2]
    - cxx11_override           : yes [2]
    - has_icu builds           : no [2]
    - zlib                     : yes [2]
    - bzip2                    : yes [2]
    - cxx11_constexpr          : yes [2]
    - cxx11_hdr_tuple          : yes [2]
    - cxx11_basic_alignas      : yes [2]
    - cxx11_auto_declarations  : yes [2]
    - cxx11_hdr_functional     : yes [2]
    - cxx11_hdr_type_traits    : yes [2]
    - cxx11_range_based_for    : yes [2]
    - cxx11_smart_ptr          : yes [2]
    - native atomic int32 supported : yes [2]
    - has message compiler     : yes [2]
    - native syslog supported  : no [2]
    - pthread supports robust mutexes : no [2]
    - Boost.Regex is header-only : yes [2]
    - compiler supports SSSE3  : yes [2]
    - compiler supports AVX2   : yes [2]
    - cxx11_lambdas            : yes [2]
    - gcc visibility           : no [2]
    - sfinae_expr              : yes [2]
    - cxx11_unified_initialization_syntax : yes [2]
    - cxx11_hdr_initializer_list : yes [2]
    - cxx11_hdr_chrono         : yes [2]
    - cxx11_thread_local       : yes [2]
    - cxx11_numeric_limits     : yes [2]
    - cxx11_hdr_array          : yes [2]
    - cxx11_hdr_atomic         : yes [2]
    - cxx11_allocator          : yes [2]
    - cxx11_explicit_conversion_operators : yes [2]
    - cxx14_decltype_auto      : yes [2]
    - cxx14_generic_lambdas    : yes [2]
    - cxx14_return_type_deduction : yes [2]
    - cxx14_variable_templates : yes [2]
    - long double support      : yes [2]
    - Has Large File Support   : yes [2]
    - Has attribute init_priority : no [2]
    - std_wstreambuf builds    : yes [2]
    - std_wstreambuf           : yes [2]
    - libbacktrace builds      : no [2]
    - cxx11_rvalue_references  : yes [3]
    - libbacktrace builds      : no [3]
    - addr2line builds         : no [2]
    - addr2line builds         : no [3]
    - WinDbg builds            : yes [2]
    - WinDbg builds            : yes [3]
    - WinDbgCached builds      : yes [2]
    - BOOST_COMP_GNUC >= 4.3.0 : no [2]
    - cxx11_hdr_thread         : yes [2]
    - cxx11_hdr_mutex          : yes [2]
    - cxx11_hdr_regex          : yes [2]
[1] msvc-14.3
[2] msvc-14.3/rls/bst.l-off/bst.l-off/cxstd-20-iso/lnk-sttc/pythn-3.12/thrdp-wn32/thrd-mlt/vsblt-hdn
[3] msvc-14.3/rls/bst.l-off/bst.l-off/bld-no/cxstd-20-iso/lnk-sttc/pythn-3.12/thrdp-wn32/thrd-mlt/vsblt-hdn
Component configuration:
    - atomic                   : building
    - charconv                 : building
    - chrono                   : building
    - cobalt                   : building
    - container                : building
    - context                  : building
    - contract                 : building
    - coroutine                : building
    - date_time                : building
    - exception                : building
    - fiber                    : not building
    - filesystem               : building
    - graph                    : building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : building
    - json                     : building
    - locale                   : building
    - log                      : building
    - math                     : building
    - mpi                      : not building
    - nowide                   : building
    - program_options          : building
    - python                   : not building
    - random                   : building
    - regex                    : building
    - serialization            : building
    - stacktrace               : building
    - system                   : building
    - test                     : building
    - thread                   : building
    - timer                    : building
    - type_erasure             : building
    - url                      : building
    - wave                     : building
boost/1.85.0: Package '5b206d5bc0af0b57e57d2785127[443](https://gitlab.corp.five.ai/pipelines/scenario-database-and-sdl/scenario-definition-cpp/-/jobs/9796950#L443)f36883ffbb' built
boost/1.85.0: Build folder C:\Users\ContainerAdministrator\.conan2\p\b\boost1a02c9af7b2b2\b\build-release
boost/1.85.0: Generating the package
boost/1.85.0: Packaging in folder C:\Users\ContainerAdministrator\.conan2\p\b\boost1a02c9af7b2b2\p
boost/1.85.0: Calling package()
boost/1.85.0: package(): Packaged 15275 '.hpp' files
boost/1.85.0: package(): Packaged 149 '.h' files
boost/1.85.0: package(): Packaged 323 '.ipp' files
boost/1.85.0: package(): Packaged 17 files
boost/1.85.0: package(): Packaged 2 '.inc' files: cpp_re.inc, strict_cpp_re.inc
boost/1.85.0: package(): Packaged 41 '.lib' files
boost/1.85.0: package(): Packaged 1 '.txt' file: LICENSE_1_0.txt
boost/1.85.0: Created package revision 897f9ab02d2f953eff5e3f1ee4f9be5d
boost/1.85.0: Package '5b206d5bc0af0b57e57d2785127443f36883ffbb' created
boost/1.85.0: Full package reference: boost/1.85.0#a68[463](https://gitlab.corp.five.ai/pipelines/scenario-database-and-sdl/scenario-definition-cpp/-/jobs/9796950#L463)169d04e86aceb21ffa9deb6858:5b206d5bc0af0b57e57d2785127443f36883ffbb#897f9ab02d2f953eff5e3f1ee4f9be5d
boost/1.85.0: Package folder C:\Users\ContainerAdministrator\.conan2\p\b\boost1a02c9af7b2b2\p
boost/1.85.0: Disabled magic autolinking (smart and magic decisions)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'env_info' used in: bzip2/1.0.8, b2/5.2.0, boost/1.85.0
WARN: deprecated:     'cpp_info.names' used in: bzip2/1.0.8, zlib/1.3.1, boost/1.85.0
WARN: deprecated:     'cpp_info.build_modules' used in: bzip2/1.0.8
WARN: deprecated:     'cpp_info.filenames' used in: boost/1.85.0
WARN: deprecated:     'user_info' used in: boost/1.85.0
======== Finalizing install (deploy, generators) ========
cli: Generating aggregated env files
cli: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully

So that confirms that the problem was (as suspected) with the b2 dependency. Many thanks for your help. Hopefully, the dependency of boost/1.85.0 on b2/4.10.1 can be bumped up to b2/5.2.0 in due course.

@memsharded
Copy link
Member

I think this might be good feedback for @grafikrobot.
At the moment I don't see any PR updating the boost recipe tool_require to latest b2.
As it is a major version, is there any breaking behavior that should be taken into account? Can the tool_requires be updated to latest b2/5.2.0 even for older boost versions?

@grafikrobot
Copy link
Contributor

I think this might be good feedback for @grafikrobot.

Thank you for the ping.

At the moment I don't see any PR updating the boost recipe tool_require to latest b2.
As it is a major version, is there any breaking behavior that should be taken into account? Can the tool_requires be updated to latest b2/5.2.0 even for older boost versions?

I test B2 releases for Boost versions all the way back to 1.66.0 (for example: https://dev.azure.com/bfgroup/B2/_build/results?buildId=1287&view=logs&j=29508707-2082-586a-124b-f0598eaa1117&t=969d561e-c78e-519e-0c7d-2065d1cf56b7). But the testing is superficial as it doesn't compile anything. It only checks that the build commands generate.

Hence.. Yes, it's likely possible you can update current and previous Boost releases to use the current B2. But I can't fully guarantee it will work identically. :-)

@memsharded
Copy link
Member

Hence.. Yes, it's likely possible you can update current and previous Boost releases to use the current B2. But I can't fully guarantee it will work identically. :-)

Thanks for the feedback!

Sure, things might not be identical, but to make sure, are you aware of some specific changes that will result in very different binaries? Or if things work and compile, we can expect that the binaries will keep being reasonably binary compatible?

@grafikrobot
Copy link
Contributor

Sure, things might not be identical, but to make sure, are you aware of some specific changes that will result in very different binaries? Or if things work and compile, we can expect that the binaries will keep being reasonably binary compatible?

I'm not aware of B2 changes that would affect binary compatibility. Such incompatible changes would be in the Boost jamfiles instead of the B2 tool itself.

@uilianries
Copy link
Member

Hello! I just updated a PR that we have in ConanCenterIndex CI related to Boost, using ranged version for b2:

conan-io/conan-center-index@2e2752c

b2/[>=5.2 <6]

conan-io/conan-center-index#24273

@grafikrobot
Copy link
Contributor

I'm not aware of B2 changes that would affect binary compatibility. Such incompatible changes would be in the Boost jamfiles instead of the B2 tool itself.

Okay, I'm taking back those words. Turns out there's one possible change only in b2/5.2.0 that may cause binary compat issues.. bfgroup/b2@376470f#diff-9a030b36fd0e7f9598dc36b4c932695bdf86ea75ae303f1b6d01e63de97d9f95R1935

That change will affect the ABI of the msvc stdlib. This might only be a problem if people disable exception handling with msvc. But I don't see anything in the Boost recipe that would allow for building Boost with exception handling off. But figured I'd point it out just in case. ;-)

@memsharded
Copy link
Member

Thanks for pointing that out! I have also double-checked the boost recipe, indeed I don't see anything that would allow users to change this, so it seems we are good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants