Create a simple “rootlogon.C
” file (in your current working directory):
{ // rootlogon.C
gInterpreter->AddIncludePath("/where/are/your/VTK/includes");
gSystem->AddDynamicPath("/where/are/your/VTK/libs");
// load all "libvtk*.so" shared libraries (no need to append ".so" in names)
// note: if they depend on one another, the order matters; e.g., try to
// load them in the same order as they had been built: "ls -1rt libvtk*.so"
gSystem->Load("libvtkCommonColor-9.0");
gSystem->Load("libvtkFiltersSources-9.0");
gSystem->Load("libvtklz4-9.0");
// ...
gSystem->Load("libvtkpng-9.0");
gSystem->Load("libvtkCommonMisc-9.0");
gSystem->Load("libvtkImagingGeneral-9.0");
}
You probably do not need to load all “libvtk*.so
” libraries one by one. There are probably only several “top-level” libraries that you need to load “manually”. When they were being built, each of these “top-level” libraries was linked against “lower-level” libraries on which it depends. So, when you load such a “top-level” library, the system will automatically load all required “lower-level” libraries (that it knows about, of course).
Note however that, due to a known cling::DynamicLibraryManager deficiency, you need to add the “/where/are/your/VTK/libs
” directory into the “LD_LIBRARY_PATH
” environment variable (before starting root
), or you need to run (just once):
patchelf --set-rpath "\$ORIGIN" /where/are/your/VTK/libs/libvtk*.so