[Nix-dev] "Error loading shared libraries" in a temporary tool

Damien Cassou damien at cassou.me
Mon Jul 25 10:48:09 CEST 2016


Hi,

I'm writing a derivation for vtk (http://vtk.org/). Here is the work in
progress: https://github.com/NixOS/nixpkgs/pull/17246.

The vtk compilation chain starts by building a library
(libvtksys-7.0.so.1) and a tool (vtkHashSource) that depends on this
library. Later, the compilation chain uses the tool but this results in
an error:

    [ 47%] Built target vtkIOLegacy
    Scanning dependencies of target vtkHashSource
    [ 47%] Building CXX object Utilities/HashSource/CMakeFiles/vtkHashSource.dir/vtkHashSource.cxx.o
    [ 47%] Linking CXX executable ../../bin/vtkHashSource-7.0
    [ 47%] Built target vtkHashSource
    [ 47%] Generating vtkSocketCommunicatorHash.h
    ../../bin/vtkHashSource-7.0: error while loading shared libraries: libvtksys-7.0.so.1: cannot open shared object file: No such file or directory
    make[2]: *** [Parallel/Core/CMakeFiles/vtkParallelCore.dir/build.make:63: Parallel/Core/vtkSocketCommunicatorHash.h] Error 127

I can see earlier warnings:

    [  1%] Building CXX object Utilities/KWSys/vtksys/CMakeFiles/vtksys.dir/SystemInformation.cxx.o
    [  1%] Linking CXX shared library ../../../lib/libvtksys-7.0.so
    [  1%] Built target vtksys
    [  1%] Generating vtkUnicodeCaseFoldData.h
    [  7%] Linking CXX shared library ../../lib/libvtkCommonMisc-7.0.so
    /nix/store/84x0vldsif3v7i7c6i2ckfzp4jyg9bq9-binutils-2.26/bin/ld: warning: libvtksys-7.0.so.1, needed by ../../lib/libvtkCommonCore-7.0.so.1, not found (try using -rpath or -rpath-link)
    [  7%] Linking CXX shared library ../../lib/libvtkCommonTransforms-7.0.so
    /nix/store/84x0vldsif3v7i7c6i2ckfzp4jyg9bq9-binutils-2.26/bin/ld: warning: libvtksys-7.0.so.1, needed by ../../lib/libvtkCommonCore-7.0.so.1, not found (try using -rpath or -rpath-link)
    [  7%] Built target vtkCommonTransforms

The vtkHashSource tool has this CMakeLists.txt:

    vtk_module_export_info()
    
    # This executable is only run from the build tree so we do not need a
    # launcher for it and should always use the RPATH to find shared libs.
    SET(CMAKE_SKIP_RPATH 0)
    
    IF(NOT CMAKE_CROSSCOMPILING)
      ADD_EXECUTABLE(vtkHashSource vtkHashSource.cxx)
      TARGET_LINK_LIBRARIES(vtkHashSource vtksys)
      vtk_compile_tools_target(vtkHashSource)
    ENDIF()

Can somebody help me please?

Thanks

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill


More information about the nix-dev mailing list