LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
10.62k stars 420 forks source link

Build process relies on vcpkg glibc binaries #93

Open apprehensions opened 4 weeks ago

apprehensions commented 4 weeks ago

I am on a Linux musl-based distribution, and building Ladybird requires running a binary from Microsoft which is linked against glibc; it causes the following build errors:

$ ./Meta/ladybird.sh run ladybird
Building vcpkg
~/src/ladybird/Toolchain/Tarballs ~/src/ladybird/Toolchain
HEAD is now at 01f602195 Patch Tuesday for May 2024 (Again) (#38891)
Downloading vcpkg-glibc...
./bootstrap-vcpkg.sh: /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/scripts/bootstrap.sh: line 227: /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/vcpkg: not found

A quick check at the binary:

$ ldd /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/vcpkg
    /lib64/ld-linux-x86-64.so.2 (0x7f465b971000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f465b971000)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f465b971000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f465b971000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/vcpkg)
Error relocating /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/vcpkg: __strftime_l: symbol not found
Error relocating /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/vcpkg: __sprintf_chk: symbol not found
skyrising commented 4 weeks ago

Based on https://github.com/microsoft/vcpkg/blob/master/scripts/bootstrap.sh it looks like Toolchain/BuildVcpkg.sh needs to conditionally pass -musl

apprehensions commented 4 weeks ago
-- Running vcpkg install
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
Detecting compiler hash for triplet x64-linux...
error: while detecting compiler information:
The log file content at "/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/buildtrees/detect_compiler/stdout-x64-linux.log" is:
-- Found ninja('1.9') but at least version 1.10.2 is required! Trying to use internal version if possible!
-- Downloading https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip -> ninja-linux-1.10.2.zip...
-- Configuring x64-linux-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: /usr/bin/cmake /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/scripts/detect_compiler -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/packages/detect_compiler_x64-linux -DCMAKE_MAKE_PROGRAM=/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja -DCMAKE_SYSTEM_NAME=Linux -DBUILD_SHARED_LIBS=OFF -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/scripts/toolchains/linux.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DVCPKG_SET_CHARSET_FLAG=ON -DVCPKG_PLATFORM_TOOLSET=external -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DVCPKG_APPLOCAL_DEPS=OFF -DCMAKE_TOOLCHAIN_FILE=/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -DVCPKG_CXX_FLAGS= -DVCPKG_CXX_FLAGS_RELEASE= -DVCPKG_CXX_FLAGS_DEBUG= -DVCPKG_C_FLAGS= -DVCPKG_C_FLAGS_RELEASE= -DVCPKG_C_FLAGS_DEBUG= -DVCPKG_CRT_LINKAGE=dynamic -DVCPKG_LINKER_FLAGS= -DVCPKG_LINKER_FLAGS_RELEASE= -DVCPKG_LINKER_FLAGS_DEBUG= -DVCPKG_TARGET_ARCHITECTURE=x64 -DCMAKE_INSTALL_LIBDIR:STRING=lib -DCMAKE_INSTALL_BINDIR:STRING=bin -D_VCPKG_ROOT_DIR=/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg -DZ_VCPKG_ROOT_DIR=/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg -D_VCPKG_INSTALLED_DIR=/home/sewn/src/ladybird/Build/ladybird/vcpkg_installed -DVCPKG_MANIFEST_INSTALL=OFF
    Working Directory: /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/buildtrees/detect_compiler/x64-linux-rel
    Error code: 1
    See logs for more information:
      /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-CMakeCache.txt.log
      /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-out.log
      /home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:344 (vcpkg_execute_required_process)
  scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
  scripts/ports.cmake:175 (include)

error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.
-- Running vcpkg install - failed
CMake Error at Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  /home/sewn/src/ladybird/Build/ladybird/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /usr/share/cmake-3.29/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:6 (project)

CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
CMake Error at CMakeLists.txt:2 (project):
  Running

   '/home/sewn/src/ladybird/Toolchain/Tarballs/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja' '--version'

  failed with:

   no such file or directory

More glibc binaries.

sabas commented 3 weeks ago

Similar error on Ubuntu 23.10 in WSL2

ADKaster commented 3 weeks ago

If modifying our BuildVcpkg.sh script to add --musl does not produce a working install on Alpine without glibc compat libraries, then that is a bug with upstream vcpkg.

Is it the case that removing Toolchain/Tarballs, Toolchain/Local, and Toolchain/Build, modifying Toolchain/BuildVcpkg.sh to pass --musl to the vcpkg bootstrap script, and re-running the build still produces binaries that require glibc symbols?

apprehensions commented 3 weeks ago

See the my last comment before this one @ADKaster

sabas commented 2 weeks ago

Noticed this

cat /home/stefano/ladybird/Toolchain/Tarballs/vcpkg/buildtrees/icu/config-x64-linux-dbg-err.log configure: WARNING: unrecognized options: --disable-silent-rules configure: error: 'autoconf-archive' is missing

I installed the package with apt and now it is moving along, I update this comment when the compilation ends

EDIT: Compiled successfully, I forgot to set the env variable so I run like this and it works (created the tmp directory under the user and set permission 0700)

XDG_RUNTIME_DIR=/var/tmp/ladybird ./Meta/ladybird.sh run ladybird