FS#51611 - [vtk6] System prefers linking to vtk6 instead of vtk7 when both vtk6 and vtk are installed
Attached to Project:
Community Packages
Opened by Jakub Klinkovský (lahwaacz) - Monday, 31 October 2016, 14:23 GMT
Last edited by Florian Pritz (bluewind) - Saturday, 11 August 2018, 16:17 GMT
Opened by Jakub Klinkovský (lahwaacz) - Monday, 31 October 2016, 14:23 GMT
Last edited by Florian Pritz (bluewind) - Saturday, 11 August 2018, 16:17 GMT
|
Details
Suppose that both vtk6 and vtk packages are installed.
Compiling the example from [1] as instructed links the
resulting binary against vtk6, which is wrong since that is
the legacy version and the 7.0 version is available.
[1] http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/UniformRandomNumber $ cd UniformRandomNumber/ $ cmake . $ make $ ldd UniformRandomNumber | grep vtk libvtkDomainsChemistryOpenGL2.so.1 => /usr/lib/libvtkDomainsChemistryOpenGL2.so.1 (0x00007f5583a8d000) libvtkFiltersGeneric.so.1 => /opt/vtk6/lib/libvtkFiltersGeneric.so.1 (0x00007f558313c000) libvtkFiltersHyperTree.so.1 => /opt/vtk6/lib/libvtkFiltersHyperTree.so.1 (0x00007f5582f09000) libvtkFiltersParallelFlowPaths.so.1 => /opt/vtk6/lib/libvtkFiltersParallelFlowPaths.so.1 (0x00007f5582cde000) libvtkFiltersParallelGeometry.so.1 => /opt/vtk6/lib/libvtkFiltersParallelGeometry.so.1 (0x00007f5582aad000) libvtkFiltersParallelImaging.so.1 => /opt/vtk6/lib/libvtkFiltersParallelImaging.so.1 (0x00007f5582898000) libvtkFiltersParallelMPI.so.1 => /opt/vtk6/lib/libvtkFiltersParallelMPI.so.1 (0x00007f558266c000) libvtkFiltersParallelStatistics.so.1 => /opt/vtk6/lib/libvtkFiltersParallelStatistics.so.1 (0x00007f5582443000) libvtkFiltersProgrammable.so.1 => /opt/vtk6/lib/libvtkFiltersProgrammable.so.1 (0x00007f5582237000) libvtkFiltersPython.so.1 => /opt/vtk6/lib/libvtkFiltersPython.so.1 (0x00007f5582030000) ... The minimal reproducible example without cmake is this: $ g++ UniformRandomNumber.cxx -o UniformRandomNumber -I /usr/include/vtk/ -l vtkCommonCore $ ldd UniformRandomNumber | grep vtk libvtkCommonCore.so.1 => /opt/vtk6/lib/libvtkCommonCore.so.1 (0x00007f6101c6c000) libvtksys.so.1 => /opt/vtk6/lib/libvtksys.so.1 (0x00007f6100ddd000) Since cmake is not the issue, I guess this is due to /etc/ld.so.conf.d/vtk6.conf (provided by vtk6)? |
This task depends upon
Closed by Florian Pritz (bluewind)
Saturday, 11 August 2018, 16:17 GMT
Reason for closing: Deferred
Additional comments about closing: vtk6 has been move to AUR a while ago
Saturday, 11 August 2018, 16:17 GMT
Reason for closing: Deferred
Additional comments about closing: vtk6 has been move to AUR a while ago
It seems that I can't reproduce the problem with vtk and vtk6 installed on my system neither with cmake nor by manually compiling. Can you check if you still see the issue?
Also I believe that this should not affect the compiled program since the soname of the library is supposed to tell you if they are compatible or not. Can you check if your compiled binary also runs with vtk6 removed after compilation? In theory it should.
In any case /etc/ld.so.conf.d/vtk6.conf is likely the reason why you see this output in ldd, but I'm unsure why it doesn't happen for me too. Can you show me the output of this command for you?
> ldconfig -p | grep libvtksys.so.1
libvtksys.so.1 (libc6,x86-64) => /usr/lib/libvtksys.so.1
libvtksys.so.1 (libc6,x86-64) => /opt/vtk6/lib/libvtksys.so.1
$ ./UniformRandomNumber
./UniformRandomNumber: symbol lookup error: /usr/lib/libvtkRenderingOpenGL2.so.1: undefined symbol: _ZN17vtkPolyDataMapper6UpdateEiP20vtkInformationVector
If I compile it manually with g++ and link only the necessary libs, it runs fine (even when I uninstall vtk6).
The ldconfig command gives me the entries in the other order, which might correspond to the installation order of the two packages and hence the order in which the entries entered the cache:
$ ldconfig -p | grep libvtksys.so.1
libvtksys.so.1 (libc6,x86-64) => /opt/vtk6/lib/libvtksys.so.1
libvtksys.so.1 (libc6,x86-64) => /usr/lib/libvtksys.so.1
In any case, relying on VTK to do soname bumps properly is a big assumption. Currently all the libs in both vtk and vtk6 have soname version 1, but my issues confirm that they are not compatible.
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkMolecule::SetLattice(vtkVector3d const&, vtkVector3d const&, vtkVector3d const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkMolecule::HasLattice()'
/opt/vtk6/lib/libvtkCommonDataModel.so.1: undefined reference to `vtkDataArrayTemplate<long long>::SetArray(long long*, long long, int, int)'
/opt/vtk6/lib/libvtkCommonDataModel.so.1: undefined reference to `vtkDataArrayTemplate<int>::ResizeAndExtend(long long)'
/opt/vtk6/lib/libvtkCommonDataModel.so.1: undefined reference to `vtkDataArrayTemplate<long long>::WritePointer(long long, long long)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkAlgorithm::UpdateExtent(int const*)'
/opt/vtk6/lib/libvtkCommonExecutionModel.so.1: undefined reference to `vtkInformation::Set(vtkInformationDoubleVectorKey*, double*, int)'
/opt/vtk6/lib/libvtkCommonDataModel.so.1: undefined reference to `vtkDataArrayTemplate<long long>::ResizeAndExtend(long long)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkAlgorithm::Update(int, vtkInformationVector*)'
/opt/vtk6/lib/libvtkCommonDataModel.so.1: undefined reference to `vtkDataArrayTemplate<long long>::LookupValue(long long)'
/opt/vtk6/lib/libvtkCommonDataModel.so.1: undefined reference to `vtkDataArrayTemplate<unsigned char>::ResizeAndExtend(long long)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkMolecule::GetLattice(vtkVector3d&, vtkVector3d&, vtkVector3d&, vtkVector3d&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkAlgorithm::UpdateTimeStep(double, int, int, int, int const*)'
/opt/vtk6/lib/libvtkIOCore.so.1: undefined reference to `vtkObjectFactory::CreateInstance(char const*)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkAlgorithm::Update(vtkInformation*)'
/opt/vtk6/lib/libvtkCommonExecutionModel.so.1: undefined reference to `vtkInformation::Set(vtkInformationIntegerVectorKey*, int*, int)'
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libvtkIOLegacy.so: undefined reference to `vtkAlgorithm::UpdatePiece(int, int, int, int const*)'
collect2: error: ld returned 1 exit status
> grep '.*' /etc/ld.so.conf /etc/ld.so.conf.d/*
/etc/ld.so.conf:#
/etc/ld.so.conf:# /etc/ld.so.conf
/etc/ld.so.conf:#
/etc/ld.so.conf:
/etc/ld.so.conf:include /etc/ld.so.conf.d/*.conf
/etc/ld.so.conf:
/etc/ld.so.conf:# End of file
/etc/ld.so.conf.d/dovecot.conf:/usr/lib/dovecot
/etc/ld.so.conf.d/fakechroot.conf:/usr/lib/libfakeroot/fakechroot/
/etc/ld.so.conf.d/fakeroot.conf:/usr/lib/libfakeroot
/etc/ld.so.conf.d/ffmpeg0.10.conf:/usr/lib/
/etc/ld.so.conf.d/ffmpeg0.10.conf:/usr/lib/ffmpeg0.10/
/etc/ld.so.conf.d/ffmpeg2.8.conf:/usr/lib/
/etc/ld.so.conf.d/ffmpeg2.8.conf:/usr/lib/ffmpeg2.8/
/etc/ld.so.conf.d/lib32-glibc.conf:/usr/lib32
/etc/ld.so.conf.d/opencascade.conf:/opt/opencascade/lib
/etc/ld.so.conf.d/openmpi.conf:/usr/lib/openmpi
/etc/ld.so.conf.d/R.conf:/usr/lib/R/lib
/etc/ld.so.conf.d/R.conf:
/etc/ld.so.conf.d/vtk6.conf:/opt/vtk6/lib
$ grep '.*' /etc/ld.so.conf /etc/ld.so.conf.d/*
/etc/ld.so.conf:#
/etc/ld.so.conf:# /etc/ld.so.conf
/etc/ld.so.conf:#
/etc/ld.so.conf:
/etc/ld.so.conf:include /etc/ld.so.conf.d/*.conf
/etc/ld.so.conf:
/etc/ld.so.conf:# End of file
/etc/ld.so.conf.d/cuda.conf:/opt/cuda/lib64
/etc/ld.so.conf.d/cuda.conf:/opt/cuda/lib
/etc/ld.so.conf.d/cuda.conf:/opt/cuda/nvvm/lib64
/etc/ld.so.conf.d/cuda.conf:/opt/cuda/nvvm/lib
/etc/ld.so.conf.d/fakeroot.conf:/usr/lib/libfakeroot
/etc/ld.so.conf.d/opencascade.conf:/opt/opencascade/lib
/etc/ld.so.conf.d/openmpi.conf:/usr/lib/openmpi
/etc/ld.so.conf.d/vtk6.conf:/opt/vtk6/lib
I'm not sure what's the best solution here though. Given the files have the same names and are not compatible, whatever we do will result in problems. Since ld.so also uses this cache and libraries are loaded using the cache, I'd expect that if you add /usr/lib to the search path you'll also get crashes. That said I didn't get any reports about such crashes yet and opencascade (dependency of freecad) seems to work without issues and I'd guess that not everyone has /usr/lib before the vtk6 path.
ldconfig parses the files in alphabetic order, so you can put "/usr/lib" in /etc/ld.so.conf.d/vtk.conf and it should work after running `ldconfig` again. I added the vtk maintainer (Anatol) so we can discuss if adding this file to the package is a good idea or if we should do something else.
So to correct myself, adding "/usr/lib" to a file that is always parsed before vtk6.conf (e.g. 00_default.conf) indeed helps.