Description of problem: In Ruby, we are fighting with "random" test crashes since libffi 3.4.2 was introduced into Fedora. We was told that the issue could be fixed by enabling "static trampolines" in libffi, but this is blocked by GHC. One of the possibilities to move forward with this could be temporary bundling libffi in GHC as was suggested in bug 2040380 comment 24. Is that something acceptable for GHC? Version-Release number of selected component (if applicable): ghc-8.10.7-121.fc37 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: GHC block enablement of static trampolines in libffi Expected results: GHC does not block enablement static trampolines in libffi Additional info: I have tried this patch to enable bundled libffi: ~~~ $ git diff diff --git a/ghc.spec b/ghc.spec index 6fe2e2f..7a4f90f 100644 --- a/ghc.spec +++ b/ghc.spec @@ -40,6 +40,13 @@ # no longer build testsuite (takes time and not really being used) %bcond_with testsuite +# Currently, there are issues with libffi and cloures. Static tramplines could +# help with this, but they are disabled due to GHC. Therefore, temporary use +# bundled libffi for GHC and let enable static tramplines for libffi. +# https://bugzilla.redhat.com/show_bug.cgi?id=2040380 +# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155 +%bcond_without system_libffi + # 8.10 can use llvm 9-12 %global llvm_major 11 %global ghc_llvm_archs armv7hl aarch64 @@ -117,7 +124,7 @@ BuildRequires: ghc-transformers-devel BuildRequires: alex BuildRequires: gmp-devel BuildRequires: hscolour -BuildRequires: libffi-devel +%{?with_system_ffi:BuildRequires: libffi-devel} BuildRequires: make # for terminfo BuildRequires: ncurses-devel @@ -255,7 +262,7 @@ This package provides the User Guide and Haddock manual. %if %{defined ghclibdir} %ghc_lib_subpackage -d -l BSD Cabal-3.2.1.0 %ghc_lib_subpackage -d -l %BSDHaskellReport array-0.5.4.0 -%ghc_lib_subpackage -d -l %BSDHaskellReport -c gmp-devel%{?_isa},libffi-devel%{?_isa} base-%{base_ver} +%ghc_lib_subpackage -d -l %BSDHaskellReport -c gmp-devel%{?_isa}%{?with_system_ffi:,libffi-devel%{?_isa}} base-%{base_ver} %ghc_lib_subpackage -d -l BSD binary-0.8.8.0 %ghc_lib_subpackage -d -l BSD bytestring-0.10.12.0 %ghc_lib_subpackage -d -l %BSDHaskellReport containers-0.6.5.1 @@ -330,7 +337,7 @@ Installing this package causes %{name}-*-prof packages corresponding to %patch2 -p1 -b .orig %patch6 -p1 -b .orig -rm -r libffi-tarballs +%{?with_system_ffi:rm -r libffi-tarballs} %ifarch armv7hl %patch12 -p1 -b .orig12 @@ -410,7 +417,7 @@ export CC=%{_bindir}/gcc --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ --docdir=%{_docdir}/%{name} \ - --with-system-libffi \ + %{?with_system_ffi:--with-system-libffi} \ %ifarch %{ghc_unregisterized_arches} --enable-unregisterised \ %endif ~~~ Unfortunately the build failed: ~~~ checking dynamic linker characteristics... sed -e 's|\\|/|g' -e 's| /$| \\|' -e "1s|\.o|\.dyn_o|" -e "1s|^|utils/hp2ps/|" -e "1s|utils/hp2ps/|utils/hp2ps/dist-install/build/|" -e "1s|dist-install/build/dist-install/build|dist-install/build|g" -e "s|^/builddir/build/BUILD/ghc-8.10.7/||g" utils/hp2ps/dist-install/build/.depend.c_asm.bit >> utils/hp2ps/dist-install/build/.depend.c_asm.tmp && true echo "libraries/ghc-prim_dist-install_depfile_haskell_EXISTS = YES" >> libraries/ghc-prim/dist-install/build/.depend-v-dyn-p.haskell.tmp for dir in libraries/ghc-prim/dist-install/build/GHC/ libraries/ghc-prim/dist-install/build/GHC/Prim/; do if test ! -d $dir; then mkdir -p $dir; fi done "rm" -f utils/hp2ps/dist-install/build/.depend.c_asm.bit echo "utils/hp2ps_dist-install_depfile_c_asm_EXISTS = YES" >> utils/hp2ps/dist-install/build/.depend.c_asm.tmp grep -v ' : [a-zA-Z]:/' libraries/ghc-prim/dist-install/build/.depend-v-dyn-p.haskell.tmp > libraries/ghc-prim/dist-install/build/.depend-v-dyn-p.haskell.tmp2 mv utils/hp2ps/dist-install/build/.depend.c_asm.tmp utils/hp2ps/dist-install/build/.depend.c_asm sed -e '/hs$/ p' -e '/hs$/ s/o /hi /g' -e '/hs$/ s/:/ : %hi: %o /' -e '/hs$/ s/^/$(eval $(call hi-rule,/' -e '/hs$/ s/$/))/' -e '/hs-boot$/ p' -e '/hs-boot$/ s/o-boot /hi-boot /g' -e '/hs-boot$/ s/:/ : %hi-boot: %o-boot /' -e '/hs-boot$/ s/^/$(eval $(call hi-rule,/' -e '/hs-boot$/ s/$/))/' libraries/ghc-prim/dist-install/build/.depend-v-dyn-p.haskell.tmp2 > libraries/ghc-prim/dist-install/build/.depend-v-dyn-p.haskell echo "libraries/unix_dist-install_depfile_haskell_EXISTS = YES" >> libraries/unix/dist-install/build/.depend-v-dyn-p.haskell.tmp for dir in libraries/unix/dist-install/build/System/ libraries/unix/dist-install/build/System/Posix/ libraries/unix/dist-install/build/System/Posix/ByteString/ libraries/unix/dist-install/build/System/Posix/Directory/ libraries/unix/dist-install/build/System/Posix/DynamicLinker/ libraries/unix/dist-install/build/System/Posix/DynamicLinker/Module/ libraries/unix/dist-install/build/System/Posix/Env/ libraries/unix/dist-install/build/System/Posix/Files/ libraries/unix/dist-install/build/System/Posix/IO/ libraries/unix/dist-install/build/System/Posix/Process/ libraries/unix/dist-install/build/System/Posix/Signals/ libraries/unix/dist-install/build/System/Posix/Temp/ libraries/unix/dist-install/build/System/Posix/Terminal/; do if test ! -d $dir; then mkdir -p $dir; fi done grep -v ' : [a-zA-Z]:/' libraries/unix/dist-install/build/.depend-v-dyn-p.haskell.tmp > libraries/unix/dist-install/build/.depend-v-dyn-p.haskell.tmp2 sed -e '/hs$/ p' -e '/hs$/ s/o /hi /g' -e '/hs$/ s/:/ : %hi: %o /' -e '/hs$/ s/^/$(eval $(call hi-rule,/' -e '/hs$/ s/$/))/' -e '/hs-boot$/ p' -e '/hs-boot$/ s/o-boot /hi-boot /g' -e '/hs-boot$/ s/:/ : %hi-boot: %o-boot /' -e '/hs-boot$/ s/^/$(eval $(call hi-rule,/' -e '/hs-boot$/ s/$/))/' libraries/unix/dist-install/build/.depend-v-dyn-p.haskell.tmp2 > libraries/unix/dist-install/build/.depend-v-dyn-p.haskell GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking how to run the C++ preprocessor... /lib/cpp configure: error: in `/builddir/build/BUILD/ghc-8.10.7/libffi/build/x86_64-unknown-linux-gnu': configure: error: C++ preprocessor "/lib/cpp" fails sanity check See `config.log' for more details echo "libraries/haskeline_dist-install_depfile_haskell_EXISTS = YES" >> libraries/haskeline/dist-install/build/.depend-v-dyn-p.haskell.tmp for dir in libraries/haskeline/dist-install/build/System/Console/ libraries/haskeline/dist-install/build/System/Console/Haskeline/ libraries/haskeline/dist-install/build/System/Console/Haskeline/Backend/ libraries/haskeline/dist-install/build/System/Console/Haskeline/Backend/Posix/ libraries/haskeline/dist-install/build/System/Console/Haskeline/Command/; do if test ! -d $dir; then mkdir -p $dir; fi done grep -v ' : [a-zA-Z]:/' libraries/haskeline/dist-install/build/.depend-v-dyn-p.haskell.tmp > libraries/haskeline/dist-install/build/.depend-v-dyn-p.haskell.tmp2 sed -e '/hs$/ p' -e '/hs$/ s/o /hi /g' -e '/hs$/ s/:/ : %hi: %o /' -e '/hs$/ s/^/$(eval $(call hi-rule,/' -e '/hs$/ s/$/))/' -e '/hs-boot$/ p' -e '/hs-boot$/ s/o-boot /hi-boot /g' -e '/hs-boot$/ s/:/ : %hi-boot: %o-boot /' -e '/hs-boot$/ s/^/$(eval $(call hi-rule,/' -e '/hs-boot$/ s/$/))/' libraries/haskeline/dist-install/build/.depend-v-dyn-p.haskell.tmp2 > libraries/haskeline/dist-install/build/.depend-v-dyn-p.haskell rts/ghc.mk:588: rts/dist/build/.depend-v-dyn-p-l-debug-thr-thr_debug-thr_l-thr_p-debug_dyn-thr_dyn-thr_debug_dyn-l_dyn-thr_l_dyn-thr_debug_p-debug_p.c_asm: No such file or directory make[1]: *** [libffi/ghc.mk:74: libffi/stamp.ffi.static-shared.configure] Error 1 ~~~
Sorry, only just saw this ;-( Okay I will start to move forward with switching ghc 8.10 to bundle libffi in Rawhide. I think I need to request a bundling exception to avoid getting into trouble..
See also bug 2080355, where this was planned (for F38).
Thanks too for sketching the changes. (In fact I already tried this once before in May for ghc9.4, but that time I hadn't filtered out the libffi.so provides and broke the buildroot - anyway I think this can be done properly this time.)
(In reply to Jens Petersen from comment #1) > I think I need to request a bundling exception to avoid getting into > trouble.. I don't think there is needed anything like this these days [1]. But of course this should not be taken lightly (which is not I guess 😉) and the `bundled()` provide is still must. And thank you for looking into this. [1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling
BTW mentioning bug 2080355, should this ticket block it?
(In reply to Vít Ondruch from comment #5) > BTW mentioning bug 2080355, should this ticket block it? I am not sure - actually ghc9 supports static trampolines, so libffi bundling should only be necessary for ghc8
Bundling libffi in the current ghc8.10 has turned out to be a bit harder than I foresaw. I think so further packaging changes are needed to accomplish that.
Okay I have managed to do this locally for ghc8.10. I am not quite ready to push it yet, but I expect it to get into F38.
They should be done in ghc8.10-8.10.7-10.fc38 now in f38-build-side-62436
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.
(In reply to Jens Petersen from comment #9) > They should be done in ghc8.10-8.10.7-10.fc38 now in f38-build-side-62436 Thank you very much for fixing this in ghc8.10! I do note that ghc8.10 accidentally exported all the bundled libffi provides e.g. https://koji.fedoraproject.org/koji/rpminfo?rpmID=33414148 ~~~ libffi.so.7()(64bit) libffi.so.7(LIBFFI_BASE_7.0)(64bit) libffi.so.7(LIBFFI_BASE_7.1)(64bit) libffi.so.7(LIBFFI_CLOSURE_7.0)(64bit) libffi.so.7(LIBFFI_COMPLEX_7.0)(64bit) libffi.so.7(LIBFFI_GO_CLOSURE_7.0)(64bit) ~~~ These should be filtered out. I've filed this bug for the filtering: https://bugzilla.redhat.com/show_bug.cgi?id=2174157
Thanks (Just noting for completeness that I noticed currently the old ghc:8.10 module only still exists in F38+ though it is okay to break that from my point of view - it could/should also be retired anyway probably)
It is now possible to rebuild ghc8.10 in mock (probably for a while). https://koji.fedoraproject.org/koji/taskinfo?taskID=102905839 (x86_64 perf build) (I thought I had linked to the mock issue here but seems not, but anyway the fixed mock that allows building ghc8.10 with systemd-nspawn is already in the koji builder for some weeks/months now I think.)