ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

Build failures in Fedora 41 x86_64

Open ADKaster opened this issue 1 year ago • 15 comments

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/ 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

ADKaster avatar Nov 03 '24 22:11 ADKaster

: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.

AtkinsSJ avatar Nov 04 '24 11:11 AtkinsSJ

I'm facing the same problem. The workaround doesn't work for me, either. I'm using Fedora 41. I tried many ways. But it's failing even on the more decoupled case:

  • Cloning vcpkg
  • Bootstrap build
  • ./vcpkg install skia

Exits with segfault.

So, it looks like a failure on the dependency recipe.

Maybe if you know a working previous version for the skia package...

davidkennedydev avatar Nov 06 '24 04:11 davidkennedydev

Following the steps above and appending set(VCPKG_FIXUP_ELF_RPATH OFF) to Meta/CMake/vcpkg/base-triplets/base.cmake worked for me

CanadaHonk avatar Nov 30 '24 20:11 CanadaHonk

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.

ADKaster avatar Dec 01 '24 23:12 ADKaster

That last fix works for me! :tada:

AtkinsSJ avatar Dec 02 '24 17:12 AtkinsSJ

The patch in https://github.com/LadybirdBrowser/ladybird/issues/2149#issuecomment-2509239122 was still needed for me even with https://github.com/LadybirdBrowser/ladybird/issues/2149#issuecomment-2510301886 merged as part of https://github.com/LadybirdBrowser/ladybird/pull/2799.

torokati44 avatar Dec 20 '24 11:12 torokati44

Using the above (https://github.com/LadybirdBrowser/ladybird/issues/2149#issuecomment-2556799600), I am unable to build ladybird.

schrummy14 avatar Mar 02 '25 05:03 schrummy14

Had zero issues on my laptop, whereas I am seeing errors on my desktop. Only difference would be that my laptop was a fresh install of 41, but my desktop was updated from 40.

I did get it to build on my desktop by specifying to use clang and clang++. CC=clang CXX=clang++ ./Meta/ladybird.sh run ladybird

schrummy14 avatar Mar 02 '25 20:03 schrummy14

The issue is still present on Fedora 42, and the workaround in https://github.com/LadybirdBrowser/ladybird/issues/2149#issuecomment-2509239122 doesn't fix it either.

torokati44 avatar Apr 29 '25 13:04 torokati44

If you're really getting the specific error

 execute_process failed command indexes:

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

when compiling specifically skia on Fedora 42, then logs would be helpful.

I strongly suspect that any other errors have another root cause than this issue. I'd rather close this issue as resolved, as the change in question was committed months ago.

ADKaster avatar Apr 29 '25 22:04 ADKaster

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!

torokati44 avatar Apr 30 '25 07:04 torokati44

I have the same issue as @torokati44, but using @schrummy14's workaround it builds properly.

CC=clang CXX=clang++ ./Meta/ladybird.sh run ladybird

Michsior14 avatar May 06 '25 23:05 Michsior14

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!

building with clang as per https://github.com/LadybirdBrowser/ladybird/issues/2149#issuecomment-2692888211 fixes this issue on Fedora 41.

ric96 avatar May 06 '25 23:05 ric96

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

torokati44 avatar May 07 '25 08:05 torokati44

I did recently try re-building this project. I was seeing my build fail at fontconfig. This was caused by my system not having the gperf package. Once installed, I was able to re-build.

schrummy14 avatar May 07 '25 14:05 schrummy14