Bug 229710 - lang/mono5.20: port to aarch64
Summary: lang/mono5.20: port to aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mikael Urankar
URL:
Keywords:
Depends on:
Blocks: 201763
  Show dependency treegraph
 
Reported: 2018-07-12 01:45 UTC by Val Packett
Modified: 2022-03-28 10:25 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (mono)


Attachments
mono-aarch64.patch (10.39 KB, patch)
2018-07-12 01:45 UTC, Val Packett
no flags Details | Diff
mono-aarch64.patch (10.41 KB, patch)
2018-08-06 17:10 UTC, Val Packett
no flags Details | Diff
mono-aarch64.patch v2 (10.56 KB, patch)
2018-12-28 14:52 UTC, Val Packett
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Val Packett 2018-07-12 01:45:30 UTC
Created attachment 195063 [details]
mono-aarch64.patch

I don't know why I did this, I'm not even planning to use .NET on my RPi3, I guess it was just bothering me that it worked on armv7 and not aarch64… (also I needed to do something in parallel while Crystal was compiling on the ThunderX I rented from packet.net)

Hopefully I didn't screw anything up (I was modifying the port as errors appeared, did not clean and rebuild from scratch — it's slow and access to a ThunderX is expensive… honestly it's not much faster than RPi here because of an issue described below)

The Roslyn C# compiler has a concurrency problem on aarch64: https://github.com/mono/mono/issues/7017 (not FreeBSD specific) so the workaround is to disable parallelism… so the .NET libraries are built very very slowly :(

BoringSSL patch is from bug 223019 but slightly modified (to ignore <sys/auxv.h>), see comment in that thread.

Also there was an intermittent jemalloc error, had to restart the build once:

<jemalloc>: /usr/src/contrib/jemalloc/include/jemalloc/internal/extent_inlines.h:63: Failed assertion: "szind < NSIZES"                                                               

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

gmake[14]: *** [../../../build/library.make:342: ../../../class/lib/net_4_x-linux/Facades/System.IO.FileSystem.Primitives.dll] Abort trap (core dumped)
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2018-08-06 15:37:03 UTC
(In reply to Greg V from comment #0)
Can you regenerate the patch, the plist patch is broken:
svn patch --strip 3 --dry-run patch.aarch64 
U         Makefile
>         applied hunk @@ -60,6 +60,15 @@ with offset 4
>         applied hunk @@ -88,4 +97,4 @@ with offset 4
A         files/extra-patch-aarch64-race-workaround
U         files/patch-configure.ac
A         files/patch-external_boringssl_crypto_cpu-aarch64-linux.c
A         files/patch-mono_sgen_sgen-archdep.h
A         files/patch-mono_utils_mono-sigcontext.h
C         pkg-plist
>         rejected hunk @@ -2937,38 +2937,38 @@
Summary of conflicts:
  Text conflicts: 1


It builds fine on -current (I don't have the jemalloc issue and I don't need the extra patch on my board), have you tried on 11.1 or 11.2?
Comment 2 Val Packett 2018-08-06 17:10:02 UTC
Created attachment 195945 [details]
mono-aarch64.patch

Sure, this should be a diff against current master.

I only tried on CURRENT.

jemalloc — maybe you got lucky, it only happened once during my build. Or maybe this was fixed — I used an old current snapshot for the build.

extra-patch — looks like the model of the processor matters. The concurrency bug is definitely happening on Cavium ThunderX (it's been happening to everyone on Linux before I even tried on FreeBSD).
Comment 3 Mikael Urankar freebsd_committer freebsd_triage 2018-08-07 14:39:40 UTC
It builds fine on 11.1.
Comment 4 Colin T. 2018-11-24 05:37:28 UTC
Part of this patch has been merged upstream:
https://github.com/mono/mono/pull/11638
Comment 5 Val Packett 2018-12-28 14:52:05 UTC
Created attachment 200579 [details]
mono-aarch64.patch v2

Updated patch with correct cpu feature detection in boringssl (thanks: Mikael)
Comment 6 Mikael Urankar freebsd_committer freebsd_triage 2019-03-18 09:20:32 UTC
Can this patch gets reviewed/commited?
thanks
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-01-08 16:22:25 UTC
A commit references this bug:

Author: mikael
Date: Fri Jan  8 16:22:07 UTC 2021
New revision: 560789
URL: https://svnweb.freebsd.org/changeset/ports/560789

Log:
  lang/mono5.20: fix build on aarch64

  PR:		229710
  Submitted by:	Greg V greg@unrelenting.technology
  Approved by:	portmgr (tier-2 blanket)

Changes:
  head/lang/mono5.20/Makefile
  head/lang/mono5.20/files/extra-patch-aarch64-race-workaround
  head/lang/mono5.20/files/patch-configure.ac
  head/lang/mono5.20/files/patch-external_boringssl_crypto_cpu-aarch64-linux.c
  head/lang/mono5.20/files/patch-mono_sgen_sgen-archdep.h
  head/lang/mono5.20/files/patch-mono_utils_mono-sigcontext.h
  head/lang/mono5.20/pkg-plist
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-01-08 16:24:27 UTC
A commit references this bug:

Author: mikael
Date: Fri Jan  8 16:23:37 UTC 2021
New revision: 560790
URL: https://svnweb.freebsd.org/changeset/ports/560790

Log:
  MFH: r560789

  lang/mono5.20: fix build on aarch64

  PR:		229710
  Submitted by:	Greg V greg@unrelenting.technology
  Approved by:	portmgr (tier-2 blanket)

Changes:
_U  branches/2021Q1/
  branches/2021Q1/lang/mono5.20/Makefile
  branches/2021Q1/lang/mono5.20/files/extra-patch-aarch64-race-workaround
  branches/2021Q1/lang/mono5.20/files/patch-configure.ac
  branches/2021Q1/lang/mono5.20/files/patch-external_boringssl_crypto_cpu-aarch64-linux.c
  branches/2021Q1/lang/mono5.20/files/patch-mono_sgen_sgen-archdep.h
  branches/2021Q1/lang/mono5.20/files/patch-mono_utils_mono-sigcontext.h
  branches/2021Q1/lang/mono5.20/pkg-plist
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2021-01-08 16:36:29 UTC
Thanks!
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-03-28 10:25:26 UTC
A commit in branch main references this bug:

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

commit b62ec370c8d8289c7fe8892a88c4d65eaab92f5b
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2022-03-28 09:21:02 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2022-03-28 10:21:05 +0000

    lang/mono5.10,lang/mono: Attempt to fix build on aarch64

    The Roslyn C# compiler has a concurrency problem on aarch64:
    https://github.com/mono/mono/issues/7017 (not FreeBSD specific)
    so the workaround is to disable parallelism… so the .NET libraries are built
    very very slowly

    PR:             229710
    Approved by:    portmgr (build fix blanket)

 lang/mono/Makefile                                 |  1 +
 .../extra-patch-aarch64-race-workaround (new)      | 26 ++++++++++++++++++++++
 lang/mono5.10/Makefile                             |  1 +
 .../extra-patch-aarch64-race-workaround (new)      | 26 ++++++++++++++++++++++
 4 files changed, 54 insertions(+)