Unable to build Ladybird on Apple Silicon MacOS 15.5
Summary
When I try to build Ladybird it fails. It knows it's on arm64 (Apple M4 Pro) but halts with "Undefined symbols for architecture x86_64"
Operating system
macOS
Steps to reproduce
- Installed prereqs per README:
xcode-select --install brew install autoconf autoconf-archive automake ccache cmake nasm ninja pkg-configAlsobrew install llvm@20andbrew install qt - Ran
./Meta/ladybird.py run- failed - Ran
arch -arm64 ./Meta/ladybird.py run- failed - Set up to use clan:
export BUILD_PRESET=Debug export CC=$(brew --prefix llvm)/bin/clang export CXX=$(brew --prefix llvm)/bin/clang++ - Ran
./Meta/ladybird.py run- failed - Ran
arch -arm64 ./Meta/ladybird.py run- failed - did 'git fetch --all; git pull' and re-tried above steps 2-6 - still failed
Expected behavior
Expected Ladybird to successfully build and run
Actual behavior
Build failed
URL for a reduced test case
N/A
HTML/SVG/etc. source for a reduced test case
N/A
Log output and (if possible) backtrace
...
-- Build files have been written to: /Users/jeff/Git/ladybird/Build/debug
[42/3450] Linking CXX shared library lib/liblagom-ak.0.0.0.dylib
FAILED: lib/liblagom-ak.0.0.0.dylib
: && /usr/bin/c++ -g -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=14.0 -dynamiclib -Wl,-headerpad_max_install_names -fstack-protector-strong -Xlinker -U -Xlinker _ak_assertion_handler -o lib/liblagom-ak.0.0.0.dylib -install_name @rpath/liblagom-ak.0.dylib Lagom/AK/CMakeFiles/AK.dir/Assertions.cpp.o Lagom/AK/CMakeFiles/AK.dir/Base64.cpp.o Lagom/AK/CMakeFiles/AK.dir/ByteString.cpp.o Lagom/AK/CMakeFiles/AK.dir/ByteStringImpl.cpp.o Lagom/AK/CMakeFiles/AK.dir/CircularBuffer.cpp.o Lagom/AK/CMakeFiles/AK.dir/ConstrainedStream.cpp.o Lagom/AK/CMakeFiles/AK.dir/CountingStream.cpp.o Lagom/AK/CMakeFiles/AK.dir/Error.cpp.o Lagom/AK/CMakeFiles/AK.dir/FloatingPointStringConversions.cpp.o Lagom/AK/CMakeFiles/AK.dir/FlyString.cpp.o Lagom/AK/CMakeFiles/AK.dir/Format.cpp.o Lagom/AK/CMakeFiles/AK.dir/GenericLexer.cpp.o Lagom/AK/CMakeFiles/AK.dir/Hex.cpp.o Lagom/AK/CMakeFiles/AK.dir/JsonArray.cpp.o Lagom/AK/CMakeFiles/AK.dir/JsonObject.cpp.o Lagom/AK/CMakeFiles/AK.dir/JsonParser.cpp.o Lagom/AK/CMakeFiles/AK.dir/JsonValue.cpp.o Lagom/AK/CMakeFiles/AK.dir/MemoryStream.cpp.o Lagom/AK/CMakeFiles/AK.dir/NumberFormat.cpp.o Lagom/AK/CMakeFiles/AK.dir/OptionParser.cpp.o Lagom/AK/CMakeFiles/AK.dir/Random.cpp.o Lagom/AK/CMakeFiles/AK.dir/StackInfo.cpp.o Lagom/AK/CMakeFiles/AK.dir/Stream.cpp.o Lagom/AK/CMakeFiles/AK.dir/String.cpp.o Lagom/AK/CMakeFiles/AK.dir/StringBase.cpp.o Lagom/AK/CMakeFiles/AK.dir/StringBuilder.cpp.o Lagom/AK/CMakeFiles/AK.dir/StringFloatingPointConversions.cpp.o Lagom/AK/CMakeFiles/AK.dir/StringUtils.cpp.o Lagom/AK/CMakeFiles/AK.dir/StringView.cpp.o Lagom/AK/CMakeFiles/AK.dir/Time.cpp.o Lagom/AK/CMakeFiles/AK.dir/Utf16View.cpp.o Lagom/AK/CMakeFiles/AK.dir/Utf32View.cpp.o Lagom/AK/CMakeFiles/AK.dir/Utf8View.cpp.o Lagom/AK/CMakeFiles/AK.dir/kmalloc.cpp.o Lagom/AK/CMakeFiles/AK.dir/LexicalPath.cpp.o -Wl,-rpath,/Users/jeff/Git/ladybird/Build/debug/vcpkg_installed/arm64-osx-dynamic/debug/lib vcpkg_installed/arm64-osx-dynamic/debug/lib/libsimdutf.21.0.0.dylib && :
ld: warning: ignoring file 'vcpkg_installed/arm64-osx-dynamic/debug/lib/libsimdutf.21.0.0.dylib': found architecture 'arm64', required architecture 'x86_64'
Undefined symbols for architecture x86_64:
"simdutf::count_utf8(char const*, unsigned long)", referenced from:
AK::utf8_to_utf16(AK::Utf8View const&, AK::Endianness) in Utf16View.cpp.o
AK::Utf8View::calculate_length() const in Utf8View.cpp.o
AK::Utf8View::starts_with(AK::Utf8View const&) const in Utf8View.cpp.o
AK::Utf8View::starts_with(AK::Utf8View const&) const in Utf8View.cpp.o
"simdutf::count_utf16(char16_t const*, unsigned long)", referenced from:
AK::Utf16View::length_in_code_points() const in Utf16View.cpp.o
AK::Utf16View::calculate_length_in_code_points() const in Utf16View.cpp.o
"simdutf::validate_ascii(char const*, unsigned long)", referenced from:
AK::StringView::is_ascii() const in StringView.cpp.o
"simdutf::validate_utf16(char16_t const*, unsigned long)", referenced from:
AK::Utf16View::length_in_code_points() const in Utf16View.cpp.o
AK::Utf16View::calculate_length_in_code_points() const in Utf16View.cpp.o
AK::Utf16View::validate() const in Utf16View.cpp.o
"simdutf::binary_to_base64(char const*, unsigned long, char*, simdutf::base64_options)", referenced from:
AK::encode_base64_impl(AK::StringView, simdutf::base64_options) in Base64.cpp.o
"simdutf::validate_utf16be(char16_t const*, unsigned long)", referenced from:
AK::validate_utf16_be(AK::Span<unsigned char const>) in Utf16View.cpp.o
"simdutf::validate_utf16le(char16_t const*, unsigned long)", referenced from:
AK::validate_utf16_le(AK::Span<unsigned char const>) in Utf16View.cpp.o
"simdutf::base64_to_binary_safe(char const*, unsigned long, char*, unsigned long&, simdutf::base64_options, simdutf::last_chunk_handling_options, bool)", referenced from:
AK::decode_base64_into_impl(AK::StringView, AK::Detail::ByteBuffer<32ul>&, AK::LastChunkHandling, simdutf::base64_options) in Base64.cpp.o
"simdutf::convert_utf16_to_utf8(char16_t const*, unsigned long, char*)", referenced from:
AK::String::from_utf16(AK::Utf16View const&) in String.cpp.o
"simdutf::convert_utf8_to_utf16(char const*, unsigned long, char16_t*)", referenced from:
AK::utf8_to_utf16(AK::Utf8View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::convert_utf32_to_utf16(char32_t const*, unsigned long, char16_t*)", referenced from:
AK::utf32_to_utf16(AK::Utf32View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::utf16_length_from_utf8(char const*, unsigned long)", referenced from:
AK::utf8_to_utf16(AK::Utf8View const&, AK::Endianness) in Utf16View.cpp.o
AK::utf16_code_unit_length_from_utf8(AK::StringView) in Utf16View.cpp.o
"simdutf::utf8_length_from_utf16(char16_t const*, unsigned long)", referenced from:
AK::String::from_utf16_le(AK::Span<unsigned char const>) in String.cpp.o
AK::String::from_utf16_be(AK::Span<unsigned char const>) in String.cpp.o
AK::String::from_utf16(AK::Utf16View const&) in String.cpp.o
AK::StringBuilder::try_append(AK::Utf16View const&) in StringBuilder.cpp.o
"simdutf::convert_utf16be_to_utf8(char16_t const*, unsigned long, char*)", referenced from:
AK::String::from_utf16_be(AK::Span<unsigned char const>) in String.cpp.o
"simdutf::convert_utf16le_to_utf8(char16_t const*, unsigned long, char*)", referenced from:
AK::String::from_utf16_le(AK::Span<unsigned char const>) in String.cpp.o
"simdutf::convert_utf8_to_utf16be(char const*, unsigned long, char16_t*)", referenced from:
AK::utf8_to_utf16(AK::Utf8View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::convert_utf8_to_utf16le(char const*, unsigned long, char16_t*)", referenced from:
AK::utf8_to_utf16(AK::Utf8View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::utf16_length_from_utf32(char32_t const*, unsigned long)", referenced from:
AK::utf32_to_utf16(AK::Utf32View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::convert_utf32_to_utf16be(char32_t const*, unsigned long, char16_t*)", referenced from:
AK::utf32_to_utf16(AK::Utf32View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::convert_utf32_to_utf16le(char32_t const*, unsigned long, char16_t*)", referenced from:
AK::utf32_to_utf16(AK::Utf32View const&, AK::Endianness) in Utf16View.cpp.o
"simdutf::base64_length_from_binary(unsigned long, simdutf::base64_options)", referenced from:
AK::encode_base64_impl(AK::StringView, simdutf::base64_options) in Base64.cpp.o
"simdutf::validate_utf8_with_errors(char const*, unsigned long)", referenced from:
AK::Utf8View::validate(unsigned long&, AK::Utf8View::AllowSurrogates) const in Utf8View.cpp.o
"simdutf::validate_utf16_with_errors(char16_t const*, unsigned long)", referenced from:
AK::Utf16View::validate(unsigned long&) const in Utf16View.cpp.o
"simdutf::convert_utf16_to_utf8_with_errors(char16_t const*, unsigned long, char*)", referenced from:
AK::StringBuilder::try_append(AK::Utf16View const&) in StringBuilder.cpp.o
"simdutf::maximal_binary_length_from_base64(char const*, unsigned long)", referenced from:
AK::size_required_to_decode_base64(AK::StringView) in Base64.cpp.o
AK::decode_base64_impl(AK::StringView, AK::LastChunkHandling, simdutf::base64_options) in Base64.cpp.o
ld: symbol(s) not found for architecture x86_64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[55/3450] Building CXX object Lagom/Tools/CodeGenerators/LibTextCodec/CMakeFiles/GenerateEncodingIndexes.dir/GenerateEncodingIndexes.cpp.o
ninja: build stopped: subcommand failed.
Screenshots or screen recordings
No response
Build flags or config settings
Tried both without and with arch -arm64
Contribute a patch?
- [ ] I’ll contribute a patch for this myself.
Is your homebrew configured to build for Rosetta2 by default or something? You should clear out any environment variables or other such config to get a consistent build environment. I wouldn't recommend using that arch command at all these days... At any rate, you'll probably have to blast your build dir to get all the misconfigured libs out of the way.
I do have Rosetta2 installed. But that should be irrelevant. I'm building from scratch on an ARM-based system, not using an x86 binary
That makes sense, but in your posted build output, something was adding -arch x86_64
[42/3450] Linking CXX shared library lib/liblagom-ak.0.0.0.dylib
FAILED: lib/liblagom-ak.0.0.0.dylib
: && /usr/bin/c++ -g -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Figuring out where that is coming from is going to be the solution to your issue
Yes, that's exactly my point. There's no rational reason for the build process to be using -arch x86_64 when the rest of the build is happening with -arch arm64.
I.e. there's a bug - which is what I'm reporting here.
Can you post your environment variables @jmarkel ? I don't have the issue on M1
Is your shell or CMake executable an x86_64 binary by any chance?