Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failures in Fedora 41 x86_64 #2149

Open
ADKaster opened this issue Nov 3, 2024 · 6 comments
Open

Build failures in Fedora 41 x86_64 #2149

ADKaster opened this issue Nov 3, 2024 · 6 comments

Comments

@ADKaster
Copy link
Member

ADKaster commented Nov 3, 2024

Summary

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

Reported upstream here at vcpkg: microsoft/vcpkg#41576

And here at nixos/patchelf: NixOS/patchelf#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
@AtkinsSJ
Copy link
Member

AtkinsSJ commented Nov 4, 2024

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

@davidkennedydev
Copy link

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

@CanadaHonk
Copy link
Contributor

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

@ADKaster
Copy link
Member Author

ADKaster commented Dec 1, 2024

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.

@AtkinsSJ
Copy link
Member

AtkinsSJ commented Dec 2, 2024

That last fix works for me! 🎉

@torokati44
Copy link

The patch in #2149 (comment) was still needed for me even with #2149 (comment) merged as part of #2799.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants