Random failure when building Swift on Pi


(Timothy Wood) #1

I’m encountering random build compile failures when building on Pi, using clang-3.6 (as suggested in the various instructions to do so), and when using <https://github.com/hpux735/swift-llvm/tree/arm>

One example looks like:

FAILED: /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/home/pi/Source/Swift/llvm/lib/Support -Iinclude -I/home/pi/Source/Swift/llvm/include -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -O3 -UNDEBUG -fno-exceptions -fno-rtti -MMD -MT lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o -c /home/pi/Source/Swift/llvm/lib/Support/YAMLTraits.cpp
Stack dump:
0. Program arguments: /usr/lib/llvm-3.6/bin/clang -cc1 -triple armv6-unknown-linux-gnueabihf -emit-obj -disable-free -disable-llvm-verifier -main-file-name YAMLTraits.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu arm1136jf-s -target-abi aapcs-linux -mfloat-abi hard -target-linker-version 2.25 -dwarf-column-info -ffunction-sections -fdata-sections -coverage-file /home/pi/Source/Swift/build/Ninja-ReleaseAssert/llvm-linux-armv7/lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o -resource-dir /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2 -dependency-file lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o.d -MT lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o -D GTEST_HAS_RTTI=0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -U NDEBUG -I lib/Support -I /home/pi/Source/Swift/llvm/lib/Support -I include -I /home/pi/Source/Swift/llvm/include -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/arm-linux-gnueabihf/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/arm-linux-gnueabihf/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include -internal-externc-isystem /usr/include/arm-linux-gnueabihf -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/pi/Source/Swift/build/Ninja-ReleaseAssert/llvm-linux-armv7 -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -mstackrealign -fno-rtti -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o -x c++ /home/pi/Source/Swift/llvm/lib/Support/YAMLTraits.cpp
1. /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9/ext/type_traits.h:113:6: current parser token ';'
2. /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9/ext/type_traits.h:37:1: parsing namespace '__gnu_cxx'
3. /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9/ext/type_traits.h:106:5: parsing struct/union/class body '__remove_unsigned'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Debian clang version 3.6.2-3 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://bugs.debian.org/ 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/YAMLTraits-d1f411.cpp
clang: note: diagnostic msg: /tmp/YAMLTraits-d1f411.sh
clang: note: diagnostic msg:

But, if I run the emitted script it works fine:

pushd /tmp
bash /tmp/YAMLTraits-d1f411.sh

Or, another example (where clang++ isn’t crashing):

FAILED: /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iutils/TableGen -I/home/pi/Source/Swift/llvm/utils/TableGen -Iinclude -I/home/pi/Source/Swift/llvm/include -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections -O3 -UNDEBUG -fno-exceptions -fno-rtti -MMD -MT utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o -MF utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o.d -o utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o -c /home/pi/Source/Swift/llvm/utils/TableGen/CodeGenInstruction.cpp
Stack dump:
0. Program arguments: /usr/lib/llvm-3.6/bin/clang -cc1 -triple armv6-unknown-linux-gnueabihf -emit-obj -disable-free -disable-llvm-verifier -main-file-name CodeGenInstruction.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu arm1136jf-s -target-abi aapcs-linux -mfloat-abi hard -target-linker-version 2.25 -dwarf-column-info -ffunction-sections -fdata-sections -coverage-file /home/pi/Source/Swift/build/Ninja-ReleaseAssert/llvm-linux-armv7/utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o -resource-dir /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2 -dependency-file utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o.d -MT utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o -D GTEST_HAS_RTTI=0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -U NDEBUG -I utils/TableGen -I /home/pi/Source/Swift/llvm/utils/TableGen -I include -I /home/pi/Source/Swift/llvm/include -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/arm-linux-gnueabihf/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/arm-linux-gnueabihf/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/arm-linux-gnueabihf/4.9/../../../../include/c++/4.9/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include -internal-externc-isystem /usr/include/arm-linux-gnueabihf -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/pi/Source/Swift/build/Ninja-ReleaseAssert/llvm-linux-armv7 -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -mstackrealign -fno-rtti -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o -x c++ /home/pi/Source/Swift/llvm/utils/TableGen/CodeGenInstruction.cpp
1. /home/pi/Source/Swift/llvm/include/llvm/ADT/SmallVector.h:718:44: current parser token ')'
2. /home/pi/Source/Swift/llvm/include/llvm/ADT/SmallVector.h:31:1: parsing namespace 'llvm'
3. /home/pi/Source/Swift/llvm/include/llvm/ADT/SmallVector.h:700:56: parsing function body 'swap'
4. /home/pi/Source/Swift/llvm/include/llvm/ADT/SmallVector.h:700:56: in compound statement ('{}')
error: unable to rename temporary 'utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o-9c605f46' to output file 'utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/CodeGenInstruction.cpp.o': 'No such file or directory'
1 error generated.

Each time I invoke the build script I get a few files further:

utils/build-script -t -R -j 4 -- --use-gold-linker

In my previous attempts to build Swift on Pi, I’d not seen this, so I’m confused why it’s started now. My only working theories so far are that when I did an `apt-get update`/`apt-get upgrade` to check for a new Swift build, I applied a whole bunch of other updates to the system or second, maybe my microSD card is going bad =/

-tim