Created attachment 227110 [details] git diff Hi, As mentioned in a mail[1] this port build crashes on aarch64/14-current. Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /usr/local/poudriere/jails/main-arm64/usr/src/contrib/llvm-project/llvm/include/llvm/Support/Casting.h, line 269. I want to try if disabling LTO fixes this. I can't test it locally. My RPI4 does not have enough memory to build with LTO anyway. As the build crashes disabling LTO for aarch64/14 is no regression and we don't need a portrevision bump. Plus I get portscout mails about new version 5.0.X which is already in databases/mongodb50. So limit the portscout check. [1] https://lists.freebsd.org/archives/freebsd-ports/2021-August/000531.html
By adding a lot of swap space to my RPI4 I succeeded in reproducing the assertion failure with LTO enabled. So I'm quite sure LTO is the cause of the issue.
Does it happen only with clang12? These ports are also affected: databases/mongodb42 databases/mongodb49 databases/mongodb50
(In reply to Mikael Urankar from comment #2) Yes, it only happens with clang12 on aarch64/arm64. We might also hardcode llvm11 in the port. The other mongodb ports are also affected. I thought to first try to fix it for one, before expanding to the others. But YMMV. BTW: mongodb49 is expired and will be removed soon. In the meantime another issue arose in bug #257925 which prevents easy testing of this issue. So make sure scons is the right version before testing.
No need to merge-quarterly. Arm64 does only build quarterlies on FreeBSD versions with clang11 or lower. So the issue does not occur there. But it will not hurt and I'm ok with it either way.
^Triage: Track explicit MFH: No (rather than unset)
(In reply to Ronald Klop from comment #3) We should exclude LTO based on the compiler version not on the FreeBSD version. I tried this but it doesn't work :( .include <bsd.port.pre.mk> .if ${ARCH} == aarch64 && ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} == 120 OPTIONS_EXCLUDE= LTO # Does not work with llvm12 on aarch64. .endif is it worth keeping LTO on aarch64? What are the benefits? Should we put a dep on llvm11 instead (it'll increase build time unfortunately)?
It's lame but we can use this: .include <bsd.port.pre.mk> .if ${ARCH} == aarch64 && ${COMPILER_TYPE} == clang && ${COMPILER_VERSION} == 120 # We can't use OPTIONS_EXCLUDE here :( LTO_MAKE_ARGS= --lto=off .endif
(In reply to Mikael Urankar from comment #6) Hi, I appreciate the effort you are putting into this, but I wouldn't make it too complicated to create something future proof. Possible YAGNI [1] :-) If the next version of llvm/clang does work with LTO on aarch64 I'm happy to enable the LTO option again. > is it worth keeping LTO on aarch64? I understand the theoretical gain of LTO. I don't know if it gives a measurable profit. It was added via a request in bug #253421 and committed using the wrong PR number in ports r565315 (svn). Regards, Ronald. [1] https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=ed95a0e1749ec562cdc347b87e2c0afead356c74 commit ed95a0e1749ec562cdc347b87e2c0afead356c74 Author: Ronald Klop <ronald-lists@klop.ws> AuthorDate: 2021-08-27 12:23:53 +0000 Commit: Mikael Urankar <mikael@FreeBSD.org> CommitDate: 2021-08-27 12:25:29 +0000 databases/mongodb44: Fix crash on aarch64 - Disable LTO on aarch64/14-current (clang12 is crashing) - Limit the portscout check to 4.4.x PR: 257765 databases/mongodb44/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Do you have a patch for: databases/mongodb42 databases/mongodb50 Thanks!
(In reply to Mikael Urankar from comment #10) Thanks a lot. A fix for mongodb50 is in bug #257925. I will try to come up with a patch for mongodb42 if time permits.
Created attachment 227493 [details] git diff mongodb42 Add a patch for mongodb42. Also fixes a portlint warning.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=54df4eaababcbb48d982f6af70483c610e6f17b6 commit 54df4eaababcbb48d982f6af70483c610e6f17b6 Author: Ronald Klop <ronald-lists@klop.ws> AuthorDate: 2021-08-28 13:12:45 +0000 Commit: Mikael Urankar <mikael@FreeBSD.org> CommitDate: 2021-08-28 13:42:10 +0000 databases/mongodb42: Fix crash on aarch64 Disable LTO on aarch64/14-current (clang12 is crashing) PR: 257765 databases/mongodb42/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Thanks!