ladybird: Build failures in Fedora 41 x86_64

Summary

Building on Fedora 41 on an x86_64 machine is currently running into a patchelf related build failure.

Reported upstream here at vcpkg: https://github.com/microsoft/vcpkg/issues/41576

And here at nixos/patchelf: https://github.com/NixOS/patchelf/issues/568

The issue can be worked around by the following steps:

  1. rm -rf Build/vcpkg
  2. rm -rf Build/release (and any other Build/<preset> directories)
  3. Apply the following patch to Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
diff --git a/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake b/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
index a43a4493d6..caa2ee7a1e 100644
--- a/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
+++ b/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
@@ -8,4 +8,6 @@ if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "")
     string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CXX} ${CMAKE_CXX_COMPILER})\n")
 endif()
 
+string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{LDFLAGS} -Wl,-z,noseparate-code)\n")
+
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")
  1. Rebuild via ./Meta/ladybird.sh run

Operating system

Linux

Steps to reproduce

  1. Upgrade to Fedora 41
  2. Build ladybird via ./Meta/ladybird.sh

Expected behavior

Successful build

Actual behavior

A build failure similar to the following:

CMake Error at /home/jmansfield/src/github/serenityos/ladybird/Build/ladybird/vcpkg_installed/x64-linux/share/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake:31 (execute_process):
  execute_process failed command indexes:

    1: "Abnormal exit with child return code: Segmentation fault"

Call Stack (most recent call first):
  buildtrees/versioning_/versions/skia/76a242d24e0e810ad8c78e3deaef69d4b634e8fc/skia-functions.cmake:92 (x_vcpkg_pkgconfig_get_modules)
  buildtrees/versioning_/versions/skia/76a242d24e0e810ad8c78e3deaef69d4b634e8fc/skia-functions.cmake:73 (third_party_from_pkgconfig)
  buildtrees/versioning_/versions/skia/76a242d24e0e810ad8c78e3deaef69d4b634e8fc/portfile.cmake:242 (get_externals)
  scripts/ports.cmake:192 (include)


error: building skia:x64-linux failed with: BUILD_FAILED

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 11
  • Comments: 15 (5 by maintainers)

Most upvoted comments

A user on discord was able to get the build working with none of the above steps, and only

diff --git a/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake b/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
index a43a4493d6..caa2ee7a1e 100644
--- a/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
+++ b/Meta/CMake/vcpkg/generate_vcpkg_toolchain_variables.cmake
@@ -8,4 +8,6 @@ if (NOT "${CMAKE_CXX_COMPILER}" STREQUAL "")
     string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{CXX} ${CMAKE_CXX_COMPILER})\n")
 endif()
 
+string(APPEND EXTRA_VCPKG_VARIABLES "set(ENV{LDFLAGS} -Wl,-z,noseparate-code)\n")
+
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/build-vcpkg-variables.cmake" "${EXTRA_VCPKG_VARIABLES}")

edit: the patch here is now the steps in the top comment, I’ve edited it

Looking at some upstream fedora issues, this linker flag was a suggested workaround from a binutils developer.

A patched version of binutils to avoid the problem should be available in rawhide as the -7 release. https://bugzilla.redhat.com/show_bug.cgi?id=2321588#c41

Though I’m not sure if they intend to backport that to 41, or still wait on the patchelf developers to make their tool work with the new default linker layout in fedora x86_64.

That last fix works for me! 🎉

@Michsior14 With CC=clang CXX=clang++ it still doesn’t build for me, but at least I get a different error! 🤷‍♂

What I’m getting is a similar, but indeed different error. Still a Segmentation fault (in vcpkg, I assume), but while compiling ffmpeg, not skia:

-- Using cached ffmpeg-ffmpeg-n7.1.tar.gz
-- Cleaning sources at /home/attila/projects/ladybird/Build/vcpkg/buildtrees/ffmpeg/src/n7.1-d40f62baf3.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/attila/projects/ladybird/Build/vcpkg/downloads/ffmpeg-ffmpeg-n7.1.tar.gz
-- Applying patch 0001-create-lib-libraries.patch
-- Applying patch 0002-fix-msvc-link.patch
-- Applying patch 0003-fix-windowsinclude.patch
-- Applying patch 0004-dependencies.patch
-- Applying patch 0005-fix-nasm.patch
-- Applying patch 0007-fix-lib-naming.patch
-- Applying patch 0013-define-WINVER.patch
-- Applying patch 0020-fix-aarch64-libswscale.patch
-- Applying patch 0024-fix-osx-host-c11.patch
-- Applying patch 0040-ffmpeg-add-av_stream_get_first_dts-for-chromium.patch
-- Applying patch 0041-add-const-for-opengl-definition.patch
-- Applying patch 0043-fix-miss-head.patch
-- Using source at /home/attila/projects/ladybird/Build/vcpkg/buildtrees/ffmpeg/src/n7.1-d40f62baf3.clean
-- Found external ninja('1.12.1').
-- Getting CMake variables for x64-linux-dynamic
-- Building Options: --enable-pic --disable-doc --enable-debug --enable-runtime-cpudetect --disable-autodetect --target-os=linux --enable-pthreads --cc=cc --host_cc=cc --cxx=c++ --nm=nm --ar='ar' --ranlib=ranlib --strip=strip --disable-ffmpeg --disable-ffplay --disable-ffprobe --enable-avcodec --enable-avdevice --enable-avformat --enable-avfilter --disable-postproc --enable-swresample --enable-swscale --disable-alsa --disable-amf --disable-libaom --disable-libass --disable-avisynth --disable-bzlib --enable-libdav1d --disable-libfdk-aac --disable-libfontconfig --disable-libharfbuzz --disable-libfreetype --disable-libfribidi --disable-iconv --disable-libilbc --disable-lzma --disable-libmp3lame --disable-libmodplug --disable-cuda --disable-nvenc --disable-nvdec  --disable-cuvid --disable-ffnvcodec --disable-opencl --disable-opengl --enable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --disable-openssl --enable-libopus --disable-sdl2 --disable-libsnappy --disable-libsoxr --disable-libspeex --disable-libssh --disable-libtensorflow --disable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --disable-libx264 --disable-libx265 --disable-libxml2 --enable-zlib --disable-libsrt --disable-libmfx --enable-cross-compile --disable-static --enable-shared --pkg-config="/bin/pkg-config"
-- Building Release Options: --enable-optimizations --extra-ldflags=-L"/home/attila/projects/ladybird/Build/release/vcpkg_installed/x64-linux-dynamic/lib"
-- Building ffmpeg for Release
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libavcodec.pc
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libavdevice.pc
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libavfilter.pc
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libavformat.pc
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libavutil.pc
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libswresample.pc
-- Fixing pkgconfig file: /home/attila/projects/ladybird/Build/vcpkg/packages/ffmpeg_x64-linux-dynamic/lib/pkgconfig/libswscale.pc
CMake Error at /home/attila/projects/ladybird/Build/release/vcpkg_installed/x64-linux-dynamic/share/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake:31 (execute_process):
  execute_process failed command indexes:

    1: "Abnormal exit with child return code: Segmentation fault"

Call Stack (most recent call first):
  buildtrees/versioning_/versions/ffmpeg/8bf6bad9b522d47e259a13d9033a825a6abd41a9/portfile.cmake:880 (x_vcpkg_pkgconfig_get_modules)
  scripts/ports.cmake:206 (include)


error: building ffmpeg:x64-linux-dynamic failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle ffmpeg:x64-linux-dynamic: 42 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+ffmpeg
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[ffmpeg]+Build+error+on+x64-linux-dynamic&body=Copy%20issue%20body%20from%20%2Fhome%2Fattila%2Fprojects%2Fladybird%2FBuild%2Frelease%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md
You can also submit an issue by running (GitHub CLI must be installed):
  /usr/bin/gh issue create -R microsoft/vcpkg --title "[ffmpeg] Build failure on x64-linux-dynamic" --body-file /home/attila/projects/ladybird/Build/release/vcpkg_installed/vcpkg/issue_body.md
-- Running vcpkg install - failed
CMake Error at Build/vcpkg/scripts/buildsystems/vcpkg.cmake:938 (message):
  vcpkg install failed.  See logs for more information:
  /home/attila/projects/ladybird/Build/release/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:22 (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!

:thonk: The workaround isn’t working for me. So far I’ve tried:

  1. The workaround
  2. sudo dnf install patchelf
  3. The workaround again
  4. Add that export to every shell-rc file I could find in case it’s not using .zshrc for some reason
  5. The workaround again

Not sure what else to try.