Spack build of 5.9.0 with Ninja can generate incorrect paths with response files (.rsp), mishandling quotation marks
@cory.quammen @berkgeveci @patchett2002 @maxwelljackson002
Produced on:
- Spack: 0.17.1-1106-c1b51d6
- Python: 3.6.8
- Platform: linux-rhel7-power9le
- Concretizer: original
This issue was probably uncovered when the spack paraview package switched to Ninja here.
spack install paraview@5.9.0%xl_r@16.1 +hdf5+mpi+osmesa~python+python3
fails with:
.../spack-stage-paraview-5.9.0-fo24sqscp65vc3a6ymzl2lwkdf6iq5sm/spack-build-fo24sqs/bin/vtkWrapHierarchy-pv5.9: error while loading shared libraries: libvtkWrappingTools-pv5.9.so.1: cannot open shared object file: No such file or directory
I believe the cause of this is CMake/Ninja is using .rsp
(Response Files) for the link commands (@CMakeFiles/WrapHierarchy.rsp). The full link command is:
[10/18175] : && /vast/home/stam/projects/pilotlight/tests/spack/tmp_darwin_5.9.0_xl_r_16.1/spack/lib/spack/env/xl_r/xlc_r -g @CMakeFiles/WrapHierarchy.rsp -o bin/vtkWrapHierarchy-pv5.9 && :
Somehow, the quotes being added to this file, or paraview's handling of the quotes in this file is incorrect. It results in an incorrect RPATH (with "$ORIGIN) in the bin/vtkWrapHierarchy-pv5.9
executable:
$ ldd bin/vtkWrapHierarchy-pv5.9
linux-vdso64.so.1 => (0x0000200000050000)
libvtkWrappingTools-pv5.9.so.1 => not found
$ readelf -d bin/vtkWrapHierarchy-pv5.9
...
0x000000000000000f (RPATH) Library rpath: [/projects/opt/ppc64le/ibm/xlc-16.1.1.7/lib:/projects/opt/ppc64le/ibm/xlc-16.1.1.7/xlC/16.1.1/lib:.../projects/opt/ppc64le/p9/gcc/8.3.0/lib64:"$ORIGIN/../lib64:...
...
If I manually edit build.ninja
and remove the quotes there, or if I chrpath
/patchelf
and remove the quotes from this executable, the build continues until it tries to use a different binary with the same problem.
Relevant build.ninja
line with quotes around origin rpath:
build bin/vtkWrapHierarchy-pv5.9: C_EXECUTABLE_LINKER__WrapHierarchy_RelWithDebInfo VTK/Wrapping/Tools/CMakeFiles/WrapHierarchy.dir/vtkWrapHierarchy.c.o | lib64/libvtkWrappingTools-pv5.9.so.5.9 || lib64/libvtkWrappingTools-pv5.9.so lib64/libvtkWrappingTools-pv5.9.so
FLAGS = -g
LINK_LIBRARIES = -Wl,-rpath,"\$$ORIGIN/../lib64:...::" lib64/libvtkWrappingTools-pv5.9.so.5.9