truffleruby icon indicating copy to clipboard operation
truffleruby copied to clipboard

Cannot install sqlite3 gem on MacOS

Open gogainda opened this issue 3 years ago • 2 comments

How to reproduce

gem install sqlite3

Output

https://gist.github.com/gogainda/62387374b09d4c9dae16b86f9c3a7531

gogainda avatar Sep 11 '22 14:09 gogainda

The CI pipeline exercises this code now, see: https://github.com/sparklemotion/sqlite3-ruby/pull/347

I'm able to reproduce what you're seeing when I use the packaged sqlite library: https://github.com/sparklemotion/sqlite3-ruby/runs/8293766707?check_suite_focus=true

A workaround you may wish to consider is to use system libraries, so something like:

gem install sqlite3 -- --enable-system-libraries --with-opt-dir=$(brew --prefix sqlite3)

I would be interested in working with the TR team to understand the root cause.

flavorjones avatar Sep 11 '22 16:09 flavorjones

I'm sorry no one has looked at this yet. Much of the team is either on holiday or at a conference this week. It may be another week yet before someone is able to investigate.

nirvdrum avatar Sep 15 '22 11:09 nirvdrum

This seems a segfault of ~clang-14~ dsymutil: (copying from the end of the gist)

...
warning: Unsupported attribute form DW_FORM_loclistx in cloneAttribute. Dropping.
note: while processing /var/folders/x7/dn5x_jdx13q969_jl0bjm_zxmxpmqn/T/cc-259a82.o
warning: Unsupported attribute form DW_FORM_loclistx in cloneAttribute. Dropping.
note: while processing /var/folders/x7/dn5x_jdx13q969_jl0bjm_zxmxpmqn/T/cc-259a82.o
warning: Unsupported attribute form DW_FORM_loclistx in cloneAttribute. Dropping.
note: while processing /var/folders/x7/dn5x_jdx13q969_jl0bjm_zxmxpmqn/T/cc-259a82.o
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM.dylib            0x000000011210a51b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  libLLVM.dylib            0x0000000112109258 llvm::sys::RunSignalHandlers() + 248
2  libLLVM.dylib            0x000000011210ab97 SignalHandler(int) + 295
3  libsystem_platform.dylib 0x00007ff8091c3dfd _sigtramp + 29
4  libLLVM.dylib            0x00000001120eabd7 llvm::raw_fd_ostream::write_impl(char const*, unsigned long) + 71
5  libLLVM.dylib            0x0000000112c358c6 llvm::DWARFLinker::DIECloner::cloneBlockAttribute(llvm::DIE&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::DWARFAbbreviationDeclaration::AttributeSpec, llvm::DWARFFormValue const&, unsigned int, bool) + 1190
6  libLLVM.dylib            0x0000000112c36051 llvm::DWARFLinker::DIECloner::cloneAttribute(llvm::DIE&, llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, llvm::DWARFFormValue const&, llvm::DWARFAbbreviationDeclaration::AttributeSpec, unsigned int, llvm::DWARFLinker::DIECloner::AttributesInfo&, bool) + 161
7  libLLVM.dylib            0x0000000112c36bda llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 1834
8  libLLVM.dylib            0x0000000112c37386 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3798
9  libLLVM.dylib            0x0000000112c37386 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3798
10 libLLVM.dylib            0x0000000112c37386 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3798
11 libLLVM.dylib            0x0000000112c37386 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3798
12 libLLVM.dylib            0x0000000112c3d202 llvm::DWARFLinker::DIECloner::cloneAllCompileUnits(llvm::DWARFContext&, llvm::DWARFFile const&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool) + 498
13 libLLVM.dylib            0x0000000112c40271 llvm::DWARFLinker::link()::$_5::operator()(unsigned long) const + 689
14 libLLVM.dylib            0x0000000112c42634 std::__1::__function::__func<llvm::DWARFLinker::link()::$_8, std::__1::allocator<llvm::DWARFLinker::link()::$_8>, void ()>::operator()() + 68
15 libLLVM.dylib            0x00000001125f9418 std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() + 24
16 libLLVM.dylib            0x00000001120a6ce3 void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(void*) + 643
17 libsystem_pthread.dylib  0x00007ff8091ae4e1 _pthread_start + 125
18 libsystem_pthread.dylib  0x00007ff8091a9f6b thread_start + 15
clang-14: error: unable to execute command: Segmentation fault: 11
clang-14: error: dsymutil command failed due to signal (use -v to see invocation)
Process failed: #<Process::Status: pid 3236 exit 254>

eregon avatar Sep 30 '22 12:09 eregon

Correction, it's a segfault of dsymutil provided by XCode. That's also explains why it's only on macOS. Maybe updating XCode/CLI tools helps.

eregon avatar Sep 30 '22 12:09 eregon

FWIW similar-looking issue which was fixed in 22.2: https://github.com/oracle/truffleruby/issues/2710#issuecomment-1225731390 But this is different since it's on a build more recent than 22.2.

eregon avatar Sep 30 '22 12:09 eregon

Maybe updating XCode/CLI tools helps.

@lewurm tried and it still repros with latest (Xcode14rc1), so need to try that.

eregon avatar Sep 30 '22 13:09 eregon

Thanks for the bug report.

Unfortunately reverting the behaviour of #2710 (i.e. using the system dsymutil) doesn't help either for this issue.

With a debug build of dsymutil I get the following stack trace:

Assertion failed: (Die >= First && Die < First + DieArray.size()), function getDIEIndex, file DWARFUnit.h, line 248.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM.dylib            0x000000011c855260 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 72
1  libLLVM.dylib            0x000000011c85577c PrintStackTraceSignalHandler(void*) + 28
2  libLLVM.dylib            0x000000011c853890 llvm::sys::RunSignalHandlers() + 144
3  libLLVM.dylib            0x000000011c8571f4 SignalHandler(int) + 252
4  libsystem_platform.dylib 0x000000018270f4a4 _sigtramp + 56
5  libsystem_pthread.dylib  0x00000001826f7ee0 pthread_kill + 288
6  libsystem_c.dylib        0x0000000182632340 abort + 168
7  libsystem_c.dylib        0x0000000182631754 err + 0
8  libLLVM.dylib            0x000000011e320d60 llvm::DWARFUnit::getDIEIndex(llvm::DWARFDebugInfoEntry const*) + 176
9  libLLVM.dylib            0x000000011e31f4d0 llvm::DWARFUnit::getDIEIndex(llvm::DWARFDie const&) + 48
10 libLLVM.dylib            0x000000011e3277dc llvm::CompileUnit::getInfo(llvm::DWARFDie const&) + 40
11 libLLVM.dylib            0x000000011e32a0f0 llvm::DWARFLinker::DIECloner::cloneExpression(llvm::DataExtractor&, llvm::DWARFExpression, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::SmallVectorImpl<unsigned char>&) + 696
12 libLLVM.dylib            0x000000011e32a6d4 llvm::DWARFLinker::DIECloner::cloneBlockAttribute(llvm::DIE&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::DWARFAbbreviationDeclaration::AttributeSpec, llvm::DWARFFormValue const&, unsigned int, bool) + 744
13 libLLVM.dylib            0x000000011e32b690 llvm::DWARFLinker::DIECloner::cloneAttribute(llvm::DIE&, llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, llvm::DWARFFormValue const&, llvm::DWARFAbbreviationDeclaration::AttributeSpec, unsigned int, llvm::DWARFLinker::DIECloner::AttributesInfo&, bool) + 356
14 libLLVM.dylib            0x000000011e32c508 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 2056
15 libLLVM.dylib            0x000000011e32cb20 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3616
16 libLLVM.dylib            0x000000011e32cb20 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3616
17 libLLVM.dylib            0x000000011e32cb20 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3616
18 libLLVM.dylib            0x000000011e32cb20 llvm::DWARFLinker::DIECloner::cloneDIE(llvm::DWARFDie const&, llvm::DWARFFile const&, llvm::CompileUnit&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, long long, unsigned int, unsigned int, bool, llvm::DIE*) + 3616
19 libLLVM.dylib            0x000000011e332a18 llvm::DWARFLinker::DIECloner::cloneAllCompileUnits(llvm::DWARFContext&, llvm::DWARFFile const&, llvm::StrongType<llvm::NonRelocatableStringpool, llvm::OffsetsTag>&, bool) + 568
20 libLLVM.dylib            0x000000011e335264 llvm::DWARFLinker::link()::$_5::operator()(unsigned long) const + 728
21 libLLVM.dylib            0x000000011e366214 llvm::DWARFLinker::link()::$_8::operator()() const + 196
22 libLLVM.dylib            0x000000011e366144 decltype(static_cast<llvm::DWARFLinker::link()::$_8&>(fp)()) std::__1::__invoke<llvm::DWARFLinker::link()::$_8&>(llvm::DWARFLinker::link()::$_8&) + 24
23 libLLVM.dylib            0x000000011e3660fc void std::__1::__invoke_void_return_wrapper<void, true>::__call<llvm::DWARFLinker::link()::$_8&>(llvm::DWARFLinker::link()::$_8&) + 28
24 libLLVM.dylib            0x000000011e3660d4 std::__1::__function::__alloc_func<llvm::DWARFLinker::link()::$_8, std::__1::allocator<llvm::DWARFLinker::link()::$_8>, void ()>::operator()() + 28
25 libLLVM.dylib            0x000000011e364f70 std::__1::__function::__func<llvm::DWARFLinker::link()::$_8, std::__1::allocator<llvm::DWARFLinker::link()::$_8>, void ()>::operator()() + 28
26 dsymutil                 0x00000001040ae628 std::__1::__function::__value_func<void ()>::operator()() const + 60
27 dsymutil                 0x00000001040ae5e0 std::__1::function<void ()>::operator()() const + 24
28 libLLVM.dylib            0x000000011d539e54 llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()::operator()() const + 32
29 libLLVM.dylib            0x000000011d539e14 decltype(static_cast<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&>(fp)()) std::__1::__invoke<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&>(llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&) + 24
30 libLLVM.dylib            0x000000011d539dcc void std::__1::__invoke_void_return_wrapper<void, true>::__call<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&>(llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&) + 28
31 libLLVM.dylib            0x000000011d539da4 std::__1::__function::__alloc_func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() + 28
32 libLLVM.dylib            0x000000011d538974 std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() + 28
33 dsymutil                 0x00000001040ae628 std::__1::__function::__value_func<void ()>::operator()() const + 60
34 dsymutil                 0x00000001040ae5e0 std::__1::function<void ()>::operator()() const + 24
35 libLLVM.dylib            0x000000011c789c58 llvm::ThreadPool::grow(int)::$_0::operator()() const + 248
36 libLLVM.dylib            0x000000011c789b1c void llvm::thread::Apply<llvm::ThreadPool::grow(int)::$_0>(std::__1::tuple<llvm::ThreadPool::grow(int)::$_0>&, std::__1::integer_sequence<unsigned long>) + 32
37 libLLVM.dylib            0x000000011c789ae8 void llvm::thread::GenericThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(void*) + 56
38 libLLVM.dylib            0x000000011c7897e0 void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(void*) + 24
39 libsystem_pthread.dylib  0x00000001826f826c _pthread_start + 148
40 libsystem_pthread.dylib  0x00000001826f308c thread_start + 8
clang-14: error: unable to execute command: Abort trap: 6
clang-14: error: dsymutil command failed due to signal (use -v to see invocation)

Note that Die is NULL.

lewurm avatar Oct 03 '22 09:10 lewurm

It works with LLVM 15 (we ship 14 currently), so I bisected it down to this LLVM commit: https://github.com/llvm/llvm-project/commit/a17c90daf2e7c3b1817ec29ad6648ce89b927f9a

Until then we can downgrade the targeted DWARF version I think: https://github.com/oracle/graal/pull/5135

lewurm avatar Oct 03 '22 16:10 lewurm

FWIW there is another issue when installing the gem on Linux, that's an upstream issue: https://github.com/sparklemotion/sqlite3-ruby/issues/354

eregon avatar Oct 04 '22 12:10 eregon

This is fixed now, in https://github.com/oracle/graal/commit/0e6baa5566db37c7741474ea1a65f7c737e34d8b.

eregon avatar Oct 10 '22 10:10 eregon

@eregon The CI job is still failing with truffleruby 23.0.0-dev-33ae0fe4. Is that expected? What version will pass CI?

flavorjones avatar Oct 11 '22 00:10 flavorjones

@flavorjones Right, that's expected because that version doesn't have https://github.com/oracle/graal/commit/0e6baa5566db37c7741474ea1a65f7c737e34d8b. The latest build has it, truffleruby commit: https://github.com/oracle/truffleruby/commit/72aa843b5f34f2607c9a0392b11185f52e4ad2bb, which includes the graal update.

Could you rerun the CI job? (https://github.com/sparklemotion/sqlite3-ruby/pull/347)

eregon avatar Oct 11 '22 13:10 eregon