dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

C++20 breaks alpine-linux clang #57074

Closed ntkme closed 7 hours ago

ntkme commented 1 day ago

https://github.com/dart-lang/sdk/commit/0a238b382891f8f3164d5ee561468e160f3c554f breaks compiling binaryen component on alpine linux's clang++ as seen here:

https://github.com/dart-musl/dart/actions/runs/11808398407/job/32897032419

[27/3591] CXX obj/third_party/binaryen/src/third_party/llvm-project/binaryen_sources.Path.o
ninja: job failed: /usr/bin/clang++ -MMD -MF obj/third_party/binaryen/src/src/tools/wasm-opt.wasm-opt.o.d -DNDEBUG -I../../third_party/binaryen/src/src -I../../third_party/binaryen/src/third_party/FP16/include -I../.. -Igen -m64 -march=x86-64 -msse2 -fPIE --target=x86_64-alpine-linux-musl -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Wno-missing-field-initializers -Wno-unused-parameter -Wno-tautological-constant-compare -Wno-unused-but-set-variable -Wno-deprecated-non-prototype -fdebug-prefix-map=/__w/dart/dart/dart-sdk/sdk/= -no-canonical-prefixes -fvisibility=hidden --sysroot=../../buildtools/sysroot/alpine-linux-x86_64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Wheader-hygiene -Wstring-conversion -O2 -fno-ident -fdata-sections -ffunction-sections -g3 -ggdb3 -fPIE -Wno-deprecated-declarations -Wno-unused-but-set-parameter -Wno-unused-function -Wno-unused-variable -Wno-pessimizing-move -Wno-sign-compare -Wno-range-loop-construct -Wno-header-hygiene -Wno-unused-private-field -Wno-inconsistent-missing-override -Wno-unknown-warning-option -Wno-deprecated-this-capture -fvisibility-inlines-hidden -fno-omit-frame-pointer -std=c++20 -std=c++20 -fno-rtti -fexceptions -c ../../third_party/binaryen/src/src/tools/wasm-opt.cpp -o obj/third_party/binaryen/src/src/tools/wasm-opt.wasm-opt.o
In file included from ../../third_party/binaryen/src/src/tools/wasm-opt.cpp:24:
In file included from ../../third_party/binaryen/src/src/tools/execution-results.h:21:
In file included from ../../third_party/binaryen/src/src/shell-interface.h:24:
In file included from ../../third_party/binaryen/src/src/asmjs/shared-constants.h:20:
In file included from ../../third_party/binaryen/src/src/support/istring.h:29:
In file included from ../../third_party/binaryen/src/src/support/threads.h:27:
In file included from ../../buildtools/sysroot/alpine-linux-x86_64/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../include/c++/13.2.1/functional:64:
In file included from ../../buildtools/sysroot/alpine-linux-x86_64/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../include/c++/13.2.1/vector:66:
../../buildtools/sysroot/alpine-linux-x86_64/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../include/c++/13.2.1/bits/stl_vector.h:[36](https://github.com/dart-musl/dart/actions/runs/11808398407/job/32897032419#step:10:37)7:35: error: arithmetic on a pointer to an incomplete type 'wasm::Type'
  367 |                       _M_impl._M_end_of_storage - _M_impl._M_start);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
../../buildtools/sysroot/alpine-linux-x86_64/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../include/c++/13.2.1/bits/stl_vector.h:617:7: note: in instantiation of member function 'std::_Vector_base<wasm::Type, std::allocator<wasm::Type>>::~_Vector_base' requested here
  617 |       vector(vector&&) noexcept = default;
      |       ^
../../third_party/binaryen/src/src/wasm-type.h:284:46: note: in defaulted move constructor for 'std::vector<wasm::Type>' first required here
  284 |   TypeInfo(Tuple&& tuple) : kind(TupleKind), tuple(std::move(tuple)) {}
      |                                              ^
../../third_party/binaryen/src/src/wasm-type.h:51:7: note: forward declaration of 'wasm::Type'
   51 | class Type;
      |       ^
1 error generated.
ninja: subcommand failed
buildtools/ninja/ninja -C out/ReleaseX64 create_sdk
dart-github-bot commented 1 day ago

Summary: The commit 0a238b382891f8f3164d5ee561468e160f3c554f breaks compiling the binaryen component on Alpine Linux's clang++ due to an error related to an incomplete type wasm::Type in the std::vector implementation.

devoncarew commented 1 day ago

cc @rmacnak-google for this issue and the associated CL (https://dart-review.googlesource.com/c/sdk/+/394920)