Problems building root 5.34_rc1 using cling

Dear experts,

I try to build the recent 5.34 rc1 with cling on Lion. I installed llvm and clang to /opt/llvm which works fine. I also build cling as described in the README. Also the configure (./configure --prefix=/opt/root/ --with-llvm-config=/opt/llvm/bin/llvm-config --with-clang --enable-cling --enable-ruby --enable-roofit) runs fine. When I try to build root with clang I get an error from ASTNodeEraser.cpp:

/Users/marcusmorgenstern/root_534/cint/cling/lib/Interpreter/ASTNodeEraser.cpp:350:35: error: address expression must be an lvalue or a function designator
Successful = VisitNamedDecl(&(*I)) && Successful;
^ ~~
If I replace the address operator and directly pass *I it compiles, but this I don’t understand, since the address should be a valid type, right?
Does anyone has an idea what is going wrong here, or has spotted similar problems?

Many thanks in advance!

Cheers,

Marcus

[quote=“morgenst”]Dear experts,

I try to build the recent 5.34 rc1 with cling on Lion. I installed llvm and clang to /opt/llvm which works fine. I also build cling as described in the README. Also the configure (./configure --prefix=/opt/root/ --with-llvm-config=/opt/llvm/bin/llvm-config --with-clang --enable-cling --enable-ruby --enable-roofit) runs fine. When I try to build root with clang I get an error from ASTNodeEraser.cpp:

/Users/marcusmorgenstern/root_534/cint/cling/lib/Interpreter/ASTNodeEraser.cpp:350:35: error: address expression must be an lvalue or a function designator
Successful = VisitNamedDecl(&(*I)) && Successful;
^ ~~
If I replace the address operator and directly pass *I it compiles, but this I don’t understand, since the address should be a valid type, right?
Does anyone has an idea what is going wrong here, or has spotted similar problems?

Many thanks in advance!

Cheers,

Marcus[/quote]
Hi Marcus,
That was an API change in Clang/LLVM, which was introduced recently. What you did was the right thing.
Vassil

Hi Vassil,

thanks a lot for your answer. Do you think it is worth to edit all the occurrence of this (there was at least one more file which didn’t compile) or should one wait for an official fix?

Thanks,

Marcus

Hi Marcus,
The occurrences are 2 and they are fixed in the trunk. I don’t know whether it makes sense to backport them in the release candidate, because the build is failing with the newest LLVM only.
Vassil

Hi Vassil,

thanks! Right there were only 2 occurrences of this, but the interpreter is also not compiling due to not declared function, e.g.:

/Users/marcusmorgenstern/root_534/cint/cling/lib/Interpreter/Interpreter.cpp:734:16: error: out-of-line definition of ‘lookupClass’ does not match any declaration in
’cling::Interpreter’
Interpreter::lookupClass(const std::string& className)

Do you know if this is fixed in the trunk? I guess I will give it a try.

Thanks,

Marcus

Hi Marcus,
It seems that you haven’t run make install in your llvm build dir.
Vassil

Hi Vassil,

right. There went something wrong. I now tried to build the trunk version but get an error from the dynamic linker:

dyld: Library not loaded: /opt/root//lib/root/libCling.so

I try to install root to /opt/root, hence the library cannot be there before I run make install, right? The libCling.so is in ~/root/lib. I already tried to add this path to DYLD_LIBRARY_PATH and LD_LIBRARY_PATH, but it does not look into this. Do you have any idea what I can do?

Thanks,

Marcus

Hi Marcus,
Do you follow that one root.cern.ch/drupal/content/clin … structions
and then that one root.cern.ch/drupal/content/installing-root-source ?

What does otool -L bin/root.exe say?
Vassil

Hi Vassil,

yes I did follow these instructions. There is no root.exe in bin, so I don’t get any otool output. The root.exe is build during make, right? So since this fails it is not built, yet.

Thanks,

Marcus

Hi Marcus,
I have no idea…
You don’t need to make install root. You do need to make install LLVM, Clang and Cling. Could you paste me the exact error and the exact commands you’re running?
Vassil

Hi Vassil,

I started from scratch (using the trunk version) to avoid working on a (maybe) messed up version. Unfortunately I now get a completely different error:
input_line_9:1:98: error: a space is required between consecutive right angle brackets (use ‘> >’)
template class std::map<char *, int, std::less<char *>, std::allocator<std::pair<char *const, int>> > ;
and multimap header is not found:

In file included from CINT #pragma extraction:2:
/Users/marcusmorgenstern/root_trunk/core/metautils/src/multimapLinkdef.h:2:10: fatal error: ‘multimap’ file not found
#include

I cannot figure out were I could fix this. What I do is following the instructions to install root, i.e.:

./configure --build=debug --prefix=/opt/root/ --with-llvm-config=/opt/llvm/bin/llvm-config --with-clang --enable-cling --enable-ruby --enable-roofit
make -j4

Many thanks,

Marcus

Hi Marcus,
Now I understand. This is sort-of expected. It’s a part from the migration process to replace cint with cling. CINT allowed to have for example:

Note the lack of space between > and >. This is an ambiguity in the C++ grammar and the only way the language designers could deal with that is to enforce that extra space. To sum up:

This is what is allowed by the C++ standard.
The new standard C++11 fixes that issue. However, we are not ready to support C++11 yet. So we have to remove all those occurrences, which were allowed by CINT and maybe reintroduce them when we start to use C++11 :slight_smile:
Please be patient for few days. We are working to fix it soon.

Vassil

Hi Vassil,

many thanks for your clarification. If you could let me know once this is fixed, this would be great.

Many thanks,

Marcus