freetennis failed to build from source in Fedora rawhide/f39 https://koji.fedoraproject.org/koji/taskinfo?taskID=103575662 For details on the mass rebuild see: https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Please fix freetennis at your earliest convenience and set the bug's status to ASSIGNED when you start fixing it. If the bug remains in NEW state for 8 weeks, freetennis will be orphaned. Before branching of Fedora 40, freetennis will be retired, if it still fails to build. For more details on the FTBFS policy, please visit: https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/
Created attachment 1977912 [details] build.log
Created attachment 1977913 [details] root.log file root.log too big, will only attach last 32768 bytes
Created attachment 1977914 [details] state.log
So the error here is: File "_none_", line 1: Alert ocaml_deprecated_auto_include: OCaml's lib directory layout changed in 5.0. The unix subdirectory has been automatically added to the search path, but you should add -I +unix to the command-line to silence this alert (e.g. by adding unix to the list of libraries in your dune file, or adding use_unix to your _tags file for ocamlbuild, or using -package unix for ocamlfind). File "freetennis.ml", line 6654, characters 31-47: 6654 | let mayb = translateName (String.lowercase !p0Name ) in ^^^^^^^^^^^^^^^^ Error: Unbound value String.lowercase I'm afraid my ocaml skills are pretty much non existent. Does this Unbound value String.lowercase indicate a missing include or ...? I could certainly use some help with this from someone more versed in ocaml.
The warning is saying that the freetennis build system / makefiles have to be changed to add `-I +unix' to the ocaml compiler command line. However the actual error is different. The String.lowercase function in OCaml <= 4.12 only worked on ISO-8859-1 strings. As a result it wasn't very useful for modern systems. This function has been removed in OCaml 5, but there is a replacement String.lowercase_ascii. It only works with 7-bit ASCII strings, but I'm sure it'll be fine here. (For UTF-8 you'd need to add an external library). I think simply patching the code with s/String.lowercase/String.lowercase_ascii/g is practically all you'd need to do here.
See also /usr/lib64/ocaml/string.mli
Richard, thank you for the help. I'm getting much further now. After fixing the first set of errors I got an error about bigarray.cmxa not being found, with ocaml 5.0 there is a bigarray.mli file instead so I just dropped bigarray.cmxa from the ocamlopt invocation. That seems to work, but now I'm getting an error about unresolved symbols in the ocaml SDL bindings: /usr/bin/ld: /usr/lib64/ocaml/sdl/libsdlstub.a(sdlevent_stub.o): in function `mlsdlevent_wait': (.text+0x115e): undefined reference to `enter_blocking_section' /usr/bin/ld: (.text+0x116c): undefined reference to `leave_blocking_section' /usr/bin/ld: /usr/lib64/ocaml/sdl/libsdlstub.a(sdlevent_stub.o): in function `mlsdlevent_wait_event': (.text+0x11ad): undefined reference to `enter_blocking_section' /usr/bin/ld: (.text+0x11bd): undefined reference to `leave_blocking_section' /usr/bin/ld: /usr/lib64/ocaml/sdl/libsdlstub.a(sdltimer_stub.o): in function `sdltimer_delay': (.text+0x14): undefined reference to `enter_blocking_section' /usr/bin/ld: (.text+0x21): undefined reference to `leave_blocking_section' /usr/bin/ld: /usr/lib64/ocaml/sdl/libsdlstub.a(sdlgl_stub.o): in function `ml_SDL_GL_SwapBuffers': (.text+0x9): undefined reference to `enter_blocking_section' /usr/bin/ld: (.text+0x13): undefined reference to `leave_blocking_section' collect2: error: ld returned 1 exit status Is this an issue with the SDL bindings; or do I need to add something to the ocamlopt invocation to add an extra lib to the ld command with these symbols ?
Jerry added this patch to make ocaml-SDL compile with OCaml 5: https://src.fedoraproject.org/rpms/ocaml-SDL/blob/rawhide/f/ocamlsdl-0.9.1-ocaml5.patch Notice that it deals with a change in OCaml 5 where you are no longer allowed to use un-namespaced symbols in the OCaml runtime (like "alloc_small") but must use namespaced symbols instead ("caml_alloc_small"). caml_enter_blocking_section / caml_leave_blocking_section are also symbols in the OCaml runtime, and my theory is that this patch is incomplete and there are un-namespaced uses of enter_blocking_section etc still in the code, in fact like these ones: $ grep -E '(enter|leave)_blocking_section' src/*.c src/sdlevent_stub.c: enter_blocking_section(); src/sdlevent_stub.c: leave_blocking_section(); src/sdlevent_stub.c: enter_blocking_section(); src/sdlevent_stub.c: leave_blocking_section(); src/sdlgl_stub.c: enter_blocking_section(); src/sdlgl_stub.c: leave_blocking_section(); src/sdlloader_stub.c: enter_blocking_section(); src/sdlloader_stub.c: leave_blocking_section(); src/sdltimer_stub.c: enter_blocking_section(); src/sdltimer_stub.c: leave_blocking_section(); So I will push an extra patch to ocaml-SDL shortly, which might fix this.
ocaml-SDL-0.9.1-62.fc39 https://koji.fedoraproject.org/koji/taskinfo?taskID=104368014 > After fixing the first set of errors I got an error about bigarray.cmxa not > being found, with ocaml 5.0 there is a bigarray.mli file instead so I just > dropped bigarray.cmxa from the ocamlopt invocation. This seems dubious to me. I think the change you might need to make it to add '-I +bigarray' to the ocamlopt command line.
Oops, sorry for overlooking some of those symbols. (In reply to Richard W.M. Jones from comment #9) > ocaml-SDL-0.9.1-62.fc39 > https://koji.fedoraproject.org/koji/taskinfo?taskID=104368014 > > > After fixing the first set of errors I got an error about bigarray.cmxa not > > being found, with ocaml 5.0 there is a bigarray.mli file instead so I just > > dropped bigarray.cmxa from the ocamlopt invocation. > > This seems dubious to me. I think the change you might need to make it to > add '-I +bigarray' to the ocamlopt command line. Actually, I think Hans has it right. From the OCaml 5.0.0 announcment (https://discuss.ocaml.org/t/ocaml-5-0-0-is-out/10974): (breaking change) #10896 8: Remove Stream, Genlex and Pervasives. Also remove legacy standalone bigarray library (the Bigarray module is now part of the standard library). (Nicolás Ojeda Bär, review by Kate Deplaix and Anil Madhavapeddy)
> ocaml-SDL-0.9.1-62.fc39 > https://koji.fedoraproject.org/koji/taskinfo?taskID=104368014 Thanks based on a local mockbuild that seems to have done the trick. I'm starting a proper koji build with the fixes now.
> I'm starting a proper koji build with the fixes now. Almost there. The i686 and ppc64le builds failed. I see that ocaml5 / F39 does not support ocaml on 32 bit x86 so fixing this is just duplicating the: ``` # i686 support was dropped in OCaml 5 / Fedora 39. ExcludeArch: %{ix86} ``` Lines from ocaml.spec ppc64le also should be easy to fix I think. The issue is there is no ocamlopt command on ppc64le anymore with ocaml5 ? ``` + make -j8 ocamlopt -I +camlimages -I +lablGL -I +lablgtk2 -I +sdl -I +unix -o freetennis sdl.cmxa lablgtk.cmxa lablgl.cmxa sdlmixer.cmxa sdlttf.cmxa unix.cmxa freetennis.ml make: ocamlopt: No such file or directory make: *** [Makefile:3: all] Error 127 ``` So I guess I should do something like this: %ifnarch %{ocaml_native_compiler} sed -i 's/ocamlopt/ocaml/' Makefile %endif ?
Ok, that is not correct, I think the correct sed is: sed -i -e 's/ocamlopt/ocamlc/g' -e 's/cmxa/cma/g' Makefile I'm doing a pcc64le only scratch-build with that now. If that succeeds I'll kick of a real build, because after reading some docs I'm reasonably sure that this is the right thing to do.
You are going to need to invoke ocamlc instead of ocamlopt, and you will probably need to add -output-complete-exe to the build flags as well. If you'll give me a few minutes, I'll look this over and see if any other tweaks are needed.
(In reply to Jerry James from comment #14) > You are going to need to invoke ocamlc instead of ocamlopt, and you will > probably need to add -output-complete-exe to the build flags as well. If > you'll give me a few minutes, I'll look this over and see if any other > tweaks are needed. Ok, thanks. Note this builds on ppc64le (but I have not tested it): diff --git a/freetennis.spec b/freetennis.spec index 7198ebc..94f3253 100644 --- a/freetennis.spec +++ b/freetennis.spec @@ -21,6 +21,8 @@ BuildRequires: ocaml-camlimages-devel BuildRequires: ocaml-SDL-devel >= 0.9.1-34 BuildRequires: ocaml-lablgl-devel >= 1.06-1 BuildRequires: ocaml-lablgtk-devel >= 2.10.1-5 +# i686 support was dropped in OCaml 5 / Fedora 39. +ExcludeArch: %{ix86} %description Free Tennis is a free software tennis simulation game. The game can be @@ -29,6 +31,9 @@ played against an A.I. or human-vs-human via LAN or internet. %prep %autosetup -p1 +%ifnarch %{ocaml_native_compiler} +sed -i -e 's/ocamlopt/ocamlc/g' -e 's/cmxa/cma/g' Makefile +%endif %build I guess the -output-complete-exe is necessary to also include the sdl and lablgtk bytecode inside the bytecode based binary ? Maybe an alternative would be to add Requires: to the non devel parts of the necessary libs in the %ifnarch %{ocaml_native_compiler} case ?
Note the absence of the native compiler on ppc64le, s390x & riscv64 is temporary and we expect those compiler back ends to be ported in OCaml 5.1. i686 ain't never coming back.
(In reply to Hans de Goede from comment #15) > diff --git a/freetennis.spec b/freetennis.spec > index 7198ebc..94f3253 100644 > --- a/freetennis.spec > +++ b/freetennis.spec > @@ -21,6 +21,8 @@ BuildRequires: ocaml-camlimages-devel > BuildRequires: ocaml-SDL-devel >= 0.9.1-34 > BuildRequires: ocaml-lablgl-devel >= 1.06-1 > BuildRequires: ocaml-lablgtk-devel >= 2.10.1-5 > +# i686 support was dropped in OCaml 5 / Fedora 39. > +ExcludeArch: %{ix86} This spec file already has an ExcludeArch, so I think you will want to combine them. > I guess the -output-complete-exe is necessary to also include the sdl and > lablgtk bytecode inside the bytecode based binary ? Right. > Maybe an alternative would be to add Requires: to the non devel parts of the > necessary libs in the %ifnarch %{ocaml_native_compiler} case ? I don't see why that would be better, even if it works. The advantage of using -output-complete-exe is that stripping the output binary does not remove the bytecode payload. This package disables debuginfo generation anyway, so it doesn't matter ... except there is no reason for this package to disable debuginfo generation. All that is missing is the -g flag for ocamlopt / ocamlc. I've got several improvements to suggest for this package now, and have verified that the ppc64le build works with my approach, too. I'll open a PR momentarily and you can choose whether to merge it or not, or to cherry pick from it if you don't like all of it.
https://src.fedoraproject.org/rpms/freetennis/pull-request/1
(In reply to Jerry James from comment #18) > https://src.fedoraproject.org/rpms/freetennis/pull-request/1 Thank you. This looks good to me I'll merge this and then start a new build.
FEDORA-2023-5e9a88ebc4 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-5e9a88ebc4
FEDORA-2023-5e9a88ebc4 has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report.