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

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

Open
eguiraud opened this issue Sep 24, 2020 · 12 comments
Open

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

eguiraud opened this issue Sep 24, 2020 · 12 comments

Comments

@eguiraud
Copy link
Member

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
Copy link
Member Author

eguiraud commented Oct 1, 2020

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
Copy link
Collaborator

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

@eguiraud eguiraud moved this from Needs triage to Rest in Triage Oct 6, 2020
@jalopezg-git
Copy link
Collaborator

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 #9160. The original reported issue is to be investigated.

@eguiraud
Copy link
Member Author

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
Copy link
Collaborator

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
Copy link
Member Author

eguiraud commented Jun 2, 2023

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
Copy link
Member Author

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 eguiraud reopened this Nov 30, 2023
@eguiraud
Copy link
Member Author

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.

@hahnjo hahnjo removed this from Issues in Fixed in 6.32.00 Nov 30, 2023
@dpiparo dpiparo assigned devajithvs and unassigned jalopezg-git Feb 2, 2024
@dpiparo
Copy link
Member

dpiparo commented Feb 2, 2024

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
Copy link
Member

hahnjo commented Feb 2, 2024

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 #13565 😞

@dpiparo
Copy link
Member

dpiparo commented Apr 24, 2024

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

@devajithvs
Copy link
Contributor

I was looking into this and this seems similar to the issue: #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] 

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

No branches or pull requests

6 participants