ROOT Version: 6.16/00
Platform: linuxx8664gcc
Compiler: GCC 7.2.0
Python: 3.6.5
Google Protobuf:_ 3.6.1
so i am able to use rootcling to create LinkDef and create the share lib with a bunch of google protobuf generated headers. and i can use the protobuf generated shared lib in root prompt w/o issue (while not really, i have to manually add some template class specification into the so file, but that’s another story, if anybody is interested i can share the solution.) , for example:
root [0] .L has_bits-ni.so // this is to load my template specifications.
root [1] .L Loader-_sw_gsd_PBTypes_linux64_13.1.0_include_ctc_core_common_LinkDef.C // load protobufs
root [3] ctc::core::common::Name n // create one of the protobuf msg type
(ctc::core::common::Name &) @0x7f7b01609050
root [4] n.set_name(
void set_name(const char* value)
void set_name(const char* value, size_t size)
void set_name(const string& value)
void set_name(string&& value)
root [4] n.set_name("aName") // test setter
root [5] n.name() // test getter
(const std::string &) "aName"
root [6] ctc::core::common::NameVector nv // create a protobuf msg with repeated field.
(ctc::core::common::NameVector &) @0x7f7b01609070
root [7] nv.mutable_
mutable_unknown_fields
mutable_vector
root [7] nv.mutable_vector
mutable_vector
root [7] nv.mutable_vector(
ctc::core::common::Name* mutable_vector(int index)
google::protobuf::RepeatedPtrField<ctc::core::common::Name>* mutable_vector()
root [7] nv.add_vector(
ctc::core::common::Name* add_vector()
root [7] auto np = nv.add_vector()
(ctc::core::common::Name *) @0x7fff8e867c50
root [8] np->set_name("name 1")
root [9] np = nv.add_vector()
(ctc::core::common::Name *) @0x7fff8e867c40
root [10] np->set_name("name 2")
root [11] nv.vector_size()
(int) 2
root [14] nv.vector
vector
vector_size
root [14] nv.vector(0)
(const ctc::core::common::Name &) @0x550e760
root [15] nv.vector(0).name()
(const std::string &) "name 1"
root [16] nv.vector(1).name()
(const std::string &) "name 2"
however if i run the thing in python, it failed miserably, RIP = ROOT.gInterpreter.ProcessLine:
>>> RIP('.L has_bits-ni.so')
0
>>> RIP('.L Loader-_sw_gsd_PBTypes_linux64_13.1.0_include_ctc_core_common_LinkDef.C')
140222245543984
>>>
>>> RIP('ctc::core::common::Bool ab; ab.set_value(true); ab')
(ctc::core::common::Bool &) @0x7f880922a040
140222245544000
>>> ROOT.ab.value()
True
# so far so good.
>>> ROOT.gInterpreter.ProcessLine('ctc::core::common::Name n1;')
140222245544032
>>> ROOT.n1
<ROOT.ctc::core::common::Name object at 0x7f880922a060>
>>> ROOT.n1.has_name()
False
>>> ROOT.gInterpreter.ProcessLine('n1.set_name("test me"); n1')
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
Thread 2 (Thread 0x7f87f05f4700 (LWP 10997)):
#0 0x00007f8808943a0e in pthread_cond_timedwait
GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00007f8808e79c83 in PyEval_RestoreThread ()
#2 0x00007f8808f66a5c in time_sleep ()
#3 0x00007f8808e85b55 in _PyCFunction_FastCallDict ()
#4 0x00007f8808f1567c in call_function ()
#5 0x00007f8808f37cba in _PyEval_EvalFrameDefault ()
#6 0x00007f8808f10459 in PyEval_EvalCodeEx ()
#7 0x00007f8808f11376 in function_call ()
#8 0x00007f8808e8599e in PyObject_Call ()
#9 0x00007f8808f39470 in _PyEval_EvalFrameDefault ()
#10 0x00007f8808f0f70b in fast_function ()
#11 0x00007f8808f15755 in call_function ()
#12 0x00007f8808f37cba in _PyEval_EvalFrameDefault ()
#13 0x00007f8808f0f70b in fast_function ()
#14 0x00007f8808f15755 in call_function ()
#15 0x00007f8808f37cba in _PyEval_EvalFrameDefault ()
#16 0x00007f8808f0fd7b in _PyFunction_FastCallDict ()
#17 0x00007f8808e85f5f in _PyObject_FastCallDict ()
#18 0x00007f8808e8aa03 in _PyObject_Call_Prepend ()
#19 0x00007f8808e8599e in PyObject_Call ()
#20 0x00007f8808f85b56 in t_bootstrap ()
#21 0x00007f880893fa51 in start_thread () from /lib64/libpthread.so.0
#22 0x00007f880868c9ad in clone () from /lib64/libc.so.6
Thread 1 (Thread 0x7f8809221700 (LWP 10977)):
#0 0x00007f880865070d in waitpid () from /lib64/libc.so.6
#1 0x00007f88085e2609 in do_system () from /lib64/libc.so.6
#2 0x00007f88085e2940 in system () from /lib64/libc.so.6
#3 0x00007f87ff3a9403 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x7f88094c8f30) at /home/dongh/shome/hackweek/ROOT/root/core/unix/src/TUnixSystem.cxx:2119
#4 TUnixSystem::StackTrace (this=0x7f88094c8f30) at /home/dongh/shome/hackweek/ROOT/root/core/unix/src/TUnixSystem.cxx:2413
#5 0x00007f87ff3ab9b7 in TUnixSystem::DispatchSignals (this=0x7f88094c8f30, sig=kSigSegmentationViolation) at /home/dongh/shome/hackweek/ROOT/root/core/unix/src/TUnixSystem.cxx:3644
#6 <signal handler called>
#7 0x00007f87fbe13be0 in clang::Decl::castFromDeclContext(clang::DeclContext const*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#8 0x00007f87fa41f122 in (anonymous namespace)::ItaniumCXXABI::NeedsVTTParameter(clang::GlobalDecl) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#9 0x00007f87fa49cfa8 in clang::CodeGen::CodeGenFunction::GetVTTParameter(clang::GlobalDecl, bool, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#10 0x00007f87fa427638 in (anonymous namespace)::ItaniumCXXABI::EmitDestructorCall(clang::CodeGen::CodeGenFunction&, clang::CXXDestructorDecl const*, clang::CXXDtorType, bool, bool, clang::CodeGen::Address) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#11 0x00007f87fa495177 in clang::CodeGen::CodeGenFunction::destroyCXXObject(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#12 0x00007f87fa4b4750 in clang::CodeGen::CodeGenFunction::emitDestroy(clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#13 0x00007f87fa4b4add in clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#14 0x00007f87fa4a2b6a in EmitCleanup(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup*, clang::CodeGen::EHScopeStack::Cleanup::Flags, clang::CodeGen::Address) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#15 0x00007f87fa4a6d42 in clang::CodeGen::CodeGenFunction::PopCleanupBlock(bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#16 0x00007f87fa4a7291 in clang::CodeGen::CodeGenFunction::PopCleanupBlocks(clang::CodeGen::EHScopeStack::stable_iterator, std::initializer_list<llvm::Value**>) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#17 0x00007f87fa4a768c in clang::CodeGen::CodeGenFunction::PopCleanupBlocks(clang::CodeGen::EHScopeStack::stable_iterator, unsigned long, std::initializer_list<llvm::Value**>) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#18 0x00007f87fa36f8e6 in clang::CodeGen::CodeGenFunction::EmitWhileStmt(clang::WhileStmt const&, llvm::ArrayRef<clang::Attr const*>) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#19 0x00007f87fa36e70f in clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#20 0x00007f87fa36eb52 in clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#21 0x00007f87fa3a6ae7 in clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#22 0x00007f87fa3c210f in clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#23 0x00007f87fa3e2332 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#24 0x00007f87fa3e2435 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#25 0x00007f87fa3e24f1 in clang::CodeGen::CodeGenModule::Release() () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#26 0x00007f87fa330bab in clang::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#27 0x00007f87fa28b7cf in cling::IncrementalParser::codeGenTransaction(cling::Transaction*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#28 0x00007f87fa28bb2b in cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm
::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*> > >&, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#29 0x00007f87fa28bd3a in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#30 0x00007f87fa21ee11 in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#31 0x00007f87fa21f62d in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#32 0x00007f87fa2cb348 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#33 0x00007f87fa17f8fc in HandleInterpreterException (metaProcessor=0x7f88095ea6c0, input_line=<optimized out>, compRes=
0x7ffcfad977b4: cling::Interpreter::kSuccess, result=result
entry=0x7ffcfad978e0) at /home/dongh/shome/hackweek/ROOT/root/core/metacling/src/TCling.cxx:2163
#34 0x00007f87fa192f86 in TCling::ProcessLine (this=0x7f880958f5f0, line=<optimized out>, error=0x0) at /home/dongh/shome/hackweek/ROOT/root/core/metacling/src/TCling.cxx:2321
#35 0x00007f8808c22059 in ?? ()
#36 0x00007f87d34348f0 in ?? ()
#37 0x00007ffcfad97ba0 in ?? ()
#38 0x00007ffcfad97b80 in ?? ()
#39 0x00007f88085ccbfd in setlocale () from /lib64/libc.so.6
#40 0x00007f87f0a76ca0 in ?? ()
#41 0x0000007f00000001 in ?? ()
#42 0x0000000000000000 in ?? ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#7 0x00007f87fbe13be0 in clang::Decl::castFromDeclContext(clang::DeclContext const*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#8 0x00007f87fa41f122 in (anonymous namespace)::ItaniumCXXABI::NeedsVTTParameter(clang::GlobalDecl) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#9 0x00007f87fa49cfa8 in clang::CodeGen::CodeGenFunction::GetVTTParameter(clang::GlobalDecl, bool, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#10 0x00007f87fa427638 in (anonymous namespace)::ItaniumCXXABI::EmitDestructorCall(clang::CodeGen::CodeGenFunction&, clang::CXXDestructorDecl const*, clang::CXXDtorType, bool, bool, clang::CodeGen::Address) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#11 0x00007f87fa495177 in clang::CodeGen::CodeGenFunction::destroyCXXObject(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#12 0x00007f87fa4b4750 in clang::CodeGen::CodeGenFunction::emitDestroy(clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#13 0x00007f87fa4b4add in clang::CodeGen::EHScopeStack::ConditionalCleanup<(anonymous namespace)::DestroyObject, clang::CodeGen::Address, clang::QualType, void (*)(clang::CodeGen::CodeGenFunction&, clang::CodeGen::Address, clang::QualType), bool>::Emit(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup::Flags) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#14 0x00007f87fa4a2b6a in EmitCleanup(clang::CodeGen::CodeGenFunction&, clang::CodeGen::EHScopeStack::Cleanup*, clang::CodeGen::EHScopeStack::Cleanup::Flags, clang::CodeGen::Address) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#15 0x00007f87fa4a6d42 in clang::CodeGen::CodeGenFunction::PopCleanupBlock(bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#16 0x00007f87fa4a7291 in clang::CodeGen::CodeGenFunction::PopCleanupBlocks(clang::CodeGen::EHScopeStack::stable_iterator, std::initializer_list<llvm::Value**>) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#17 0x00007f87fa4a768c in clang::CodeGen::CodeGenFunction::PopCleanupBlocks(clang::CodeGen::EHScopeStack::stable_iterator, unsigned long, std::initializer_list<llvm::Value**>) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#18 0x00007f87fa36f8e6 in clang::CodeGen::CodeGenFunction::EmitWhileStmt(clang::WhileStmt const&, llvm::ArrayRef<clang::Attr const*>) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#19 0x00007f87fa36e70f in clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#20 0x00007f87fa36eb52 in clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#21 0x00007f87fa3a6ae7 in clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#22 0x00007f87fa3c210f in clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#23 0x00007f87fa3e2332 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#24 0x00007f87fa3e2435 in clang::CodeGen::CodeGenModule::EmitDeferred() () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#25 0x00007f87fa3e24f1 in clang::CodeGen::CodeGenModule::Release() () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#26 0x00007f87fa330bab in clang::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#27 0x00007f87fa28b7cf in cling::IncrementalParser::codeGenTransaction(cling::Transaction*) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#28 0x00007f87fa28bb2b in cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*> > >&, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#29 0x00007f87fa28bd3a in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#30 0x00007f87fa21ee11 in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#31 0x00007f87fa21f62d in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#32 0x00007f87fa2cb348 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /home/dongh/pkg/usr/local/root/lib/libCling.so
#33 0x00007f87fa17f8fc in HandleInterpreterException (metaProcessor=0x7f88095ea6c0, input_line=<optimized out>, compRes=
0x7ffcfad977b4: cling::Interpreter::kSuccess, result=result
entry=0x7ffcfad978e0) at /home/dongh/shome/hackweek/ROOT/root/core/metacling/src/TCling.cxx:2163
#34 0x00007f87fa192f86 in TCling::ProcessLine (this=0x7f880958f5f0, line=<optimized out>, error=0x0) at /home/dongh/shome/hackweek/ROOT/root/core/metacling/src/TCling.cxx:2321
#35 0x00007f8808c22059 in ?? ()
#36 0x00007f87d34348f0 in ?? ()
#37 0x00007ffcfad97ba0 in ?? ()
#38 0x00007ffcfad97b80 in ?? ()
#39 0x00007f88085ccbfd in setlocale () from /lib64/libc.so.6
#40 0x00007f87f0a76ca0 in ?? ()
#41 0x0000007f00000001 in ?? ()
#42 0x0000000000000000 in ?? ()
===========================================================
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: long TInterpreter::ProcessLine(const char* line, TInterpreter::EErrorCode* error = 0) =>
problem in C++; program state has been reset
so my question is, what happened to pyroot to cause it to fail? is there a way to make it work?