cling icon indicating copy to clipboard operation
cling copied to clipboard

Can't build cling v1.2 due to wrong number of arguments to Parser

Open thomasjm opened this issue 8 months ago • 6 comments

  • [X] Checked for duplicates

Describe the bug

I'm unable to compile Cling at release tag v1.2. I'm using the latest cling-llvm18 branch at https://github.com/root-project/llvm-project/commit/156e947058a46ecc1785f98aa9abb8cbfaa45aa7.

The problem is this new Parser(...) call, which passes 4 arguments instead of 3:

https://github.com/root-project/cling/blob/074107f03c49780f6c541081a549365020307d1e/lib/Interpreter/Interpreter.cpp#L270-L272

which produces a build error like this:

cling-unwrapped> /build/source/cling-source/lib/Interpreter/Interpreter.cpp:270:47: error: no matching constructor for initialization of 'Parser'                                                                                                                                         
cling-unwrapped>   270 |     m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef,                                                                                                                                                                                                
cling-unwrapped>       |                                               ^      ~~~~~~~~~~~~                                                                                                                                                                                                
cling-unwrapped>   271 |                                                      /*SkipFunctionBodies*/false,                                                                                                                                                                                
cling-unwrapped>       |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                
cling-unwrapped>   272 |                                                      /*isTemp*/true), this));                                                                                                                                                                                    
cling-unwrapped>       |                                                      ~~~~~~~~~~~~~~                                                                                                                                                                                              
cling-unwrapped> /build/source/llvm/../clang/include/clang/Parse/Parser.h:463:3: note: candidate constructor not viable: requires 3 arguments, but 4 were provided

I'm unable to find a version of LLVM where this Parser constructor has 4 arguments, so I'm not sure how this ever worked.

It seems to be fixed by a later commit in master: cd4d1d8c4963620a6a84834948845df81fbbd70b. If I backport that commit to v1.2, it builds.

Additional context

I'm using the approach described in "Building Cling Along with LLVM" in the README.

You can see exactly how I'm building this (as part of Nixpkgs) here.

thomasjm avatar Sep 02 '25 09:09 thomasjm

@vgvassilev or @guitargeek might have an idea here. Maybe that commit should be the new v1.2 tag ? Or 1.3 has to be release to fix it?

Maybe cling-llvm18-20250110-01 helps?

ferdymercury avatar Sep 02 '25 11:09 ferdymercury

As seen in https://github.com/root-project/root/pull/17353 the number of arguments changed then from 4 to 3.

Could you try with cling-llvm18-20250110-01 ie before that change ?

ferdymercury avatar Sep 02 '25 13:09 ferdymercury

As seen in https://github.com/root-project/root/pull/17353 the number of arguments changed then from 4 to 3.

Huh? That's exactly the PR that produced the commit I mentioned backporting. AFAICT the number of arguments doesn't change there, it just removes the problematic code.

thomasjm avatar Sep 02 '25 19:09 thomasjm

This does not require a new release; The LLVM tag to be used from root-project/llvm-project is not necessarily the latest cling-llvm18, since development on cling based on LLVM-18 has continued since then. Based on when cling 1.2 was released, https://github.com/root-project/llvm-project/releases/tag/cling-llvm18-20240821-01 is the tag you are looking for.

aaronj0 avatar Sep 09 '25 07:09 aaronj0

@aaronj0 thanks for the feedback! it would be still helpful to add this tag retrospectively, as requested here: https://github.com/root-project/cling/issues/380 and maybe @vgvassilev add it to the "ROOT (or Cling?) release procedure checklist document", since this was done before but was forgotten in the meantime and there are many reports of users confused and investing time to find what is the right tag.

ferdymercury avatar Sep 09 '25 07:09 ferdymercury

@aaronj0 thanks for the feedback! it would be still helpful to add this tag retrospectively, as requested here: #380 and maybe @vgvassilev add it to the "ROOT (or Cling?) release procedure checklist document", since this was done before but was forgotten in the meantime and there are many reports of users confused and investing time to find what is the right tag.

Yes it would indeed be good to have a tag on llvm that would make this much easier

reports of users confused and investing time to find what is the right tag.

based on my experience, root devs too :)

aaronj0 avatar Sep 10 '25 08:09 aaronj0