Understanding .undo and Interpreter::unload

Thanks Vassil.
So after seeing your messages I decided to grab a fresh version of cling by using this:

#clone llvm and apply patches
git clone http://root.cern.ch/git/llvm.git llvm_rep
cd llvm_rep
git checkout cling-patches

#clone cling and clang
cd tools
git clone http://root.cern.ch/git/cling.git
git clone http://root.cern.ch/git/clang.git
cd clang
git checkout cling-patches

And rebuilt the whole thing with:

#build release libraries
cd ../..
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../../lib/ -DLLVM_TARGETS_TO_BUILD="CppBackend;X86" -DCMAKE_BUILD_TYPE=Release ..
make -j8
make install -j8

Could it be that I’m missing something out in my build settings? I’ve checked both the docs on this website and the readme on github. I noticed that on github there’s an extra cmake llvm target called “CBackend”(https://github.com/root-mirror/cling#building), but it’s not present in the target folder, so if you try to build with this extra settings it will obviously fail. (There’s an issue on github mentioning this problem: https://github.com/root-mirror/cling/issues/4).

Anyway, with this fresh built, I re-tried the code I posted above, and unfortunately the same happen:

MacbookPro:bin simongeilfus$ ./cling

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ #include <vector>
[cling]$ std::vector<int> test;
[cling]$ .undo
[cling]$ std::vector<int> test;
In file included from input_line_3:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:362:5: error: constructor for
      'std::__1::__vector_base<int, std::__1::allocator<int> >' must explicitly initialize the base class '__vector_base_common<true>' which does not
      have a default constructor
    __vector_base()
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:503:5: note: in instantiation of member
      function 'std::__1::__vector_base<int, std::__1::allocator<int> >::__vector_base' requested here
    vector()
    ^
input_line_5:2:19: note: in instantiation of member function 'std::__1::vector<int, std::__1::allocator<int> >::vector' requested here
 std::vector<int> test;
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:322:48: note: 
      'std::__1::__vector_base_common<true>' declared here
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __vector_base_common<true>)
                                               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:623:54: note: expanded from macro
      '_LIBCPP_EXTERN_TEMPLATE'
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;

Could someone confirm me that I’m not building the libraries properly?
Thanks a lot!

1 Like