Closed Bug 1484723 Opened 3 years ago Closed 3 years ago

clang++ segfault compiling for Android opt

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jya, Unassigned)

References

()

Details

Attachments

(3 files)

.mozconfig:
# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig

# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-ff-android

mk_add_options AUTOCLOBBER=1

# Enable debug builds
#ac_add_options --enable-debug
#ac_add_options --enable-debug-symbols

# Turn off compiler optimization. This will make applications run slower,
# will allow you to debug the applications under a debugger, like GDB.
#ac_add_options --disable-optimize

# Build Firefox for Android:
ac_add_options --enable-application=mobile/android
ac_add_options --target=arm-linux-androideabi

# With the following java and javac:
ac_add_options --with-java-bin-path="/Library/Java/Home/bin"

# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="/Users/jyavenard/.mozbuild/android-sdk-macosx"
ac_add_options --with-android-ndk="/Users/jyavenard/.mozbuild/android-ndk-r17b"



I get:

 0:10.65 js/src
 0:21.15 0  clang++                  0x000000011051e9c8 llvm::SmallVectorImpl<char>::swap(llvm::SmallVectorImpl<char>&) + 46568
 0:21.15 1  clang++                  0x000000011051efd6 llvm::SmallVectorImpl<char>::swap(llvm::SmallVectorImpl<char>&) + 48118
 0:21.15 2  libsystem_platform.dylib 0x00007fff5d6f2f5a _sigtramp + 26
 0:21.16 3  clang++                  0x0000000110d95eea unsigned long std::__1::__tree<std::__1::__value_type<llvm::EVT, llvm::SDNode*>, std::__1::__map_value_compare<llvm::EVT, std::__1::__value_type<llvm::EVT, llvm::SDNode*>, llvm::EVT::compareRawBits, true>, std::__1::allocator<std::__1::__value_type<llvm::EVT, llvm::SDNode*> > >::__erase_unique<llvm::EVT>(llvm::EVT const&) + 506
 0:21.16 4  clang++                  0x000000010ff91200 llvm::SmallVectorImpl<llvm::WinEHHandlerType>::operator=(llvm::SmallVectorImpl<llvm::WinEHHandlerType>&&) + 76976
 0:21.16 5  clang++                  0x000000010fdffcff void std::__1::vector<llvm::MachineConstantPoolEntry, std::__1::allocator<llvm::MachineConstantPoolEntry> >::__push_back_slow_path<llvm::MachineConstantPoolEntry>(llvm::MachineConstantPoolEntry&&) + 25791
 0:21.16 6  clang++                  0x000000010fdffb84 void std::__1::vector<llvm::MachineConstantPoolEntry, std::__1::allocator<llvm::MachineConstantPoolEntry> >::__push_back_slow_path<llvm::MachineConstantPoolEntry>(llvm::MachineConstantPoolEntry&&) + 25412
 0:21.16 7  clang++                  0x0000000110d9e404 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 22372
 0:21.16 8  clang++                  0x0000000110d9f1a0 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 25856
 0:21.16 9  clang++                  0x0000000110d9f30e std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 26222
 0:21.16 10 clang++                  0x0000000110d9f231 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 26001
 0:21.16 11 clang++                  0x0000000110dad608 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 84328
 0:21.16 12 clang++                  0x0000000110dac9b7 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 81175
 0:21.16 13 clang++                  0x000000010f748dcd std::__1::function<void (llvm::MachineInstrBuilder&)>::swap(std::__1::function<void (llvm::MachineInstrBuilder&)>&) + 34957
 0:21.16 14 clang++                  0x0000000110da566c std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 51660
 0:21.16 15 clang++                  0x0000000110da4d01 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 49249
 0:21.16 16 clang++                  0x0000000110da3a19 std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 44409
 0:21.16 17 clang++                  0x0000000110da089d std::__1::__tree<llvm::EVT, llvm::EVT::compareRawBits, std::__1::allocator<llvm::EVT> >::destroy(std::__1::__tree_node<llvm::EVT, void*>*) + 31741
 0:21.16 18 clang++                  0x000000010f740a94 std::__1::function<void (llvm::MachineInstrBuilder&)>::swap(std::__1::function<void (llvm::MachineInstrBuilder&)>&) + 1364
 0:21.16 19 clang++                  0x000000010fdf9b9a void std::__1::vector<llvm::MachineConstantPoolEntry, std::__1::allocator<llvm::MachineConstantPoolEntry> >::__push_back_slow_path<llvm::MachineConstantPoolEntry>(llvm::MachineConstantPoolEntry&&) + 858
 0:21.16 20 clang++                  0x000000011006244e std::__1::enable_if<is_hashable_data<llvm::Metadata* const>::value, llvm::hash_code>::type llvm::hashing::detail::hash_combine_range_impl<llvm::Metadata* const>(llvm::Metadata* const*, llvm::Metadata* const*) + 30462
 0:21.16 21 clang++                  0x00000001100626d3 std::__1::enable_if<is_hashable_data<llvm::Metadata* const>::value, llvm::hash_code>::type llvm::hashing::detail::hash_combine_range_impl<llvm::Metadata* const>(llvm::Metadata* const*, llvm::Metadata* const*) + 31107
 0:21.16 22 clang++                  0x0000000110062b8a std::__1::enable_if<is_hashable_data<llvm::Metadata* const>::value, llvm::hash_code>::type llvm::hashing::detail::hash_combine_range_impl<llvm::Metadata* const>(llvm::Metadata* const*, llvm::Metadata* const*) + 32314
 0:21.16 23 clang++                  0x00000001106cf38b void std::__1::vector<clang::vfs::directory_iterator, std::__1::allocator<clang::vfs::directory_iterator> >::__push_back_slow_path<clang::vfs::directory_iterator const&>(clang::vfs::directory_iterator const&&&) + 22043
 0:21.16 24 clang++                  0x000000011088b5d1 void std::__1::vector<std::__1::pair<clang::CXXRecordDecl const*, unsigned int>, std::__1::allocator<std::__1::pair<clang::CXXRecordDecl const*, unsigned int> > >::__push_back_slow_path<std::__1::pair<clang::CXXRecordDecl const*, unsigned int> >(std::__1::pair<clang::CXXRecordDecl const*, unsigned int>&&) + 25057
 0:21.16 25 clang++                  0x000000011118e102 llvm::ErrorOr<unsigned long long> llvm::sampleprof::SampleProfileReaderBinary::readNumber<unsigned long long>() + 14834
 0:21.16 26 clang++                  0x0000000110afe330 llvm::Registry<clang::PluginASTAction>::begin() + 17856
 0:21.16 27 clang++                  0x0000000110a9de78 void std::__1::vector<std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance> >, std::__1::allocator<std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance> > > >::__push_back_slow_path<std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance> > >(std::__1::unique_ptr<clang::CompilerInstance, std::__1::default_delete<clang::CompilerInstance> >&&) + 29720
 0:21.16 28 clang++                  0x0000000110b47510 void std::__1::vector<std::__1::unique_ptr<clang::VerifyDiagnosticConsumer::Directive, std::__1::default_delete<clang::VerifyDiagnosticConsumer::Directive> >, std::__1::allocator<std::__1::unique_ptr<clang::VerifyDiagnosticConsumer::Directive, std::__1::default_delete<clang::VerifyDiagnosticConsumer::Directive> > > >::__push_back_slow_path<std::__1::unique_ptr<clang::VerifyDiagnosticConsumer::Directive, std::__1::default_delete<clang::VerifyDiagnosticConsumer::Directive> > >(std::__1::unique_ptr<clang::VerifyDiagnosticConsumer::Directive, std::__1::default_delete<clang::VerifyDiagnosticConsumer::Directive> >&&) + 9376
 0:21.16 29 clang++                  0x000000010f598eff std::__1::__tree<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::destroy(std::__1::__tree_node<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void*>*) + 1759
 0:21.16 30 clang++                  0x000000010f596f8e
 0:21.16 31 libdyld.dylib            0x00007fff5d3e4015 start + 1
 0:21.17 Stack dump:
 0:21.17 0.	Program arguments: /Users/jyavenard/.mozbuild/android-ndk-r17b/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -cc1 -triple thumbv7--linux-android -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name Unified_cpp_js_src17.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu generic -target-feature +soft-float-abi -target-feature -fp-only-sp -target-feature -d16 -target-feature +vfp3 -target-feature -fp16 -target-feature -vfp4 -target-feature -fp-armv8 -target-feature +neon -target-feature -crypto -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi soft -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -target-linker-version 241.9 -coverage-notes-file /Users/jyavenard/Work/Mozilla/obj-ff-android/js/src/Unified_cpp_js_src17.gcno -resource-dir /Users/jyavenard/.mozbuild/android-ndk-r17b/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/6.0.2 -dependency-file .deps/Unified_cpp_js_src17.o.pp -MT Unified_cpp_js_src17.o -sys-header-deps -MP -include /Users/jyavenard/Work/Mozilla/mozilla-central/config/gcc_hidden.h -include /Users/jyavenard/Work/Mozilla/obj-ff-android/js/src/js-confdefs.h -isystem /Users/jyavenard/.mozbuild/android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem /Users/jyavenard/.mozbuild/android-ndk-r17b/sysroot/usr/include -I /Users/jyavenard/Work/Mozilla/obj-ff-android/dist/system_wrappers -D NDEBUG=1 -D TRIMMED=1 -D ENABLE_BINARYDATA -D ENABLE_WASM_BULKMEM_OPS -D ENABLE_WASM_SATURATING_TRUNC_OPS -D ENABLE_WASM_THREAD_OPS -D ENABLE_WASM_GC -D JS_CACHEIR_SPEW -D ENABLE_SHARED_ARRAY_BUFFER -D EXPORT_JS_API -D JS_HAS_CTYPES -D DLL_PREFIX="lib" -D DLL_SUFFIX=".so" -D MOZ_LINKER -D FFI_BUILDING -D MOZ_HAS_MOZGLUE -I /Users/jyavenard/Work/Mozilla/mozilla-central/js/src -I /Users/jyavenard/Work/Mozilla/obj-ff-android/js/src -I /Users/jyavenard/Work/Mozilla/obj-ff-android/js/src/ctypes/libffi/include -I /Users/jyavenard/Work/Mozilla/mozilla-central/js/src/ctypes/libffi/src/arm -I /Users/jyavenard/Work/Mozilla/obj-ff-android/dist/include -I /Users/jyavenard/Work/Mozilla/obj-ff-android/dist/include/nspr -D MOZILLA_CLIENT -D __ANDROID_API__=16 -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -I /Users/jyavenard/.mozbuild/android-ndk-r17b/sources/cxx-stl/llvm-libc++/include -I /Users/jyavenard/.mozbuild/android-ndk-r17b/sources/android/support/include -I /Users/jyavenard/.mozbuild/android-ndk-r17b/sources/cxx-stl/llvm-libc++abi/include -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -internal-isystem /usr/local/include -internal-isystem /Users/jyavenard/.mozbuild/android-ndk-r17b/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/6.0.2/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-noexcept-type -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-shadow -Werror=format -std=gnu++14 -fdeprecated-macro -fdebug-compilation-dir /Users/jyavenard/Work/Mozilla/obj-ff-android/js/src -ferror-limit 19 -fmessage-length 0 -femulated-tls -fno-rtti -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o Unified_cpp_js_src17.o -x c++ /Users/jyavenard/Work/Mozilla/obj-ff-android/js/src/Unified_cpp_js_src17.cpp
 0:21.17 1.	<eof> parser at end of file
 0:21.17 2.	Code generation
 0:21.17 3.	Running pass 'Function Pass Manager' on module '/Users/jyavenard/Work/Mozilla/obj-ff-android/js/src/Unified_cpp_js_src17.cpp'.
 0:21.17 4.	Running pass 'ARM Instruction Selection' on function '@_ZN2js3jit22CacheRegisterAllocator20saveIonLiveRegistersERNS0_14MacroAssemblerENS0_7LiveSetINS0_11RegisterSetEEENS0_8RegisterEPNS0_9IonScriptE'
 0:21.17 clang++: error: unable to execute command: Segmentation fault: 11
 0:21.17 clang++: error: clang frontend command failed due to signal (use -v to see invocation)
 0:21.17 Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)
 0:21.17 Target: arm--linux-android
 0:21.17 Thread model: posix
 0:21.17 InstalledDir: /Users/jyavenard/.mozbuild/android-ndk-r17b/toolchains/llvm/prebuilt/darwin-x86_64/bin
 0:21.17 clang++: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
 0:21.30 clang++: note: diagnostic msg:
 0:21.30 ********************
 0:21.30 PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
 0:21.30 Preprocessed source(s) and associated run script(s) are located at:
 0:21.30 clang++: note: diagnostic msg: /var/folders/m1/b7gm4k0x7nqdf2jq41m39npm0000gp/T/Unified_cpp_js_src17-33fb04.cpp
 0:21.30 clang++: note: diagnostic msg: /var/folders/m1/b7gm4k0x7nqdf2jq41m39npm0000gp/T/Unified_cpp_js_src17-33fb04.sh
 0:21.30 clang++: note: diagnostic msg: /var/folders/m1/b7gm4k0x7nqdf2jq41m39npm0000gp/T/Unified_cpp_js_src17-33fb04.crash
 0:21.30 clang++: note: diagnostic msg:
 0:21.30 ********************
 0:21.31 make[4]: *** [Unified_cpp_js_src17.o] Error 254
 0:21.31 make[3]: *** [js/src/target] Error 2
 0:21.31 make[2]: *** [compile] Error 2
 0:21.31 make[1]: *** [default] Error 2
 0:21.31 make: *** [build] Error 2
 0:21.34 297 compiler warnings present.
this is on mac
Does it segfault if you don't use the browser/config/mozconfig bit?  Including such mozconfig bits locally is not supported.

It also looks like this is using the NDK clang, so Google would probably be interested in a bug report with command lines and preprocessed output:

https://github.com/android-ndk/ndk/issues
(In reply to Nathan Froyd [:froydnj] from comment #5)
> Does it segfault if you don't use the browser/config/mozconfig bit? 
> Including such mozconfig bits locally is not supported.
> 
it made no difference, crashed in the same spot.


> It also looks like this is using the NDK clang, so Google would probably be
> interested in a bug report with command lines and preprocessed output:

I've attached those to this bug.
This only occurs if ac_add_options --disable-optimize is disabled (so an opt build)
Might this be the same error that snorp encountered in bug 1465468 comment 1? In which case

(In reply to Makoto Kato [:m_kato] from bug 1465468 comment #2)
> Android NDK team says that this will be fixed in r18.
> https://github.com/android-ndk/ndk/issues/732
:janH Can this bug be closed?  It looks like from comment 9 the issue has been resolved.
Flags: needinfo?(jh+bugzilla)
I linked the wrong bug above, it's working in NDK r18-beta1 with bug 1484823 fixed.
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(jh+bugzilla)
Resolution: --- → DUPLICATE
Duplicate of bug: 1484823
Problem still exist even when I have updated to the version with the change of bug1484823.
Status: RESOLVED → REOPENED
Flags: needinfo?(jh+bugzilla)
Resolution: DUPLICATE → ---
You must use the r18-beta1 ndk in combination with bug 1484823.

Alternatively, if on mac, you can use the clang/clang++ from brew by setting the CC and CXX in your .mozconfig
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Flags: needinfo?(jh+bugzilla)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.