Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FreeBSD] root.exe crash at end of compilation during modules.idx generation #14075

Closed
1 task done
mkrzewic opened this issue Nov 18, 2023 · 5 comments · Fixed by #14115
Closed
1 task done

[FreeBSD] root.exe crash at end of compilation during modules.idx generation #14075

mkrzewic opened this issue Nov 18, 2023 · 5 comments · Fixed by #14115
Assignees
Labels

Comments

@mkrzewic
Copy link
Contributor

Check duplicate issues.

  • Checked for duplicates

Description

as in the description. the root process crashes somewhere in ctor of Interpreter.
Below the stack trace (plus some printouts of the interpreter args as I have no debug info in cling atm, build takes too many resources):

[mkrzewic@hack ~/build/root]$ lldb bin/root.exe
(lldb) target create "bin/root.exe"
Current executable set to '/home/mkrzewic/build/root/bin/root.exe' (x86_64).
(lldb) run
Process 35096 launched: '/home/mkrzewic/build/root/bin/root.exe' (x86_64)
interpArgs.size(): 20
interpArgs[0]: cling4root
interpArgs[1]: -DNDEBUG
interpArgs[2]: -UDEBUG
interpArgs[3]: -U_DEBUG
interpArgs[4]: -I/usr/home/mkrzewic/build/root/etc/
interpArgs[5]: -I/usr/home/mkrzewic/build/root/etc//cling
interpArgs[6]: -I/usr/home/mkrzewic/build/root/etc//cling/plugins/include
interpArgs[7]: -I/usr/home/mkrzewic/build/root/include/
interpArgs[8]: -Wno-undefined-inline
interpArgs[9]: -fsigned-char
interpArgs[10]: -O1
interpArgs[11]: -mllvm
interpArgs[12]: -optimize-regalloc=0
interpArgs[13]: -fmodule-map-file=/usr/home/mkrzewic/build/root/include//module.modulemap
interpArgs[14]: -fmodules-cache-path=/usr/home/mkrzewic/build/root/lib
interpArgs[15]: -fmodules
interpArgs[16]: -fno-implicit-module-maps
interpArgs[17]: -Rmodule-build
interpArgs[18]: -fno-autolink
interpArgs[19]: --ptrcheck
Process 35096 stopped
* thread #1, name = 'root.exe', stop reason = signal SIGABRT
frame #0: 0x00000008279b9dca libc.so.7`__sys_thr_kill + 10
libc.so.7`__sys_thr_kill:
->  0x8279b9dca <+10>: jb     0x8279b7f28
0x8279b9dd0 <+16>: retq
0x8279b9dd1:       int3
0x8279b9dd2:       int3
(lldb) bt
* thread #1, name = 'root.exe', stop reason = signal SIGABRT
* frame #0: 0x00000008279b9dca libc.so.7`__sys_thr_kill + 10
frame #1: 0x00000008279326f4 libc.so.7`__raise + 52
frame #2: 0x00000008279e3bc9 libc.so.7`abort + 73
frame #3: 0x00000008248c0e39 libcxxrt.so.1`___lldb_unnamed_symbol472 + 73
frame #4: 0x0000000825448abf libc++.so.1`operator new(unsigned long) + 111
frame #5: 0x000000082544f2e3 libc++.so.1`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 195
frame #6: 0x00000008351c7d9c libCling.so`llvm::DataLayout::operator=(llvm::DataLayout const&) + 44
frame #7: 0x00000008351c7cd3 libCling.so`llvm::DataLayout::DataLayout(llvm::DataLayout const&) + 195
frame #8: 0x00000008351cbc62 libCling.so`cling::IncrementalJIT::IncrementalJIT(cling::IncrementalExecutor&, clang::CompilerInstance const&, std::__1::unique_ptr<llvm::orc::ExecutorProcessControl, std::__1::default_delete<llvm::orc::ExecutorProcessControl> >, llvm::Error&, void*, bool) + 1154
frame #9: 0x00000008351c863a libCling.so`cling::IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine&, clang::CompilerInstance const&, void*, bool) +378
frame #10: 0x0000000835161b6b libCling.so`cling::Interpreter::Interpreter(int, char const* const*, char const*, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension> > > const&, void*, bool, cling::Interpreter const*) + 2107
frame #11: 0x000000083506c054 libCling.so`TCling::TCling(char const*, char const*, char const* const*, void*) [inlined] cling::Interpreter::Interpreter(this=0x000000082eccac00, argc=20, argv=0x000000082edb3000, llvmdir=<unavailable>, moduleExtensions=0x0000000820b5e5d0, extraLibHandle=0x000000082ddf0808, noRuntime=false) at Interpreter.h:367:11
frame #12: 0x000000083506c03c libCling.so`TCling::TCling(char const*, char const*, char const* const*, void*) [inlined] std::__1::__unique_if<cling::Interpreter>::__unique_single std::__1::make_unique<cling::Interpreter, unsigned long, char const**, TString&, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension> > >&, void*&>(__args=<unavailable>, __args=<unavailable>, __args=0x0000000820b5e568, __args=0x0000000820b5e5d0, __args=<unavailable>) at unique_ptr.h:725:32
frame #13: 0x000000083506c00f libCling.so`TCling::TCling(this=0x000000082ecc4600, name=<unavailable>, title=<unavailable>, argv=<unavailable>, interpLibHandle=0x000000082ddf0808) at TCling.cxx:1546:19
frame #14: 0x0000000835066ec9 libCling.so`::CreateInterpreter(interpLibHandle=0x000000082ddf0808, argv=0x0000000820b5e8a0) at TCling.cxx:609:22
frame #15: 0x0000000822e85418 libCore.so`TROOT::InitInterpreter(this=0x0000000823028a50) at TROOT.cxx:2087:19
frame #16: 0x0000000822e85333 libCore.so`ROOT::Internal::GetROOT2() at TROOT.cxx:389:22
frame #17: 0x0000000822e3a23a libCore.so`TApplication::TApplication(this=0x000000082ece43c0, appClassName="Rint", argc=0x0000000820b60a9c, argv=0x0000000820b60b18, (null)=<unavailable>, numOptions=0) at TApplication.cxx:153:9
frame #18: 0x0000000821cbcccb libRint.so`TRint::TRint(this=0x000000082ece43c0, appClassName="Rint", argc=0x0000000820b60a9c, argv=0x0000000820b60b18, options=0x0000000000000000, numOptions=0, noLogo=<unavailable>, exitOnUnknownArgs=<unavailable>) at TRint.cxx:173:6
frame #19: 0x00000000002020d1 root.exe`main(argc=1, argv=0x0000000820b60b18) at rmain.cxx:80:24
frame #20: 0x0000000000201d60 root.exe`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7
(lldb)

Reproducer

cmake ../../src/root -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=RelWithDebInfo

ROOT version

recent master (@bce645)

Installation method

source

Operating system

FreeBSD 13.2-RELEASE-p5

Additional context

No response

@mkrzewic mkrzewic added the bug label Nov 18, 2023
@hahnjo
Copy link
Member

hahnjo commented Nov 20, 2023

@mkrzewic can you get some more information what is crashing? It looks like libcxxrt.so or libc++.so are calling abort, it would be good to know what they are complaining about...

@mkrzewic
Copy link
Contributor Author

@hahnjo the problem is this build (default RelWithDebInfo) does not build cling with debug info and it is all optimized out. I did try building the interpreter in debug mode, but on my small machine it took about a full day and stopped with some error (was already quite some time ago). Not sure If I have the resources right now to try again.
I remember I had this modules.idx problem early on when I worked on the "first" batch of freebsd patches - it went away after some doing, not sure why, I was fixing some other issues as well in parallel and at some point it just started working. I did not investigate what exactly made it work. Apparently I should have :D. I suspect then it was some uninitialized string, that was what I was hunting down at the moment I think.

@mkrzewic
Copy link
Contributor Author

mkrzewic commented Nov 25, 2023

@hahnjo so the problem was the llvm build configuration - the TargetMachine for x86 was not built/linked in which in turn caused some stuff to be uninitialized. I had -DDLVM_TARGETS_TO_BUILD="NVPTX" (since "NVPTX;host" does not work as discussed in #13865 I followed the observation of @eamjensen and removed "host" to make it configure. The arch needs to be specified explicitly as (in my case) "X86":
-DDLVM_TARGETS_TO_BUILD="X86;NVPTX" seems to do the trick.

@hahnjo
Copy link
Member

hahnjo commented Nov 27, 2023

@mkrzewic I'm slightly confused because your reproducer doesn't mention setting LVM_TARGETS_TO_BUILD while #13865 (comment) does... That said, I think I see what's going on, there was an oversight where we would not get the updated LVM_TARGETS_TO_BUILD after builtin_llvm replaced special targets such as all and host/Native (after #13420). In addition there is one minor missing update to automatically configure only the LLVM targets that are needed on FreeBSD, which should also dramatically reduce your build time and binary sizes. Can you maybe give #14115 a try?

@mkrzewic
Copy link
Contributor Author

mkrzewic commented Nov 27, 2023

@hahnjo indeed, bad reproducer, sorry. giving #14115 a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants