LadybirdBrowser/ladybird

Build issue on macOS with Xcode 15.4

Closed this issue · 5 comments

macOS Sonoma 14.5, latest pkgs from brew and latest xcode. I'm trying to build w/o Qt

FAILED: Lagom/Userland/Libraries/LibWeb/CMakeFiles/LibWeb.dir/CSS/StyleValues/EasingStyleValue.cpp.o
/opt/homebrew/bin/ccache /usr/bin/c++ -DENABLE_COMPILETIME_FORMAT_CHECK -DHAS_ACCELERATED_GRAPHICS -DLibWeb_EXPORTS -I/Users/pavel/Develop/ladybird -I/Users/pavel/Develop/ladybird/Userland/Services -I/Users/pavel/Develop/ladybird/Userland/Libraries -I/Users/pavel/Develop/ladybird/Build/ladybird/Lagom -I/Users/pavel/Develop/ladybird/Build/ladybird/Lagom/Userland/Services -I/Users/pavel/Develop/ladybird/Build/ladybird/Lagom/Userland/Libraries -I/Users/pavel/Develop/ladybird/Meta/Lagom/../.. -I/Users/pavel/Develop/ladybird/Meta/Lagom/../../Userland -I/Users/pavel/Develop/ladybird/Meta/Lagom/../../Userland/Libraries -I/Users/pavel/Develop/ladybird/Meta/Lagom/../../Userland/Services -I/Users/pavel/Develop/ladybird/Build/ladybird -std=c++2b -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fPIC -fcolor-diagnostics -Wall -Wextra -Wno-invalid-offsetof -Wno-unknown-warning-option -Wno-unused-command-line-argument -fno-exceptions -ffp-contract=off -Werror -fconstexpr-steps=16777216 -Wno-implicit-const-int-float-conversion -Wno-user-defined-literals -Wno-vla-cxx-extension -Wno-maybe-uninitialized -Wno-shorten-64-to-32 -fsigned-char -ggnu-pubnames -fPIC -O2 -g1 -Wno-overloaded-virtual -Wno-unused-private-field -MD -MT Lagom/Userland/Libraries/LibWeb/CMakeFiles/LibWeb.dir/CSS/StyleValues/EasingStyleValue.cpp.o -MF Lagom/Userland/Libraries/LibWeb/CMakeFiles/LibWeb.dir/CSS/StyleValues/EasingStyleValue.cpp.o.d -o Lagom/Userland/Libraries/LibWeb/CMakeFiles/LibWeb.dir/CSS/StyleValues/EasingStyleValue.cpp.o -c /Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:119:42: error: reference to local binding 'x1' declared in enclosing lambda expression
                auto x = cubic_bezier_at(x1, x2, t);
                                         ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:125:46: note: in instantiation of function template specialization 'Web::CSS::EasingStyleValue::Function::evaluate_at(double, bool)::(anonymous class)::operator()(const CubicBezier &)::(anonymous class)::operator()<double>' requested here
                cached_x_samples.append(solve(0.));
                                             ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:76:26: note: 'x1' declared here
            auto const& [x1, y1, x2, y2, cached_x_samples] = bezier;
                         ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:119:46: error: reference to local binding 'x2' declared in enclosing lambda expression
                auto x = cubic_bezier_at(x1, x2, t);
                                             ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:76:34: note: 'x2' declared here
            auto const& [x1, y1, x2, y2, cached_x_samples] = bezier;
                                 ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:120:42: error: reference to local binding 'y1' declared in enclosing lambda expression
                auto y = cubic_bezier_at(y1, y2, t);
                                         ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:76:30: note: 'y1' declared here
            auto const& [x1, y1, x2, y2, cached_x_samples] = bezier;
                             ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:120:46: error: reference to local binding 'y2' declared in enclosing lambda expression
                auto y = cubic_bezier_at(y1, y2, t);
                                             ^
/Users/pavel/Develop/ladybird/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.cpp:76:38: note: 'y2' declared here
            auto const& [x1, y1, x2, y2, cached_x_samples] = bezier;
                                     ^
4 errors generated.
[1846/4551] Building CXX object Lagom/Userland/Libraries/LibWeb/CMakeFiles/LibWeb.dir/CSS/Parser/Parser.cpp.o

I'm on 3225e6f

Hi, what compiler and version are you using? (Run /usr/bin/c++ --version.) Ladybird requires quite recent ones.

(Run /usr/bin/c++ --version.)

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I tried setting it to gcc, but that didn't work for me

Yeah you're going to need a newer compiler. Hopefully a macos user can chime in, but the docs say either g++-13 or clang-17 is needed as a minimum.

I'm also seeing this on the latest Xcode release. Looks like we finally slipped something in that breaks that :D

The way around it is like so:

rm -r Build/ladybird
CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ ./Meta/ladybird.sh run

Assuming your brew clang is Homebrew clang version 18.1.6, this will rebuild everything with upstream clang 18 instead of Apple Clang from Xcode Version 15.4 (15F31d)

cc @BertalanD

Likely fixed in upstream LLVM with llvm/llvm-project@127bf44 or llvm/llvm-project@e1111e2. Xcode 16 is coming very soon, there is no point in trying to get the fix backported into the 15 series, but we could add a workaround in our code. And we would be better off using Apple Clang on macOS CI to avoid surprises like this.

For what it's worth, this code compiles fine with Xcode 16 Beta 1 (clang-1600.0.20.10).