Cling crashes without error

I have downloaded the standalone cling and clang. I have a code which compiles with clang. However, I cannot execute the same with cling. I need a CLI for users.
This is how I run clang
/home/utils/llvm-3.9.0/bin/clang++ -std=c++14 -O3 -L/home/utils/gcc-5.3.0/lib64/ -isystem /home/utils/gcc-5.3.0/include/c++/5.3.0 -I/home/utils/gcc-5.3.0/include/c++/5.3.0/x86_64-unknown-linux-gnu main.cpp

What would be the equivalent to include to run cling.
/home/cling/src/build/bin/cling -std=c++14 -L/home/utils/gcc-5.3.0/lib64/ -isystem /home/utils/gcc-5.3.0/include/c++/5.3.0 -I/home/utils/gcc-5.3.0/include/c++/5.3.0/x86_64-unknown-linux-gnu -L/home/utils/zeromq-2.1.10/lib -L/usr/lib

Though this starts the cling without any errors. It will load the files as well. But when I try to execute, it just crashes without any error
#0 0x0000000000bbe5ca llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/cling/src/build/bin/cling+0xbbe5ca)
#1 0x0000000000bbc6ee llvm::sys::RunSignalHandlers() (/home/cling/src/build/bin/cling+0xbbc6ee)
#2 0x0000000000bbc828 SignalHandler(int) (/home/cling/src/build/bin/cling+0xbbc828)
#3 0x000000323aa302d0 __restore_rt (/lib64/libc.so.6+0x323aa302d0)
#4 0x00007ffff4979e07
#5 0x00007ffff4978490
#6 0x00007ffff497f980
#7 0x00007ffff4980e1e
#8 0x00007ffff496bb4b
#9 0x00007ffff496d75a
#10 0x00007ffff496e974
#11 0x00007ffff496eeb5
#12 0x00007ffff77c2049
#13 0x0000000000b2f170 cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) [clone .part.286] [clone .constprop.448] (/home/cling/src/build/bin/cling+0xb2f170)
#14 0x0000000000b337fd cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (/home/cling/src/build/bin/cling+0xb337fd)
#15 0x0000000000b33a5c cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cling::Value*, cling::Transaction**, bool) (/home/cling/src/build/bin/cling+0xb33a5c)
#16 0x0000000000b71a5f cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (/home/cling/src/build/bin/cling+0xb71a5f)
#17 0x0000000000bd663b cling::UserInterface::runInteractively(bool) (/home/cling/src/build/bin/cling+0xbd663b)
#18 0x0000000000a3f9b7 main (/home/cling/src/build/bin/cling+0xa3f9b7)
#19 0x000000323aa1d994 __libc_start_main (/lib64/libc.so.6+0x323aa1d994)
#20 0x0000000000ab0db5 _start (/home/cling/src/build/bin/cling+0xab0db5)
Stack dump:
0. Program arguments: /home/cling/src/build/bin/cling -std=c++14 -L/home/utils/gcc-5.3.0/lib64/ -isystem /home/utils/gcc-5.3.0/include/c++/5.3.0 -I/home/utils/gcc-5.3.0/include/c++/5.3.0/x86_64-unknown-linux-gnu -L/home/utils/zeromq-2.1.10/lib -L/usr/lib
Segmentation fault

Is there a way I can see what were the errors. Or How do I reinstall/modify/pass arguments to get it running.
I am not pasting my code currently, since it is too much to fit in here. I’ll if needed.

Can you build cling, llvm and clang with asserts enabled? That should already get you a long way. If that didn’t help we’ll try something else!

I assume main.cpp contains int main(). If that’s the case, this is an existing bug/limitation.

@Axel could you please help me how to build cling,clang,llvm with assert enabled?

@vvassilev I tried executing 1 inst per instances instead of running main(). It still crashed at for some called functions. It could find the function definition but not execute it.

See e.g. here on how to build it: https://root.cern.ch/cling-build-instructions

You want to pass -DCMAKE_BUILD_TYPE=Debug to cmake.

Axel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.