Bug 235782 - clang compiler crashed while building a large C++ program (that makes some use of boost)
Summary: clang compiler crashed while building a large C++ program (that makes some us...
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-16 16:45 UTC by robthedude
Modified: 2019-02-16 18:41 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description robthedude 2019-02-16 16:45:03 UTC
c++: error: unable to execute command: Killed
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
c++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Killed
$ c++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
c++: note: diagnostic msg: /tmp/wpantund-a383d2.cpp
c++: note: diagnostic msg: /tmp/wpantund-a383d2.sh
c++: note: diagnostic msg: 

********************


I can't add the attachment because it's too large, and it also includes basically all the code I'm trying to build.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2019-02-16 16:50:09 UTC
Reassign to toolchain@ and trim Summary.
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2019-02-16 17:39:23 UTC
This "Killed" phenomenon is what typically happens if you run out of memory.  Please check your dmesg for "was killed: out of swap space" or "swap_pager_getswapspace(number): failed" errors.  If you see those, try adding more RAM to the machine, adding more swap space, or alternatively, lower the number of parallel build jobs.
Comment 3 robthedude 2019-02-16 18:28:41 UTC
Yes that appears to have been what happened (it actually looks like there may have been some stale .o state -- I was building and fixing errors and building etc -- and there was a file left over when it crashed that wasn't actually a real file).  

I didn't add any RAM or change the build, but a make clean followed by another make worked fine.

You can close this if you like -- I only filed it because it told me to :-).
Comment 4 Mark Millard 2019-02-16 18:41:12 UTC
(In reply to Dimitry Andric from comment #2)

If the person with the problem see any of the:

swap_pager_getswapspace(number): failed

message they really are out of swap. The other
message can happen when there is plenty of swap
but processes that stay runnable are preventing
having sufficient free RAM after some number of
tries by FreeBSD: runnable processes are not
(fully) swapped-out by FreeBSD, only paged.

There is a tunable that can increase the number
of tries at freeing RAM before "was killed: out
of swap space" happens. This is used on low end
armv7's and aarch64's and such to allow buildworld
and the like to complete with -j4, for example.

vm.pageout_oom_seq has a default of 12 (last I
checked). Figures like 120 and 1024 have been
used on those low end armv7 and aarch64 examples.
(pi2 V1.1 and rpi3 are examples: just 1 GiByte
of RAM. Of course sufficient swap space is also
required for this kind of context.)

For lld based links, LDFLAGS.lld+= -Wl,--no-threads
can also help avoid memory use by avoiding having
ncpu+2 threads in use in each active lld.

How-to-build-software documentation should probably
cover this subject.