Skip to content

LoKi::ToCpp - Explicitly instanciate array<string,4> to work around clang/python/cling/ROOT issue

The primary purpose of this MR is to address the clang LHCb test failures, e.g. those at

https://lhcb-nightlies.cern.ch/nightly/lhcb-head/build/2458/

IncrementalExecutor::executeFunction: symbol '_ZNSt5arrayINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELm4EED1Ev' unresolved while linking function '_GLOBAL__sub_I_cling_module_406'!
You are probably missing the definition of std::array<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, 4ul>::~array()
Maybe you need to load the corresponding shared library?

The most minimal reproducer I have found for this is, from python

from LoKiCore.basic import std, LoKi
x = LoKi.Functor(std.vector('double'), 'double')

The issue, as far as I have been able to get investigating it, is something to do with the std::tuple overload of toCpp

template <typename Tuple, std::size_t... I>
std::string toCpp( const Tuple& t, std::index_sequence<I...> ) {
  std::array<std::string, sizeof...( I )> strs{Gaudi::Utils::toCpp( std::get<I>( t ) )...};
  return boost::algorithm::join( strs, " , " );
}

However, I have not be fully able to pin it down to exactly what. An LHCb issue, ROOT ?, cling ? or something else, I am not sure.

This MR adds a clang specific workaround, to explicitly instantiate the type std::array<std::string, 4ul> from LoKi/ToCpp.h.

I acknowledge this is really more a workaround than a fix, but at least it cleans up the nightlies, which is my aim here...

Merge request reports