Bug 261820 - lang/mlton: Fix build on FreeBSD 14 and i386
Summary: lang/mlton: Fix build on FreeBSD 14 and i386
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Muhammad Moinur Rahman
URL:
Keywords: needs-qa
Depends on:
Blocks: 262083 262082
  Show dependency treegraph
 
Reported: 2022-02-09 11:56 UTC by Timothy Beyer
Modified: 2023-05-12 03:59 UTC (History)
3 users (show)

See Also:
koobs: merge-quarterly?


Attachments
[PATCH] latest changes to lang/mlton (1.71 KB, patch)
2022-02-09 11:56 UTC, Timothy Beyer
no flags Details | Diff
lang_mlton.diff (build on poudriere, major fixes to address memory usage on 32-bit) (3.78 KB, patch)
2022-05-17 04:18 UTC, Timothy Beyer
no flags Details | Diff
[PATCH] build on poudriere, major fixes to address memory usage on 32-bit) (3.78 KB, patch)
2022-05-17 04:48 UTC, Timothy Beyer
beyert: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Beyer 2022-02-09 11:56:23 UTC
Created attachment 231671 [details]
[PATCH] latest changes to lang/mlton

This patch should address some ongoing issues with lang/mlton to dramatically reduce build errors on build servers:

  *  Memory usage has been so extreme that building on i386 build servers often fails due to slightly imperfect conditions.  This is like because the zone pass was intended to be disabled on modern versions, but was unintentionally? hardcoded to a specific older version (corrected).

  *  Simple fix where bootstrap images for FreeBSD versions >= 13 were unavailable  (if compat13x is needed, then I will add it to dependencies, but it shouldn't be necessary), so it should build on FreeBSD 14.x with this change

If there are any further issues on the build servers, I will send in an updated patch as soon as possible
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-02-22 00:28:57 UTC
@Maintainer Can you confirm, whether these changes have been poudriere tested on all supported FreeBSD versions/arch combinations and pass without regressions? If not, are you able to run those tests?
Comment 2 Timothy Beyer 2022-02-22 02:23:45 UTC
I've (In reply to Kubilay Kocak from comment #1)
I built these on a FreeBSD 13.0-RELEASE i386 bhyve VM, although I haven't used poudriere, I just did a build in a VM, but I am happy to do poudriere to confirm.

Basically, it has always built on all of my machines from FreeBSD 11.x, 12.x and 13.x for both i386 and amd64, but the conditions vary a lot on different machines.

On the build servers, it has never built on i386 successfully, and I suspect because it is running out of memory (it was incredibly hard to get the original port to build when I made bootstrap images for FreeBSD 11-13 i386).

That being said, the patches here are very minimal, and are very low risk:

In the Makefile, if the FreeBSD version is greater than 13.x, then use the 13.x bootstrap image, so that it will build on FreeBSD 14 with an available bootstrap image.  Even it doesn't work, it won't be any worse than it is now, because it won't build at all without a matching bootstrap image.

In mlton's native Makefile, I correct a typo that hardcoded the -disable-pass zone flag to solely a specific old release in 2019, whereas I think the creator of mlton intended that flag to always be used until the zone pass was optimized.

My tests a few weeks ago confirm the developer's intuitions below that the pass uses abnormal amounts of RAM (although my testing was not a rigorous process, see below for the developer's thread):

Disable Zone pass by default
https://github.com/MLton/mlton/commit/01b87480a3ebf9b49087d1c01173cda87c3812f3
Comment 3 Timothy Beyer 2022-05-17 04:18:09 UTC
Created attachment 233980 [details]
lang_mlton.diff (build on poudriere, major fixes to address memory usage on 32-bit)

I now have produced a far better patch that addresses the memory usage issues at compile time to the fullest extent possible, and has been extensively tested on poudriere and bhyve VMs.

Based on extensive testing, shown below, and that I am the maintainer of the port, I would recommend getting it committed shortly with the new patch.

Poudriere builds were tested on a FreeBSD 13.0 RELEASE amd64 host, with poudriere jails of FreeBSD 13.0 amd64, FreeBSD 12.2 amd64, FreeBSD 13.0 i386 and FreeBSD 12.2 i386)

Note that 32-bit bhyve builds were tested on 3.0, 3.2, 3.4, 3.6, 3.8 and 4.0 gb of RAM on bhyve on FreeBSD 12.2-RELEASE i386 and 13.0-RELEASE i386 for the simple reason that this would stress test the build more than poudriere, which is the easiest way to build.

Finally, this has the potential to build on 14-CURRENT, unlike past revisions.
Comment 4 Timothy Beyer 2022-05-17 04:48:36 UTC
Created attachment 233985 [details]
[PATCH] build on poudriere, major fixes to address memory usage on 32-bit)

fix subject in patch, but otherwise identical
Comment 5 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-03-20 01:06:10 UTC
I am taking this as lang/urweb is marked for removal today. I will check if it's buildable once I commit this.
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-03-20 16:35:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1ad4dbd771c18f9a599411d3a9f08f375523db96

commit 1ad4dbd771c18f9a599411d3a9f08f375523db96
Author:     Timothy Beyer <beyert@cs.ucr.edu>
AuthorDate: 2023-03-20 16:31:06 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-03-20 16:34:41 +0000

    lang/mlton: Fix BUILD

    -  Memory usage has been so extreme that building on i386 build servers
       often fails due to slightly imperfect conditions.  This is like
       because the zone pass was intended to be disabled on modern versions,
       but was unintentionally? hardcoded to a specific older version
       (corrected).
    -  Simple fix where bootstrap images for FreeBSD versions >= 13 were
       unavailable  (if compat13x is needed, then I will add it to
       dependencies, but it shouldn't be necessary), so it should build on
       FreeBSD 14.x with this change
    - While I(bofh) am here pet portclippy/portfmt
    - Utilize OPTIONSNG as best as possible

    PR:             261820
    Approved by:    MAINTAINER

 lang/mlton/Makefile                         | 184 +++++++++++++---------------
 lang/mlton/files/patch-mlton_Makefile (new) |  11 ++
 2 files changed, 95 insertions(+), 100 deletions(-)
Comment 7 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-03-20 16:38:55 UTC
Please do not create .orig directory and create the diffs just create the diffs with git diff.
Comment 8 Timothy Beyer 2023-05-12 03:59:44 UTC
(In reply to Muhammad Moinur Rahman from comment #7)

Point taken, and thank you for getting this update integrated, thanks to the heuristics, it is now building on a lot more targets than before in spite of high memory usage, although the 13.x i386 build not working vs the 12.x i386 and 14.x i386 builds working perfectly puzzle me at the moment.

I'll fix my submission of lang/twelf shortly with a not yet on the internet update for newer releases once I test it more on poudriere and get it on to my github.