Greetings,
I am attempting to use zig’s build system as a replacement for Makefile in the programs that I use for my research. As I work in hadronic physics, I need to be able to use CERN’s ROOT framework. To this end I perused what I could find and came across this template (which uses zig 0.14.1) for C++ projects that worked perfectly with my simple tests using LorentzVectors, but when I started testing code that used ROOT’s newer DataFrames I have run into issues with undefined symbols in the link step—all of which involved some sort of JIT components. Does zig c++ support compilation with libraries that contain JIT-ted code? The symbols can be seen with nm in /usr/lib/root/libROOTDataFrame.so, but is not found by the linker.
I am not entirely familiar with ROOT’s internals nor that of the Zig build system, so I would appreciate any help I can receive in this matter. (I already deal with shall-we-say interesting code design choices with the other in-house libraries we use at my collaboration’s lab, so I wanted to try out using a build.zig instead of our messy Makefile/CMake/Perl abomination.)
Example error:
error: ld.lld: undefined symbol: ROOT::Detail::RDF::RLoopManager::ToJitExec(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const
note: referenced by RInterfaceBase.hxx:204 (/usr/include/ROOT/RDF/RInterfaceBase.hxx:204)
note: /home/richardb/src/test/.zig-cache/o/afe1f30980c05e5b7d3376108f094f7d/main.o:(ROOT::RDF::RResultPtr<TH1D> ROOT::RDF::RInterfaceBase::CreateAction<ROOT::Internal::RDF::ActionTags::Histo1D, ROOT::Detail::RDF::RInferredType, TH1D, ROOT::Detail::RDF::RLoopManager, TH1D, 0>(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::shared_ptr<TH1D> const&, std::__1::shared_ptr<TH1D> const&, std::__1::shared_ptr<ROOT::Detail::RDF::RLoopManager> const&, int, bool))
The code in question can be found here: