Latest patchable revision?

Hello everyone!

First I would like to express my gratitude on this great idea and program implementation. I’m just migrating from Python to C++ and i believe this will make the learning process painless. Thanks once again for making it publicly available.

My system is:

[quote]Linux 3.5.0-17-generic #28-Ubuntu SMP i686 athlon i686 GNU/Linux
32bit Linux Mint
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 (This is the output of gcc --version . I’m not sure if that automatically means that it was used for the build)[/quote]

The dependencies are listed listed here I did the following to install them, however thist doesn’ install all of those listed on the link (didn’t know the package names) :

I’ve successfully patched and build the following revisions:

mkdir Cling && cd Cling
svn co -r 163370 llvm
cd llvm/tools
svn co -r 163370 clang
svn co -r 45925
cd ..
cat tools/cling/patches/*.diff | patch -p0[/code]

I have failed to patch the most recent versions. Here is the code i used:

[code]svn co -r 191429 llvm
cd llvm/tools/
svn -r 191429 co clang
cd ../projects
svn -r 191429 co compiler-rt
cd ../tools
git clone
cd ..
cat tools/cling/patches/*.diff | patch -p0

Before a flood the textbox with the error patch returns, I would like to know what is the most recent functional revision combination? Are the recent cling sources versioned just by git?

LLVM/Clang r192531 and latest cling(Thu Oct 3 09:47:56 2013 +0200 commit 5706d4bdef4ced03168c2252370e780bf6931ebf).

That’s because patches in cling/patches are not updated. Here are patches I use:
They are generated when LLVM/Clang trunk updated in ROOT repo(commit 6a15cbef0784504abb303dec433ad4102f13a290).

I try to keep up with most recent LLVM/Clang version.

This is also required to use r192531 LLVM/Clang instead of r191429.

Thank you for the answer.

Can you please write how to apply the patches.

Here are the steps i did:

svn co -r 192531 llvm cd llvm/tools/ svn -r 192531 co clang cd ../projects/ svn -r 192531 co compiler-rt cd ../tools/ git clone sed -i 's/void\* OldEntity/DeclContext\* OldEntity/' cling/lib/Interpreter/LookupHelper.cpp

Here is how the folder structure looks like:

llvm ├── .... └── tools ├── clang ├── cling └── ....

I got the patches from the github repo you mentioned. And moved them into the where the cling patches were.

├── clang-9999
│ ├── clang-include.patch
│ └── clang-lib.patch
└── llvm-9999
├── llvm-dso_handle.patch
├── llvm-DyLib-from-handle.patch
└── llvm-lib-ROOT-autoload-missing-symbol-non-function.patch

[/code]I tried running the following from the llvm directory:

but it did nothing. Can you, please, write how to apply the patches.

From commit 96a013d91a65f90091f4625e89bb375a92e2c79b, Sun Oct 20 15:22:03 2013 +0200, patches in ${CLING_SRC_DIR}/patches/ are good to patch LLVM/Clang.

You can build cling and LLVM/Clang separately, if you use CMake.

LLVM/Clang newer than 191429 are also patchable, for example, 193063 is fine. But you will need [code]sed -i ‘s/void* OldEntity/DeclContext* OldEntity/’ lib/Interpreter/LookupHelper.cpp

sed -i ‘s/setPreviousDeclaration/setPreviousDecl/’ lib/Interpreter/ASTNodeEraser.cpp[/code]

Final note, patches in ${CLING_SRC_DIR}/patches/ are not enough to build ROOT, you will need if you want to build ROOT with an external LLVM/Clang.

The patching did pass this time. Here are the commands i used. The longer syntax for cd is to help easier navigation in the folder structure.

svn co -r 193063 llvm
cd llvm/tools/
svn -r 193063 co clang
cd ../../llvm/projects/
svn -r 193063 co compiler-rt
cd ../../llvm/tools/
git clone
cd ../../llvm/tools/cling
sed -i 's/void\* OldEntity/DeclContext\* OldEntity/' lib/Interpreter/LookupHelper.cpp 
sed -i 's/setPreviousDeclaration/setPreviousDecl/' lib/Interpreter/ASTNodeEraser.cpp
cd ../../../llvm/
cat tools/cling/patches/*.diff | patch -p0
mkdir build
cd ../llvm/build
../../llvm/configure --enable-targets=host

However it failed during compile.

[code] COMPILE: clang_linux/san-i386/i386: /home/alan/cling/llvm/projects/compiler-rt/lib/int_util.c
clang: /home/alan/cling/llvm/lib/IR/Value.cpp:307: void llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion `New->getType() == getType() && “replaceAllUses of value with new value of different type!”’ failed.
0 clang 0x0a63a7a2 llvm::sys::PrintStackTrace(_IO_FILE*) + 50
1 clang 0x0a63a9f5
2 clang 0x0a63a3e9
3 0x40022400 __kernel_sigreturn + 0
4 0x40022424 __kernel_vsyscall + 16
5 0x401e21df gsignal + 79
6 0x401e5825 abort + 373
7 0x401db085
8 0x401db137
9 clang 0x0a5d9791 llvm::Value::replaceAllUsesWith(llvm::Value*) + 187
10 clang 0x0a502081 llvm::DIType::replaceAllUsesWith(llvm::DIDescriptor&) + 149
11 clang 0x0a4f60fc llvm::DIBuilder::finalize() + 166
12 clang 0x089f2b15 clang::CodeGen::CGDebugInfo::finalize() + 719
13 clang 0x08a4d98c clang::CodeGen::CodeGenModule::Release() + 584
14 clang 0x089dd0f5
15 clang 0x089dc1c9
16 clang 0x08bc3980 clang::ParseAST(clang::Sema&, bool, bool) + 694
17 clang 0x087aa190 clang::ASTFrontendAction::ExecuteAction() + 306
18 clang 0x089dba47 clang::CodeGenAction::ExecuteAction() + 1311
19 clang 0x087a9d0d clang::FrontendAction::Execute() + 183
20 clang 0x0877e429 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 745
21 clang 0x087505e7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 939
22 clang 0x08742581 cc1_main(char const**, char const**, char const*, void*) + 749
23 clang 0x0874c143 main + 815
24 0x401cd4d3 __libc_start_main + 243
25 clang 0x08741c11
Stack dump:
0. Program arguments: /home/alan/cling/llvm/build/Debug+Asserts/bin/clang -cc1 -triple i386-pc-linux-gnu -emit-obj -disable-free -main-file-name int_util.c -mrelocation-model pic -pic-level 2 -pie-level 2 -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4 -target-linker-version -momit-leaf-frame-pointer -gline-tables-only -coverage-file /home/alan/cling/llvm/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib/int_util.o -resource-dir /home/alan/cling/llvm/build/Debug+Asserts/bin/…/lib/clang/3.4 -internal-isystem /usr/local/include -internal-isystem /home/alan/cling/llvm/build/Debug+Asserts/bin/…/lib/clang/3.4/include -internal-externc-isystem /usr/include/i386-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Werror -fdebug-compilation-dir /home/alan/cling/llvm/projects/compiler-rt -ferror-limit 19 -fmessage-length 112 -mstackrealign -fno-builtin -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /home/alan/cling/llvm/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib/int_util.o -x c /home/alan/cling/llvm/projects/compiler-rt/lib/int_util.c

  1. parser at end of file
    clang: error: unable to execute command: Aborted
    clang: error: clang frontend command failed due to signal (use -v to see invocation)
    clang version 3.4 (trunk 193063)
    Target: i386-pc-linux-gnu
    Thread model: posix
    clang: note: diagnostic msg: PLEASE submit a bug report to and include the crash backtrace, preprocessed source, and associated run script.
    clang: note: diagnostic msg:

Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/int_util-230da1.c
clang: note: diagnostic msg: /tmp/
clang: note: diagnostic msg:

make[5]: *** [/home/alan/cling/llvm/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib/int_util.o] Error 254
make[5]: Leaving directory /home/alan/cling/llvm/projects/compiler-rt' make[4]: *** [BuildRuntimeLibraries] Error 2 make[4]: Leaving directory/home/alan/cling/llvm/build/tools/clang/runtime/compiler-rt’
make[3]: *** [compiler-rt/.makeall] Error 2
make[3]: Leaving directory /home/alan/cling/llvm/build/tools/clang/runtime' make[2]: *** [all] Error 1 make[2]: Leaving directory/home/alan/cling/llvm/build/tools/clang’
make[1]: *** [clang/.makeall] Error 2
make[1]: Leaving directory `/home/alan/cling/llvm/build/tools’
make: *** [all] Error 1

I will post the BUG on the suggested link soon and update when new information arise.

Most recent version r193515 patches fine. And r193427 works fine for me.

It seems that you are using a trunk version clang to compile LLVM/Clang. And that trunk version clang crashed. So don’t use trunk verison clang but gcc or clang-3.3 to compile LLVM/Clang.

By the way, highly recommand using CMake to build LLVM/Clang.

Dear All,

Is is possible to keep up-to-date this post ? I was able to compile LLVM/Clang/Cling with :

REVISION="-r 191429"
rm -rf ./llvm
svn $REVISION co llvm
cd llvm/tools
svn $REVISION co clang
cd ../..
cd llvm/tools/clang/tools
svn $REVISION co extra
cd ../../../..
cd llvm/projects
svn $REVISION co compiler-rt
cd ../..
cd llvm/tools
git clone
cd ../..
cd llvm
cat tools/cling/patches/*.diff | patch -p0
cd ..
mkdir llvm/build
cd llvm/build
cmake ..
make -j4

But after that cling gives me [code]ExecutionContext: use of undefined symbol ‘_ZN5cling7runtime8internal21__trigger__cxa_atexitD1Ev’!
ExecutionContext::runStaticInitializersOnce: symbol ‘_ZN5cling7runtime8internal21__trigger__cxa_atexitD1Ev’ unresolved while linking static initializer ‘_GLOBAL__I_a’!
ExecutionContext: use of undefined symbol ‘ZN5cling7runtime8internal16local_cxa_atexitEPFvPvES2_S2_S2’!

****************** CLING ******************

  • Type C++ code and press enter to run it *
  •         Type .q to exit             *


I was not able to compile LLVM/Clang/Cling with more recent REVISION : 193427 , 194132 despite the

sed -i 's/void\* OldEntity/DeclContext\* OldEntity/' lib/Interpreter/LookupHelper.cpp
sed -i 's/setPreviousDeclaration/setPreviousDecl/' lib/Interpreter/ASTNodeEraser.cpp

and the patches from

git clone

My system is

I would like to be able to test GTK interactively with Cling as this guy did more than 2 years ago with Qt (I was not able to reproduce what he did with Qt probably because of the errors mentionned above.)

Thanks in advance, :slight_smile:

Cling tells you that the remapping of the cxa_at_exit doesn’t work for your system. That shouldn’t be an issue for the normal functioning of the interpreter. The cxa_at_exit gives the interpreter control over the time of the object destruction, which is relevant for upcoming features.
Sorry for the inconvenience and the late reply.