bfgroup / b2

B2 makes it easy to build C++ projects, everywhere.
https://www.bfgroup.xyz/b2/
Boost Software License 1.0
75 stars 228 forks source link

b2 fails to build for clang 3.6 #354

Closed anarthal closed 7 months ago

anarthal commented 8 months ago

Make sure you completed the following tasks

Environment and version details

Place output of "b2 --debug-configuration" here.

Brief problem description

bootstrap.sh doesn't build if the only available compiler is clang 3.6.

Steps to reproduce the issue

Using the Docker image ghcr.io/anarthal-containers/build-clang3_6 (see the Dockerfile definition), run the following commands:

git clone --depth 1 https://github.com/boostorg/boost
cd boost
git submodule update -q --init tools/build
./bootstrap.sh 

Fails with the following output:

Building B2 engine..

###
###
### Using 'clang' toolset.
###
###

Ubuntu clang version 3.6.2-3ubuntu2 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: x86_64-pc-linux-gnu
Thread model: posix

###
###

> clang++ -x c++ -std=c++11 -pthread -O3 -s -Wno-deprecated-declarations -DNDEBUG bindjam.cpp builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp tasks.cpp timestamp.cpp value.cpp variable.cpp w32_getreg.cpp mod_jam_builtin.cpp mod_jam_class.cpp mod_jam_errors.cpp mod_jam_modules.cpp mod_order.cpp mod_path.cpp mod_property_set.cpp mod_regex.cpp mod_sequence.cpp mod_set.cpp mod_string.cpp mod_sysinfo.cpp mod_version.cpp -o b2
function.cpp:291:20: warning: unknown attribute 'no_sanitize' ignored [-Wunknown-attributes]
    __attribute__((no_sanitize("undefined")))
                   ^
1 warning generated.
hash.cpp:279:16: warning: unknown attribute 'no_sanitize' ignored [-Wunknown-attributes]
__attribute__((no_sanitize("undefined")))
               ^
1 warning generated.
mod_regex.cpp:30:11: error: no matching constructor for initialization of 'string_t' (aka 'basic_string<char>')
        string_t string { std::get<0>(string_separator) };
                 ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:390:7: note: candidate constructor not viable: no known
      conversion from 'const __tuple_element_t<0UL, tuple<b2::value_ref, b2::value_ref> >' (aka 'const b2::value_ref') to 'const std::allocator<char>' for 1st
      argument
      basic_string(const _Alloc& __a)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:398:7: note: candidate constructor not viable: no known
      conversion from 'const __tuple_element_t<0UL, tuple<b2::value_ref, b2::value_ref> >' (aka 'const b2::value_ref') to
      'const std::__cxx11::basic_string<char> &' for 1st argument
      basic_string(const basic_string& __str)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:454:7: note: candidate constructor not viable: no known
      conversion from 'const __tuple_element_t<0UL, tuple<b2::value_ref, b2::value_ref> >' (aka 'const b2::value_ref') to 'const char *' for 1st argument
      basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:476:7: note: candidate constructor not viable: no known
      conversion from 'const __tuple_element_t<0UL, tuple<b2::value_ref, b2::value_ref> >' (aka 'const b2::value_ref') to
      'std::__cxx11::basic_string<char> &&' for 1st argument
      basic_string(basic_string&& __str) noexcept
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:503:7: note: candidate constructor not viable: no known
      conversion from 'const __tuple_element_t<0UL, tuple<b2::value_ref, b2::value_ref> >' (aka 'const b2::value_ref') to 'initializer_list<char>' for 1st
      argument
      basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:534:9: note: candidate constructor template not viable: requires
      at least 2 arguments, but 1 was provided
        basic_string(_InputIterator __beg, _InputIterator __end,
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:379:7: note: candidate constructor not viable: requires 0
      arguments, but 1 was provided
      basic_string()
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:507:7: note: candidate constructor not viable: requires 2
      arguments, but 1 was provided
      basic_string(const basic_string& __str, const _Alloc& __a)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:511:7: note: candidate constructor not viable: requires 2
      arguments, but 1 was provided
      basic_string(basic_string&& __str, const _Alloc& __a)
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:410:7: note: candidate constructor not viable: requires at least
      2 arguments, but 1 was provided
      basic_string(const basic_string& __str, size_type __pos,
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:444:7: note: candidate constructor not viable: requires at least
      2 arguments, but 1 was provided
      basic_string(const _CharT* __s, size_type __n,
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:464:7: note: candidate constructor not viable: requires at least
      2 arguments, but 1 was provided
      basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/basic_string.h:426:7: note: candidate constructor not viable: requires 4
      arguments, but 1 was provided
      basic_string(const basic_string& __str, size_type __pos,
      ^
1 error generated.

Failed to build B2 build engine

The issue seems to be related to this behavior.

Actual behavior summary

I'd like it to build :)

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

This has been found by this Boost.MySQL CI, so it's currently making develop and master builds fail. If this can be solved fast on your side, I can wait - otherwise, I'll replace the clang 3.6 build for a clang 3.7 one, or look for a workaround.

Thanks, Ruben.

Flamefire commented 8 months ago

Possible fix:

- string_t string { std::get<0>(string_separator) };
+ string_t string = std::get<0>(string_separator);

See https://godbolt.org/z/19Ev7nxxf