root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.72k stars 1.3k forks source link

Failed compilation leaves cling in a "bad state" #6439

Open eguiraud opened 4 years ago

eguiraud commented 4 years ago

To Reproduce

The first line executed is invalid C++ code, and cling rightly complains. The second line is valid code, but cling does not seem to be able to compile it after the previous compilation failure. Opening a new ROOT prompt and directly inserting the valid code works fine.

~ root -l
root [0] ROOT::RDataFrame(10).Define("x", [] { return 42; }).Snapshot<int>("t", "f.root");
ROOT_prompt_0:1:53: error: no matching member function for call to 'Snapshot'
/*** snip ***/
root [1] ROOT::RDataFrame(10).Define("x", [] { return 42; }).Snapshot<int>("t", "f.root", {"x"});
IncrementalExecutor::executeFunction: symbol '_ZStanSt12memory_orderSt23__memory_order_modifier' unresolved while linking [cling interface function]!
You are probably missing the definition of std::operator&(std::memory_order, std::__memory_order_modifier)
Maybe you need to load the corresponding shared library?

Setup

ROOT master@3ae45ea5f9, RelWithDebInfo. I could not reproduce with master@dcac6e1bf0, Debug build type. The 6.22.02 conda package also seems to be affected.

eguiraud commented 4 years ago

Another reproducer:

~ root -l
root [0] Long32_t ba;
ROOT_prompt_0:1:9: error: expected ';' after expression
Long32_t ba;
        ^
        ;
ROOT_prompt_0:1:10: error: use of undeclared identifier 'ba'
Long32_t ba;
         ^
root [1] Long64_t ba;
root.exe: ../../../../../../../../root_dbg/interpreter/llvm/src/tools/clang/lib/Sema/SemaDecl.cpp:12576: clang::Decl* clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool): Assertion `!Cleanup.exprNeedsCleanups() && "Unaccounted cleanups in function"' failed.
jalopezg-git commented 4 years ago

Thanks @eguiraud, I will take a look at this thing soon. Actually, I think these are two different problems, but we'll see...

jalopezg-git commented 2 years ago

Another reproducer:

~ root -l
root [0] Long32_t ba;
ROOT_prompt_0:1:9: error: expected ';' after expression
Long32_t ba;
        ^
        ;
ROOT_prompt_0:1:10: error: use of undeclared identifier 'ba'
Long32_t ba;
         ^
root [1] Long64_t ba;
root.exe: ../../../../../../../../root_dbg/interpreter/llvm/src/tools/clang/lib/Sema/SemaDecl.cpp:12576: clang::

As suspected, these were two different issues. The quoted issue was fixed in https://github.com/root-project/root/pull/9160. The original reported issue is to be investigated.

eguiraud commented 2 years ago

This is still a problem in 6.26.04:

root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x")->DrawClone()
root.exe: /home/conda/feedstock_root/build_artifacts/root_base_1654795774398/work/root-source/interpreter/cling/lib/Interpreter/DynamicLibraryManagerSymbol.cpp:1187: std::string cling::Dyld::searchLibrariesForSymbol(llvm::StringRef, bool): Assertion `!llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(mangledName) && "Library already loaded, please use dlsym!"' failed.
jalopezg-git commented 2 years ago

Thanks for the ping, @eguiraud! :-)

I had some work on a branch that fixes this and other related issues (grouped in #10049), but I still need to find the time to polish that code.

eguiraud commented 1 year ago

This is still present in v6.28.04 (LLVM 13) but the error is much more verbose:

/tmp root -l
root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x")->DrawClone()
IncrementalExecutor::executeFunction: symbol '_ZSt4swapIP4TH1DENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::enable_if<__and_<std::__not_<std::__is_tuple_like<TH1D*> >, std::is_move_constructible<TH1D*>, std::is_move_assignable<TH1D*> >::value, void>::type std::swap<TH1D*>(TH1D*&, TH1D*&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt11make_sharedIN4ROOT8Internal3RDF13RJittedActionEJRNS0_6Detail3RDF12RLoopManagerERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISE_EERNS2_15RColumnRegisterESI_EESt10shared_ptrINSt9enable_ifIXntsr8is_arrayIT_EE5valueESN_E4typeEEDpOT0_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::shared_ptr<std::enable_if<!is_array<ROOT::Internal::RDF::RJittedAction>::value, ROOT::Internal::RDF::RJittedAction>::type> std::make_shared<ROOT::Internal::RDF::RJittedAction, ROOT::Detail::RDF::RLoopManager&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ROOT::Internal::RDF::RColumnRegister&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&>(ROOT::Detail::RDF::RLoopManager&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ROOT::Internal::RDF::RColumnRegister&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4moveIRSt10shared_ptrIN4ROOT6Detail3RDF13RJittedDefineEEEONSt16remove_referenceIT_E4typeEOS8_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::remove_reference<std::shared_ptr<ROOT::Detail::RDF::RJittedDefine>&>::type&& std::move<std::shared_ptr<ROOT::Detail::RDF::RJittedDefine>&>(std::shared_ptr<ROOT::Detail::RDF::RJittedDefine>&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4moveIRN4ROOT8Internal3RDF15RColumnRegisterEEONSt16remove_referenceIT_E4typeEOS6_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::remove_reference<ROOT::Internal::RDF::RColumnRegister&>::type&& std::move<ROOT::Internal::RDF::RColumnRegister&>(ROOT::Internal::RDF::RColumnRegister&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4moveIRKSt10shared_ptrIN4ROOT8Internal3RDF13RJittedActionEEEONSt16remove_referenceIT_E4typeEOS9_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::remove_reference<std::shared_ptr<ROOT::Internal::RDF::RJittedAction> const&>::type&& std::move<std::shared_ptr<ROOT::Internal::RDF::RJittedAction> const&>(std::shared_ptr<ROOT::Internal::RDF::RJittedAction> const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT8Internal3RDF14MakeWeakOnHeapINS1_13RJittedActionEEEPSt8weak_ptrIT_ERKSt10shared_ptrIS5_E' unresolved while linking [cling interface function]!
You are probably missing the definition of std::weak_ptr<ROOT::Internal::RDF::RJittedAction>* ROOT::Internal::RDF::MakeWeakOnHeap<ROOT::Internal::RDF::RJittedAction>(std::shared_ptr<ROOT::Internal::RDF::RJittedAction> const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT8Internal3RDF16MakeSharedOnHeapI4TH1DEEPSt10shared_ptrIT_ERKS6_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::shared_ptr<TH1D>* ROOT::Internal::RDF::MakeSharedOnHeap<TH1D>(std::shared_ptr<TH1D> const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT6Detail3RDF13MakeResultPtrI4TH1DEENS_3RDF10RResultPtrIT_EERKSt10shared_ptrIS6_ERNS1_12RLoopManagerES8_INS_8Internal3RDF11RActionBaseEE' unresolved while linking [cling interface function]!
You are probably missing the definition of ROOT::RDF::RResultPtr<TH1D> ROOT::Detail::RDF::MakeResultPtr<TH1D>(std::shared_ptr<TH1D> const&, ROOT::Detail::RDF::RLoopManager&, std::shared_ptr<ROOT::Internal::RDF::RActionBase>)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSteqI4TH1DEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator==<TH1D>(std::shared_ptr<TH1D> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT8Internal3RDF16MakeSharedOnHeapINS_6Detail3RDF9RNodeBaseEEEPSt10shared_ptrIT_ERKS8_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::shared_ptr<ROOT::Detail::RDF::RNodeBase>* ROOT::Internal::RDF::MakeSharedOnHeap<ROOT::Detail::RDF::RNodeBase>(std::shared_ptr<ROOT::Detail::RDF::RNodeBase> const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZStneIN4ROOT8Internal3RDF11RActionBaseEEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator!=<ROOT::Internal::RDF::RActionBase>(std::shared_ptr<ROOT::Internal::RDF::RActionBase> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
root [2]
eguiraud commented 1 year ago

Still present in current master:

root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x")->DrawClone()
IncrementalExecutor::executeFunction: symbol '_ZSt4moveIRN4ROOT8Internal3RDF15RColumnRegisterEEONSt16remove_referenceIT_E4typeEOS6_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::remove_reference<ROOT::Internal::RDF::RColumnRegister&>::type&& std::move<ROOT::Internal::RDF::RColumnRegister&>(ROOT::Internal::RDF::RColumnRegister&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4moveIRSt10shared_ptrIN4ROOT6Detail3RDF13RJittedDefineEEEONSt16remove_referenceIT_E4typeEOS8_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::remove_reference<std::shared_ptr<ROOT::Detail::RDF::RJittedDefine>&>::type&& std::move<std::shared_ptr<ROOT::Detail::RDF::RJittedDefine>&>(std::shared_ptr<ROOT::Detail::RDF::RJittedDefine>&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt8_DestroyIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_EvT_S7_RSaIT0_E' unresolved while linking [cling interface function]!
You are probably missing the definition of void std::_Destroy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZStneIN4ROOT8Internal3RDF11RActionBaseEEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator!=<ROOT::Internal::RDF::RActionBase>(std::shared_ptr<ROOT::Internal::RDF::RActionBase> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4swapIP4TH1DENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::enable_if<__and_<std::__not_<std::__is_tuple_like<TH1D*> >, std::is_move_constructible<TH1D*>, std::is_move_assignable<TH1D*> >::value, void>::type std::swap<TH1D*>(TH1D*&, TH1D*&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSteqI4TH1DEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator==<TH1D>(std::shared_ptr<TH1D> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
eguiraud commented 1 year ago

I think the fixed state should behave like this:

root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x")->DrawClone()
root [2]

The first (wrong) line produces a helpful compiler error, the second (valid) line produces a plot.

dpiparo commented 10 months ago

The issue is still there with master and LLVM 16. I add in the loop @devajithvs , who might be able to authoritatively comment about the issue.

hahnjo commented 10 months ago

To add my memory here: I think this was originally fixed by Javier, but I ended up re-introducing it when I made the remaining tests pass to merge https://github.com/root-project/root/pull/13565 :disappointed:

dpiparo commented 7 months ago

@devajithvs do you think this is something easy to fix?

devajithvs commented 7 months ago

I was looking into this and this seems similar to the issue: https://github.com/root-project/root/issues/10049

It's strange that this works:

root [0] std::unique_ptr<TFile> foo{TFile::Open("foo.root", "RECREATE")};
root [1] foo.GetName()
ROOT_prompt_1:1:4: error: no member named 'GetName' in 'std::unique_ptr<TFile, std::default_delete<TFile> >'; did you mean to use '->' instead of '.'?
foo.GetName()
   ^
   ->
root [2] foo->GetName()
(const char *) "foo.root"

while the example here doesn't:

root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x")->DrawClone()
IncrementalExecutor::executeFunction: symbol '_ZSteqI4TH1DEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator==<TH1D>(std::shared_ptr<TH1D> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZStneIN4ROOT8Internal3RDF11RActionBaseEEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator!=<ROOT::Internal::RDF::RActionBase>(std::shared_ptr<ROOT::Internal::RDF::RActionBase> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4swapIP4TH1DENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::enable_if<__and_<std::__not_<std::__is_tuple_like<TH1D*> >, std::is_move_constructible<TH1D*>, std::is_move_assignable<TH1D*> >::value, void>::type std::swap<TH1D*>(TH1D*&, TH1D*&)
Maybe you need to load the corresponding shared library?
root [2] 
guitargeek commented 1 day ago

Works after the LLVM upgrade!

root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1]

Thanks, @devajithvs.

hahnjo commented 1 day ago

No, it doesn't work:

root [0] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
ROOT_prompt_0:1:52: error: no member named 'DrawClone' in 'ROOT::RDF::RResultPtr<TH1D>'; did you mean to use '->' instead of '.'?
ROOT::RDataFrame(10).Define("x", "42").Histo1D("x").DrawClone()
                                                   ^
                                                   ->
root [1] ROOT::RDataFrame(10).Define("x", "42").Histo1D("x")->DrawClone()
IncrementalExecutor::executeFunction: symbol '_ZSt4swapIP4TH1DENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_' unresolved while linking [cling interface function]!
IncrementalExecutor::executeFunction: symbol '_ZStneIN4ROOT8Internal3RDF11RActionBaseEEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator!=<ROOT::Internal::RDF::RActionBase>(std::shared_ptr<ROOT::Internal::RDF::RActionBase> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSteqI4TH1DEbRKSt10shared_ptrIT_EDn' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::operator==<TH1D>(std::shared_ptr<TH1D> const&, decltype(nullptr))
Maybe you need to load the corresponding shared library?

Please, please, read through the full thread. As remarked, the important invocation is the second one that is correct and should work without errors!

guitargeek commented 1 day ago

Oh, thanks for that! The multi-line outputs are hard to read sometimes, and I missed the line second invocation. Alright, so I confirm it still doesn't work, just like #10049.