Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

B2 should fail (non-zero exit code) when "No best alternative" errors occur #544

Open
Labels
bugSomething isn't working
@MungoG

Description

Note: this was discussed with @grisumbras prior to posting this issue.

Make sure you completed the following tasks

Environment and version details

  • Operating System+version: Affects both Linux and Windows
  • Compiler+version: GCC and MSVC
  • Shell: Bash
  • B2 Version: Output of b2 -v and b2 --version: Boost develop branch (Jan 2026). 5.3.2
  • B2 Configuration: Output of b2 --debug-configuration in your project.
testing module modules...
testing module assert...
testing module errors...
testing module args...
warning: No toolsets are configured.
warning: Configuring default toolset "msvc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: https://www.bfgroup.xyz/b2/manual/release/index.html#b2.overview.configuration
Performing configuration checks
 - default address-model : 64-bit (cached) [1]
 - default architecture : x86 (cached) [1]
 - symlinks supported : yes (cached)
 - cxx20_hdr_concepts : yes (cached) [2]
error: No best alternative for libs/capy/test/unit/error with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/executor with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/execution_context with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/read_source with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/read_stream with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/stream with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/write_sink with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/write_stream with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)

Brief problem description

When B2 encounters "No best alternative" errors during target resolution, it prints error messages but still exits with code 0. This causes CI systems to report success when the build actually failed to produce any targets.

Steps to reproduce the issue

  1. Create test targets using glob-tree-ex where multiple source files have the same basename in different directories:

     for local f in [ glob-tree-ex . : *.cpp ]
     {
     run $(f) ;
     }
    
  2. Run B2 with shared linking:

     ./b2 libs/mylib/test toolset=gcc cxxstd=20 link=shared
    

Actual behavior summary

B2 prints error messages but exits with code 0:

error: No best alternative for libs/mylib/test/unit/executor with <address-model>64 <cxxstd>20 <link>shared ...
 matched: (empty)
 matched: (empty)

Expected: B2 should exit with a non-zero exit code when configuration errors like "No best alternative" occur, since no targets were built.

Impact: This silent failure causes problems in CI pipelines - GitHub Actions, Jenkins, etc. report builds as successful, and developers don't notice that tests weren't actually run. The -q (stop-on-error) flag doesn't help because these are configuration errors, not build errors.

Suggestion: Either always exit non-zero when these errors occur, or add a flag like --strict to opt into this behavior.

Version: Tested with B2 from Boost develop branch (February 2026)

If a project of yours is blocked due to this bug, please, mention it explicitly.

notice: found boost-build.jam at C:/dev/repos/MungoG/cursor_boost/boost-build.jam
notice: loading B2 from C:/dev/repos/MungoG/cursor_boost/tools/build/src/build-system.jam
notice: Searching 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\build' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\contrib' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\engine' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\options' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\tools' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\util' 'C:/dev/repos/MungoG/cursor_boost/tools/build/src' for site-config configuration file 'site-config.jam'.
notice: Configuration file 'site-config.jam' not found in 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\build' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\contrib' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\engine' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\options' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\tools' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\util' 'C:/dev/repos/MungoG/cursor_boost/tools/build/src'.
notice: Searching 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\build' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\contrib' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\engine' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\options' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\tools' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\util' 'C:/dev/repos/MungoG/cursor_boost/tools/build/src' for user-config configuration file 'user-config.jam'.
notice: Configuration file 'user-config.jam' not found in 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\Users\MungoGillO365' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\build' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\contrib' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\engine' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\options' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\tools' 'C:\dev\repos\MungoG\cursor_boost\tools\build\src\util' 'C:/dev/repos/MungoG/cursor_boost/tools/build/src'.
notice: Searching '.' for project-config configuration file 'project-config.jam'.
notice: Loading project-config configuration file 'project-config.jam' from '.'.
notice: [openssl] Using pre-installed library
notice: [openssl] Condition
notice: [wolfssl] Using pre-installed library
notice: [wolfssl] Condition
notice: [zlib] Using pre-installed library
notice: [zlib] Condition
notice: [brotli] Using pre-installed library
notice: [brotli] Condition
warning: No toolsets are configured.
warning: Configuring default toolset "msvc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: https://www.bfgroup.xyz/b2/manual/release/index.html#b2.overview.configuration
notice: [msvc-cfg] msvc-14.3 detected, command: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\bin\Hostx64\x64\cl.exe'
notice: will use 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\bin\Hostx64\x64\cl.exe' for msvc, condition <toolset>msvc-14.3
notice: [generate-setup-cmd] 14.44.35207 is 14.3
notice: [generate-setup-cmd] 14.44.35207 is 14.3
notice: [generate-setup-cmd] 14.44.35207 is 14.3
notice: [generate-setup-cmd] 14.44.35207 is 14.3
notice: [generate-setup-cmd] 14.44.35207 is 14.3
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>x86/<address-model>32', setup: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Auxiliary\Build\vcvars32.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>/<address-model>32', setup: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Auxiliary\Build\vcvars32.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>x86/<address-model>64', setup: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Auxiliary\Build\vcvars64.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>/<address-model>64', setup: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Auxiliary\Build\vcvars64.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>x86/<address-model>', setup: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Auxiliary\Build\vcvars64.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>/<address-model>', setup: 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Auxiliary\Build\vcvars64.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>ia64/<address-model>64', setup: 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>ia64/<address-model>', setup: 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>arm/<address-model>32', setup: 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat'
notice: [msvc-cfg] condition: '<toolset>msvc-14.3/<architecture>arm/<address-model>64', setup: 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat'
Performing configuration checks
 - default address-model : 64-bit (cached) [1]
 - default architecture : x86 (cached) [1]
 - symlinks supported : yes (cached)
 - cxx20_hdr_concepts : yes (cached) [2]
error: No best alternative for libs/capy/test/unit/error with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/executor with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/execution_context with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/read_source with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/read_stream with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/stream with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/write_sink with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
error: No best alternative for libs/capy/test/unit/write_stream with <cxxstd>20 <link>shared <threading>multi <visibility>hidden
 matched: (empty)
 matched: (empty)
[1] msvc-14.3
[2] msvc-14.3/debug/x86_64/cxxstd-20-iso/threadapi-win32/threading-multi/visibility-hidden
...patience...
...found 1286 targets...

Expected behavior summary

Either always exit non-zero when these errors occur, or add a flag like --strict to opt into this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /