Bug 240342 - clang++ bus error while building LLVM as part of Julia
Summary: clang++ bus error while building LLVM as part of Julia
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.3-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-toolchain mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-05 02:30 UTC by Alex Arslan
Modified: 2019-09-07 10:32 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 Alex Arslan 2019-09-05 02:30:07 UTC
I routinely build Julia (https://julialang.org) from source on FreeBSD using
```
gmake -j4 USECCACHE=1 USE_BINARYBUILDER=0
```
The `USE_BINARYBUILDER=0` option simply tells the build system to download and compile the dependencies from source rather than downloading prebuilt, cross-compiled binaries for the dependencies. Without this option, LLVM is not built from source.

Today, doing `git clean -fdx` and rebuilding with the above command proceeded as usual for a while but then failed with the following while compiling LLVM:

```
Scanning dependencies of target LLVMCoverage
[ 61%] Building CXX object lib/ProfileData/Coverage/CMakeFiles/LLVMCoverage.dir/CoverageMapping.cpp.o
In file included from /usr/home/alex/Projects/julia/deps/srccache/llvm-6.0.1/lib/ProfileData/Coverage/CoverageMapping.cpp:15:
/usr/home/alex/Projects/julia/deps/srccache/llvm-6.0.1/include/llvm/ProfileData/Coverage/CoverageMapping.h:643:25: warning: explicitly defaulted copy assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
  LineCoverageIterator &operator=(const LineCoverageIterator &R) = default;
                        ^
/usr/home/alex/Projects/julia/deps/srccache/llvm-6.0.1/include/llvm/ProfileData/Coverage/CoverageMapping.h:663:23: note: copy assignment operator of 'LineCoverageIterator' is implicitly deleted because field 'CD' is of reference type 'const llvm::coverage::CoverageData &'
  const CoverageData &CD;
                      ^
clang++: error: unable to execute command: Bus error (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on LLVM 8.0.0)
Target: x86_64-unknown-freebsd11.3
Thread model: posix
InstalledDir: /usr/bin
clang++: 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.
clang++: note: diagnostic msg: 
********************

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

********************
[ 61%] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/PtrUseVisitor.cpp.o
gmake[4]: *** [lib/ProfileData/Coverage/CMakeFiles/LLVMCoverage.dir/build.make:63: lib/ProfileData/Coverage/CMakeFiles/LLVMCoverage.dir/CoverageMapping.cpp.o] Error 254
gmake[3]: *** [CMakeFiles/Makefile2:9480: lib/ProfileData/Coverage/CMakeFiles/LLVMCoverage.dir/all] Error 2
```

The requested attachments are at https://gist.github.com/ararslan/ee6b157f8868a45ad865cfa9b3756f35
Comment 1 Dimitry Andric freebsd_committer 2019-09-07 10:32:47 UTC
I tried reproducing this crash on a freshly installed 11.3-RELEASE amd64 machine, but it works just fine for me:

$ uname -a
FreeBSD freebsd113-rel 11.3-RELEASE FreeBSD 11.3-RELEASE #0 r349754: Fri Jul  5 04:45:24 UTC 2019     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

$ /usr/bin/time -l clang -cc1 -triple x86_64-unknown-freebsd11.3 -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CoverageMapping.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /usr/home/alex/Projects/julia/deps/scratch/llvm-6.0.1/build_Release/lib/ProfileData/Coverage/CMakeFiles/LLVMCoverage.dir/CoverageMapping.cpp.gcno -D GTEST_HAS_RTTI=0 -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D NDEBUG -O3 -Werror=date-time -Werror=unguarded-availability-new -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-long-long -Wundef -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -pedantic -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fno-rtti -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -x c++ CoverageMapping-01cfc3.cpp -faddrsig
In file included from /usr/home/alex/Projects/julia/deps/srccache/llvm-6.0.1/lib/ProfileData/Coverage/CoverageMapping.cpp:15:
/usr/home/alex/Projects/julia/deps/srccache/llvm-6.0.1/include/llvm/ProfileData/Coverage/CoverageMapping.h:643:25: warning: explicitly defaulted copy assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
  LineCoverageIterator &operator=(const LineCoverageIterator &R) = default;
                        ^
/usr/home/alex/Projects/julia/deps/srccache/llvm-6.0.1/include/llvm/ProfileData/Coverage/CoverageMapping.h:663:23: note: copy assignment operator of 'LineCoverageIterator' is implicitly deleted because field 'CD' is of reference type 'const llvm::coverage::CoverageData &'
  const CoverageData &CD;
                      ^
1 warning generated.
        2.84 real         1.65 user         1.19 sys
    146396  maximum resident set size
     62216  average shared memory size
       520  average unshared data size
       250  average unshared stack size
     24825  page reclaims
         0  page faults
         0  swaps
         0  block input operations
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
         3  voluntary context switches
        33  involuntary context switches

It does not even use a lot of memory, roughly 143 MiB.  So is there anything special about your build system?  Does it have very little RAM, or run a large amount of parallel jobs?