Bug 250408 - lang/ocaml - update to 4.11.1
Summary: lang/ocaml - update to 4.11.1
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Alexey Dokuchaev
Depends on:
Blocks: 259888
  Show dependency treegraph
Reported: 2020-10-16 21:29 UTC by break19
Modified: 2022-11-22 17:46 UTC (History)
12 users (show)

See Also:
bugzilla: maintainer-feedback? (michipili)
break19: maintainer-feedback+

patch1/2 for asm (384 bytes, patch)
2020-10-16 21:29 UTC, break19
break19: maintainer-approval?
Details | Diff
patch 2/2 for asm (947 bytes, patch)
2020-10-16 21:30 UTC, break19
break19: maintainer-approval?
Details | Diff
Makefile patch (2.91 KB, patch)
2020-10-16 21:31 UTC, break19
no flags Details | Diff
ocaml411.patch - full patch (w/o powerpc) (112.84 KB, patch)
2020-11-29 21:58 UTC, Val Packett [:unrelentingtech]
no flags Details | Diff
ocaml411-extras.patch (camlp4/5, labltk, findlib) (24.66 KB, patch)
2020-12-05 11:07 UTC, Val Packett [:unrelentingtech]
no flags Details | Diff
update-ocaml-to-4.12-with-dependencies-incomplete.patch (41.74 KB, patch)
2021-08-30 05:02 UTC, Yuri Victorovich
no flags Details | Diff
update-ocaml-to-4.12-with-dependencies-incomplete.patch (22.66 KB, patch)
2021-08-30 18:26 UTC, Yuri Victorovich
no flags Details | Diff
update-ocaml-to-4.12-with-dependencies-incomplete.patch (20.27 KB, patch)
2021-08-31 20:57 UTC, Yuri Victorovich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description break19 2020-10-16 21:29:40 UTC
Created attachment 218814 [details]
patch1/2 for asm

Updating to the latest ocaml release seems to be fairly straightforward.

Hacked at the Makefile a bit to remove stuff that isn't needed for compiling at least on my system, as well as references to postscript documentation that does not exist.

Also modified the asm patch for clang11 and made it reflect the new file locations.
Comment 1 break19 2020-10-16 21:30:20 UTC
Created attachment 218815 [details]
patch 2/2 for asm
Comment 2 break19 2020-10-16 21:31:57 UTC
Created attachment 218816 [details]
Makefile patch

This is simply a diff for the port Makefile, showing what was changed there to allow it to compile and install on my amd64, 13-CURRENT
Comment 3 break19 2020-10-19 00:35:43 UTC
It appears I made an error when creating the patches, one of the .rodata should be 16, not 8.

However, it appears that ocaml has adding this on their end in trunk and will be in the next release. See this now-merged Pull Request: https://github.com/ocaml/ocaml/pull/9981
Comment 4 Fernando Apesteguía freebsd_committer 2020-10-19 14:25:54 UTC
^Triage: If there is a changelog or release notes URL available for this version, please add it to the URL field.

Comment 5 Val Packett [:unrelentingtech] 2020-11-29 18:52:41 UTC
Do we even need to pass the AS=.. stuff anymore since https://github.com/ocaml/ocaml/pull/9437 landed?
Comment 6 Val Packett [:unrelentingtech] 2020-11-29 21:58:30 UTC
Created attachment 220083 [details]
ocaml411.patch - full patch (w/o powerpc)

> Do we even need to pass the AS=.. stuff anymore

So we don't, at least on amd64 and aarch64.


Here's a more complete version of the patch (not just makefile) with extra fixes.

- remove all BROKEN, aarch64 works with native codegen now, the others should be fine with just the interpreter
- remove X11 option, the graphics library is not bundled with OCaml anymore since 4.09!
- change '-no-pthread' to '--disable-systhreads', adjust other things for new configure
  - wait, why do we even support building without threads?
- drop spacetime profiler, it will be gone in 4.12 https://github.com/ocaml/ocaml/pull/9948 and we've had some *weird* stuff around it in the port (defined(NO_PROFILE) || ${ARCH:Mpowerpc} || ${ARCH:Mamd64} ---- what? it's actually *only* for amd64 but amd64 is excluded? also the TMPPLIST thing in post-install??)
- unfortunately I've had to drop all the powerpc64 patches as they don't apply anymore (mostly because of directory renames, also because lots of non-FreeBSD-specific powerpc64 stuff has landed upstream already)

Can the powerpc64 crowd please upstream whatever patches are still necessary?? (Probably mostly just the configure script?)
Comment 7 Val Packett [:unrelentingtech] 2020-12-05 11:07:28 UTC
Created attachment 220275 [details]
ocaml411-extras.patch (camlp4/5, labltk, findlib)

Corresponding updates for devel/ocaml-camlp4, devel/ocaml-camlp5, devel/ocaml-findlib, x11-toolkits/ocaml-labltk
Comment 8 Mikael Urankar freebsd_committer 2020-12-06 10:13:51 UTC
@danfe: are you still working on it?
Comment 9 Alexey Dokuchaev freebsd_committer 2020-12-07 04:09:21 UTC
(In reply to Mikael Urankar from comment #8)
Yes, I am.  Regardless of the exact upgrade path (up to the latest version or via 4.07 as I've originally planned), it's not as simple as updating the port on its own, and might also require an exp-run.  Current patch also suggests --disable-force-safe-string which I'd like to avoid as well.
Comment 10 Mikael Urankar freebsd_committer 2021-06-03 16:33:09 UTC
Any update on this issue?
Comment 11 Alexey Dokuchaev freebsd_committer 2021-06-07 10:34:20 UTC
(In reply to Mikael Urankar from comment #10)
> Any update on this issue?
Yes, it's cooking.  I might or might need to request an exp-run on this, depending on several more build cycles of my own, stay tuned.
Comment 12 pr 2021-06-28 13:13:55 UTC
Should this help Mikael Urankar, comment #10, and Alexey Dokuchaev, comment #11, I can confirm Greg'patches from comment #7 and earlier can build successfully (had to patch by hand because the patches are a little misaligned with a recent port tree).

The ocaml compiler seems to work (produces depending ports).
Comment 13 Mikael Urankar freebsd_committer 2021-07-17 09:21:41 UTC
(In reply to Alexey Dokuchaev from comment #11)
Do you need help on this issue? This is a major blocker on FreeBSD aarch64 for many years now.
Comment 14 Yuri Victorovich freebsd_committer 2021-08-30 05:02:15 UTC
Created attachment 227544 [details]

Attached is the patch that updates lang/ocaml to 4.12.0 with some dependencies.

Some dependencies are still broken, so this patch is incomplete.

I will update it when more dependencies are fixed.

Comment 15 Yuri Victorovich freebsd_committer 2021-08-30 18:12:39 UTC

Please don't commit changes into lang/ocaml because they cause conflicts.

Comment 16 Yuri Victorovich freebsd_committer 2021-08-30 18:26:28 UTC
Created attachment 227555 [details]

More dependencies are fixed for ocaml-4.12. About 18 are remaining.
Comment 17 Alexey Dokuchaev freebsd_committer 2021-08-31 04:16:35 UTC
(In reply to Yuri Victorovich from comment #15)
> Please don't commit changes into lang/ocaml because they cause conflicts.
I'm in the process of updating the port, so there are no conflicts.  And no, we won't be updating to 4.12 directly, changes are too dramatic.
Comment 18 Mikael Urankar freebsd_committer 2021-08-31 09:25:51 UTC
(In reply to Alexey Dokuchaev from comment #17)
you've been saying that for almost a year now and no sign of it.
ocaml 4.12 was released 6 months ago and you want to use an older version? Are you serious?
Comment 19 Yuri Victorovich freebsd_committer 2021-08-31 20:57:13 UTC
Created attachment 227577 [details]

More required ocaml-* ports are created, more dependencies now compile for ocaml-4.12,
Comment 20 Hannes Mehnert 2021-11-17 10:38:33 UTC
Now OCaml 4.13 has been released. Is there anything I can help here?

One option would be a lang/ocaml405 and lang/ocaml413 port, so some packages can depend on the old version of OCaml while others can depend on the new version.

Alternatively, some of the ports using an old version of OCaml could be marked as deprecated and being removed?

From browsing the ports, some that use OCaml are still around although they are libraries and the port with an application has been removed -- e.g. audio/liquidsoap has been deleted in 2014, but devel/ocaml-camomile is still around. These could be pruned to simplify the lang/ocaml update.

Any pointers (or someone with a hat) how to proceed here?
Comment 21 Alexey Dokuchaev freebsd_committer 2021-11-17 11:19:18 UTC
(In reply to Hannes Mehnert from comment #20)
> One option would be a lang/ocaml405 and lang/ocaml413 port, so some packages
> can depend on the old version of OCaml while others can depend on the new
> version.
I really wanted to avoid that and prepared for, and it looks quote doable at this point.  I've already converted and committed most of the safe-strings-not-ready ports over past several weeks, now only a few had left, particularly, devel/ocaml-lwt, it's a bit convoluted and volatile beast.

The plan is to move to 4.07 first, then, once the dust settles, to 4.13 or any intermediate versions if seamless upgrade would require it.

> Is there anything I can help here?
Just bear with me, it should not take long at this stage.
Comment 22 pr 2022-01-31 09:31:32 UTC
I am unable to have ocaml + dependencies build on aarch64: the proposed patches no longer apply (and the current Makefile marks the base ocaml port as broken on this arch).

Is there a more recent patch set I can use? Thank you.

Comment 23 commit-hook freebsd_committer 2022-04-16 07:22:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=317aa0442c9942009c1f9c558f8fb6e49d4568ab

commit 317aa0442c9942009c1f9c558f8fb6e49d4568ab
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-04-16 07:19:46 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-04-16 07:19:46 +0000

    OCaml: transient update of the stack to version 4.07.1

    This is the first step in modernizing our OCaml ports infrastructure,
    as we had accumulated substantial technical debt over the years when
    many of its consumer ports had not received proper care and updates.

    It is currently considered as the lowest supported version (baseline)
    in majority of open-source OCaml projects, which would help to pull
    up other ports, e.g. `devel/ocaml-dune' in smaller, manageable pieces.

    For conservative hackers among us and for compatibility with RHEL 8
    which is also on it, having 4.07 in the tree would allow users stick
    to that package (pkg lock it) if needed.

    PR:             250408, 262781
    Exp-run by:     antoine

 devel/cil/Makefile                                 |   3 +-
 devel/ocaml-camlp4/Makefile                        |   2 +-
 devel/ocaml-camlp4/distinfo                        |   6 +-
 devel/ocaml-ppx-tools/Makefile                     |   5 +-
 devel/ocaml-ppx-tools/distinfo                     |   6 +-
 devel/ocaml-sexplib/Makefile                       |   1 +
 lang/ocaml/Makefile                                |  19 +-
 lang/ocaml/distinfo                                |  18 +-
 lang/ocaml/files/patch-675e98a2.c                  |  42 +-
 lang/ocaml/files/patch-configure                   |  43 +-
 .../files/patch-testsuite_tests_asmcomp_power.S    |   4 +-
 lang/ocaml/pkg-plist                               | 761 ++++++++++++---------
 math/Makefile                                      |   1 +
 math/alt-ergo/Makefile                             |   1 +
 math/coq/Makefile                                  |   3 +-
 math/ocaml-num/Makefile (new)                      |  24 +
 math/ocaml-num/distinfo (new)                      |   3 +
 math/ocaml-num/files/patch-src_Makefile (new)      |  12 +
 math/ocaml-num/files/patch-toplevel_Makefile (new) |  21 +
 math/ocaml-num/pkg-descr (new)                     |  10 +
 math/ocaml-num/pkg-plist (new)                     |  33 +
 math/orpie/Makefile                                |   1 +
 math/scilab/Makefile                               |   3 +-
 net-p2p/mldonkey/Makefile                          |   2 +
 security/sks/Makefile                              |   2 +
 x11-toolkits/ocaml-labltk/Makefile                 |   4 +-
 x11-toolkits/ocaml-labltk/distinfo                 |   6 +-
 27 files changed, 618 insertions(+), 418 deletions(-)
Comment 24 Mark Johnston freebsd_committer 2022-08-29 18:08:34 UTC
Sorry if this is the wrong place to ask, but is there any plan to update the compiler past 4.07?  I ran into a problem using opam to install herdtools7, which depends on ocaml-secondary-compiler.  See the last few comments here: https://github.com/ocaml/opam-repository/issues/19763
Comment 25 Alexey Dokuchaev freebsd_committer 2022-08-30 11:21:23 UTC
(In reply to Mark Johnston from comment #24)
> is there any plan to update the compiler past 4.07?
Of course there is, it's an ongoing effort.  I've got stuck several weeks ago with some codependent ports where I could not find the clear upgrade path and decided to take a break; I'll revisit it again with hopefully better (clearer) vision.