Bug 259570 - devel/llvm13: FLANG option (default: on) causes build failure
Summary: devel/llvm13: FLANG option (default: on) causes build failure
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: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-31 10:09 UTC by Matthias Andree
Modified: 2022-05-22 02:32 UTC (History)
5 users (show)

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


Attachments
poudriere bulk -t failure log (unrelated to this port). (306.82 KB, text/x-xz-compressed)
2021-10-31 10:09 UTC, Matthias Andree
no flags Details
poudriere bulk -t build log with default options. 13.0-RELEASE-p4, amd64 (169.21 KB, text/x-xz-compressed)
2021-10-31 10:17 UTC, Matthias Andree
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Andree freebsd_committer freebsd_triage 2021-10-31 10:09:15 UTC
Created attachment 229164 [details]
poudriere bulk -t failure log (unrelated to this port).

LLVM13 does not build for me in poudriere (13.0-RELEASE-p4 jail, amd64),  with default options (i. e. after poudriere options -rn devel/llvm13).

Am getting a handful of FAILED: lines with no further output.

Compressed log attached. 

Excerpt:

7441:[00:05:49] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o 
7444:[00:07:23] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o 
7447:[00:09:35] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-complex.cpp.o 
7450:[00:18:38] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold.cpp.o 
7454:[00:22:08] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-designator.cpp.o 

Or: rg -C2 /expression.cpp /usr/local/poudriere/data/logs/bulk/130amd64-default/2021-10-31_10h08m51s/logs/llvm13-13.0.0_1.log 

7438-[00:04:13] [ 70% 5861/8307] /usr/local/libexec/ccache/c++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/lib/Parser -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Parser -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/include -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/clang/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../clang/include -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Parser/CMakeFiles/obj.FortranParser.dir/debug-parser.cpp.o -MF tools/flang/lib/Parser/CMakeFiles/obj.FortranParser.dir/debug-parser.cpp.o.d -o tools/flang/lib/Parser/CMakeFiles/obj.FortranParser.dir/debug-parser.cpp.o -c /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Parser/debug-parser.cpp
7439-[00:04:14] [ 70% 5862/8307] /usr/local/libexec/ccache/c++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/lib/Parser -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Parser -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/include -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/clang/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../clang/include -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Parser/CMakeFiles/obj.FortranParser.dir/instrumented-parser.cpp.o -MF tools/flang/lib/Parser/CMakeFiles/obj.FortranParser.dir/instrumented-parser.cpp.o.d -o tools/flang/lib/Parser/CMakeFiles/obj.FortranParser.dir/instrumented-parser.cpp.o -c /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Parser/instrumented-parser.cpp
7440:[00:05:49] [ 70% 5863/8307] /usr/local/libexec/ccache/c++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/lib/Evaluate -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Evaluate -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/include -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/clang/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../clang/include -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o -MF tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o.d -o tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o -c /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Evaluate/expression.cpp
7441:[00:05:49] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o 
7442:[00:05:49] /usr/local/libexec/ccache/c++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/lib/Evaluate -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Evaluate -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/include -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/clang/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../clang/include -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o -MF tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o.d -o tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/expression.cpp.o -c /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Evaluate/expression.cpp
7443-[00:07:23] [ 70% 5863/8307] /usr/local/libexec/ccache/c++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/lib/Evaluate -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Evaluate -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/tools/flang/include -I/wrkdirs/usr/ports/devel/llvm13/work/.build/include -I/wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/mlir/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/.build/tools/clang/include -isystem /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/llvm/../clang/include -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O2 -pipe -DNDEBUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o -MF tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o.d -o tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o -c /wrkdirs/usr/ports/devel/llvm13/work/llvm-project-13.0.0.src/flang/lib/Evaluate/fold-real.cpp
7444-[00:07:23] FAILED: tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/fold-real.cpp.o
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2021-10-31 10:16:36 UTC
Comment on attachment 229164 [details]
poudriere bulk -t failure log (unrelated to this port).

whoops. I'd attached the wrong log. Forget this one.
Comment 2 Matthias Andree freebsd_committer freebsd_triage 2021-10-31 10:17:08 UTC
Created attachment 229165 [details]
poudriere bulk -t build log with default options. 13.0-RELEASE-p4, amd64
Comment 3 Matthias Andree freebsd_committer freebsd_triage 2021-10-31 10:37:51 UTC
Workaround: poudriere options -cn devel/llvm13 - then disable the FLANG option, and rebuild. This approach succeeds.
Comment 4 Brooks Davis freebsd_committer freebsd_triage 2021-11-01 19:41:48 UTC
It works for me (I just tested with a fresh 13.O-RELEASE-p4 jail) and I've long since resolved pkg builder errors in the initial commits.

The attached log appears truncated and AFACT contains no errors. That type of error may mean the clang process failed somehow (e.g., OOM killer). Could you check to make sure you don't have crashed c++ processes in your other logs?

BTW, if you're disabling FLANG you likely also want to disable MLIR so save some build time.
Comment 5 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2021-11-06 22:22:42 UTC
My problem with llvm13 is this. I have 6 CPUS, but only 4G of RAM and 4G of swap.  The build of llvm13 runs out of space to build.  So I have to build with MAKE_JOBS_UNSAFE=yes, which is very slow.

Any chance that this is related?  Does disabling FLANG and MLIR cause the compiler to use a lot less RAM?
Comment 6 Citroën 2021-11-11 20:26:37 UTC
My situation is a bit different : I'm not building using poudriere but directly with ports.
I confirm that without the flang option,llvm13 builds OK.

My machine only has 2 Gb ram and two (old) CPUs but still I managed to build llvm13 once I've removed the flang option (but left mlir even though it has been suggested elsewhere to unselect it as well).

With flang selected, the build would run "normally" to about 60% (of the estimated progress) when it would hit the flang part. There, it would almost crawl to a halt. c++ would get stuck with apparently numerous endless "swread" of small fragments (240 to 100K). Swap is 50% unused. Compiling a single .cpp file would take 6 to 8 hours. After letting it go for a couple of files, I did kill the build...   :(
Attempts to restart it with `make install`would take it from some 10 steps behind (rebuilding pieces successfully built during previous attempt) then would come to the same painfull grinding progress. This would show at c++ -E copy <somefile.html> html<samename.html>... and continue through subsequent .cpp's.
Comment 7 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2021-11-11 21:32:35 UTC
For me llvm13 wouldn't install with MLIR deselected.
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-11-11 23:52:05 UTC
A commit in branch main references this bug:

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

commit 3f4163a191133d25b424dff14a6cde8d89c34e65
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-11 23:50:35 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-11 23:50:35 +0000

    devel/llvm13: fix install with MLIR disabled

    PR:             259570 (reported here, but tangential)
    Reported by:    stephen

 devel/llvm13/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 9 commit-hook freebsd_committer freebsd_triage 2021-11-12 17:51:14 UTC
A commit in branch 2021Q4 references this bug:

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

commit a4b2e2d68c299e59e0edad2f066b8913f0773601
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-12 17:31:01 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-12 17:31:01 +0000

    devel/llvm13: fix install with MLIR disabled

    PR:             259570 (reported here, but tangential)
    Reported by:    stephen

    (cherry picked from commit 3f4163a191133d25b424dff14a6cde8d89c34e65)

 devel/llvm13/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 10 Peter Much 2022-01-08 23:54:05 UTC
Hit me, too. In 2022Q1 FLANG and MLIR is on by default.

I've seen a single process reach out for 4.5 GB, so thats what is needed as minimum, if not memory then swap. And with slower swap I suggest to disengage the oom-killer:
vm.pageout_oom_seq=1024 (or bigger)

With 10 CPU the VSZ reached 32 GB, and swap doesn't help then, it gives just a merry-go-round that takes forever.
What works for me is to appropriately adjust the number of concurrent jobs (in /etc/make.conf):

.if ${.CURDIR:C/.*\/devel\/llvm.*//} == ""
HAVE_MEM_INSTALLED != /sbin/sysctl -n hw.physmem
MAKE_JOBS_NUMBER != /bin/expr ${HAVE_MEM_INSTALLED} / 2500000000 + 1
.endif
Comment 11 Robert Clausecker freebsd_committer freebsd_triage 2022-02-01 16:55:22 UTC
Hi there,

I have the same problem with building devel/llvm13 on 2022Q1 with armv7 FreeBSD 13.  Building LLVM fails with an OOM condition as the 4GB address space of a 32 bit platform is not large enough to compile the port.

Unfortunately this means that lots of other important ports including devel/sdl20 cannot be built on armv7 as devel/llvm13 is used as the compiler for mesa DRI and some other important ports.

Please configure the port in some way such that it builds even on 32 bit targets.
Comment 12 Brooks Davis freebsd_committer freebsd_triage 2022-02-01 18:39:06 UTC
(In reply to Robert Clausecker from comment #11)
I plan to disable FLANG support entirely on armv6 and armv7 as soon as 13.0.1 is released. (I fear that release will be delayed a bit longer as there is currently a crashing bug when compiling the latest libc++.)
Comment 13 Robert Clausecker freebsd_committer freebsd_triage 2022-02-01 21:09:12 UTC
(In reply to Brooks Davis from comment #12)

Would be good if you could do it for 13.0.0 already.  2022Q1 is good for another two month and it would really be great to be able to build packages without having to mess with the configuration.
Comment 14 Brooks Davis freebsd_committer freebsd_triage 2022-04-20 23:20:54 UTC
I failed to mention this in the commit, but flang was disabled on arm[67] in b00578b9b208edb0f805a1b48e2d217435666f53 and I merged to quarterly.