Towards the packaging of cling for conda

Hi All,

I have been working on the packaging of cling for the conda package manager. We are very close to have windows, linux, and OS X packages for cling. When we are done, one should be able to run conda install cling on any platform and have a cling kernel installed for Jupyter.

  • First, using a functionality of conda called “build features”, I created a [cling] variant for the llvmand clang packages. Then, since the build of llvm and clang on windows was done with msvc 2013, I had to create a new version of the packages built with msvc 2015.
  • Since conda ships its own C runtime, this will be truly cross-linux distributions and we won’t have to make a different binary for the the different target architectures.
  • The recipe for cling will also install the jupyter kernelspec in the right place in the conda distribution so that Jupyter proposes a cling kernel as soon as cling is installed. (This has already been tested with the hacked recipe I made for the xtensor demo at quantstack.net/xtensor)
  • One limitation though, is that other packages such as Julia or Numba that have a runtime dependency on llvm won’t be installable in the same conda environment as cling because they require the default variant of llvm.

— What is the blocker —

So now that the cling variants of llvm and clang got into conda (with all the cmake artefacts in the right place), the last blocker is with the build of cling itself.

So the default build method for cling is for it to be build from within the llvm source tree - which is not going to work for us. Instead, we need to use the (cling-patched) llvm and clang as external dependencies. The support for this scenario does not seem to be complete in cling’s cmake.

For example, the cmake file attempts to use global variables such as CLANG_TABLEGEN_TARGETS which are never defined, and are set by clang’s cmake stuff - which is never called.

Here is the beginning of the output of cmakewhen attempting the build:

-- Cling will look for C++ headers in '/usr/include/c++/5:/usr/include/x86_64-linux-gnu/c++/5:/usr/include/c++/5/backward' at runtime.
-- And if not found, will invoke: 'g++-5' for them.
-- Configuring done
CMake Error at /home/sylvain/miniconda3/conda-bld/cling_1486418090716/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/cmake/llvm/AddLLVM.cmake:513 (add_dependencies):
  The dependency target "ClangDriverOptions" of target "clingInterpreter"
  does not exist.
Call Stack (most recent call first):
  CMakeLists.txt:315 (llvm_add_library)
  lib/Interpreter/CMakeLists.txt:41 (add_cling_library)


CMake Error at /home/sylvain/miniconda3/conda-bld/cling_1486418090716/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/cmake/llvm/AddLLVM.cmake:513 (add_dependencies):
  The dependency target "clang-headers" of target "clingInterpreter" does not
  exist.
Call Stack (most recent call first):
  CMakeLists.txt:315 (llvm_add_library)
  lib/Interpreter/CMakeLists.txt:41 (add_cling_library)


CMake Error at /home/sylvain/miniconda3/conda-bld/cling_1486418090716/_b_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pla/lib/cmake/llvm/AddLLVM.cmake:513 (add_dependencies):
  The dependency target "intrinsics_gen" of target "clingInterpreter" does
  not exist.
Call Stack (most recent call first):
  CMakeLists.txt:315 (llvm_add_library)
  lib/Interpreter/CMakeLists.txt:41 (add_cling_library)

[...]

So the place where e.g. CLANG_TABLEGEN_TARGETS is defined is clang’s AddClang.cmake module. Oddly, unlike AddLLVM.cmake, this file is not included in the distribution of Clang. Adding it and simply including AddClang.cmake in the same fashion that AddLLVM.cmake is included does not solve the issue.

I was wondering if anyone ever came across the same issue… If you have a solution, this could be very useful for a lot of people since installing cling will only be a matter of typing conda install cling, on all major platforms.

For reference, there is an issue on GitHub for this here: https://github.com/vgvassilev/cling/issues/132

Thanks.

We are following up this in GitHub.