Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 574890

Summary: sci-libs/vtk-6.1.0-r1 linker error
Product: Gentoo/Alt Reporter: Jeffrey Ratcliffe <Jeffrey.Ratcliffe>
Component: Prefix SupportAssignee: Gentoo Prefix <prefix>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jeffrey Ratcliffe 2016-02-16 14:51:00 UTC
sci-libs/vtk-6.1.0-r1 emerges without problem. However:

$ python
Python 2.7.11 (default, Feb  5 2016, 12:57:24)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jeff/gentoo/usr/lib/python2.7/site-packages/vtk/__init__.py", line 115, in <module>
    from vtkRenderingQt import *
  File "/home/jeff/gentoo/usr/lib/python2.7/site-packages/vtk/vtkRenderingQt.py", line 1, in <module>
    from vtkRenderingQtPython import *
ImportError: /home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1: undefined symbol: _ZNK19QAbstractProxyModel8itemDataERK11QModelIndex


Reproducible: Always




Indeed:

$ ldd -r ../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1 | grep lib64
../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1: /usr/lib64/libz.so.1: no version information available (required by /home/jeff/gentoo/usr/lib/libpng16.so.16)
        libQtGui.so.4 => /usr/lib64/qt4/lib64/libQtGui.so.4 (0x00002af93bf32000)
        libQtNetwork.so.4 => /usr/lib64/qt4/lib64/libQtNetwork.so.4 (0x00002af93c834000)
        libQtCore.so.4 => /usr/lib64/qt4/lib64/libQtCore.so.4 (0x00002af93ca92000)
        libm.so.6 => /lib64/libm.so.6 (0x00002af9412a0000)
        libc.so.6 => /lib64/libc.so.6 (0x00002af941523000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002af9426fd000)
        libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00002af942902000)
        libz.so.1 => /usr/lib64/libz.so.1 (0x00002af942b26000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002af942d3a000)
        libXi.so.6 => /usr/lib64/libXi.so.6 (0x00002af942f56000)
        libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00002af94315f000)
        libXrandr.so.2 => /usr/lib64/libXrandr.so.2 (0x00002af943368000)
        libXcursor.so.1 => /usr/lib64/libXcursor.so.1 (0x00002af94356b000)
        libXinerama.so.1 => /usr/lib64/libXinerama.so.1 (0x00002af943776000)
        libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00002af943978000)
        libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00002af943bfc000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003c53a00000)
        libexpat.so.0 => /lib64/libexpat.so.0 (0x00002af947322000)
        librt.so.1 => /lib64/librt.so.1 (0x00002af947950000)
symbol inflateReset2, version ZLIB_1.2.3.4 not defined in file libz.so.1 with link time reference       (/home/jeff/gentoo/usr/lib/libpng16.so.16)
undefined symbol: _ZNK19QAbstractProxyModel8itemDataERK11QModelIndex    (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN19QAbstractProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE      (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZNK18QStandardItemModel9mimeTypesEv  (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZNK18QStandardItemModel8mimeDataERK5QListI11QModelIndexE     (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN18QStandardItemModel12dropMimeDataEPK9QMimeDataN2Qt10DropActionEiiRK11QModelIndex  (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN11QVectorData10reallocateEPS_iii   (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN18QAbstractItemModel13endResetModelEv      (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN9QHashData12allocateNodeEi (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN9QListData11detach_growEPii        (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN9QHashData11free_helperEPFvPNS_4NodeEE     (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN9QListData6detachEi        (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN18QAbstractItemModel15beginResetModelEv    (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN9QHashData14detach_helper2EPFvPNS_4NodeEPvEPFvS1_Eii       (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN11QVectorData4freeEPS_i    (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN8QPainter9drawImageERK7QPointFRK6QImage    (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _Z9qBadAllocv (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN8QVariantC1EiPKvj  (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)
undefined symbol: _ZN11QVectorData8allocateEii  (../../image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1)

However, if I look at the library before it is installed:

$ ldd -r lib/libvtkGUISupportQt.so.1 | grep lib64
        libm.so.6 => /lib64/libm.so.6 (0x00002b67e4754000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b67e49d7000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002b67e5bb1000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b67e5db6000)
        librt.so.1 => /lib64/librt.so.1 (0x00002b67e61d4000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003c53a00000)

But stripping itself is not the problem:

$ x86_64-pc-linux-gnu-strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version lib/libvtkGUISupportQt.so.1 -o lib/libvtkGUISupportQt.so.1-stripped
$ ldd -r lib/libvtkGUISupportQt.so.1 | grep lib64
        libm.so.6 => /lib64/libm.so.6 (0x00002b1303d10000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b1303f93000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002b130516d000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b1305372000)
        librt.so.1 => /lib64/librt.so.1 (0x00002b1305790000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003c53a00000)
$ ldd -r lib/libvtkGUISupportQt.so.1-stripped | grep lib64
        libm.so.6 => /lib64/libm.so.6 (0x00002b3554e7c000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b35550ff000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00002b35562d9000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b35564de000)
        librt.so.1 => /lib64/librt.so.1 (0x00002b35568fc000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003c53a00000)

Any pointers would be most welcome.
Comment 1 Jeffrey Ratcliffe 2016-02-16 15:12:35 UTC
The symbol is defined in the qt in prefix, so I assume that for some reason, the libraries in this directory are not being searched in this case:

$ scanelf -s _ZNK19QAbstractProxyModel8itemDataERK11QModelIndex /home/jeff/gentoo/usr/lib/qt4/
 TYPE   SYM FILE
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtCore.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtXml.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtNetwork.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtScript.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtSql.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtXmlPatterns.so.4.8.7
ET_DYN _ZNK19QAbstractProxyModel8itemDataERK11QModelIndex /home/jeff/gentoo/usr/lib/qt4/libQtScriptTools.so.4.8.7
ET_DYN _ZNK19QAbstractProxyModel8itemDataERK11QModelIndex /home/jeff/gentoo/usr/lib/qt4/libQtGui.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtSvg.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtOpenGL.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtDeclarative.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtWebKit.so.4.10.4
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtDesignerComponents.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtDesigner.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtHelp.so.4.8.7
ET_DYN  -  /home/jeff/gentoo/usr/lib/qt4/libQtCLucene.so.4.8.7
Comment 2 Jeffrey Ratcliffe 2016-02-16 15:22:18 UTC
Interestingly running strace python -c "import vtk", it does go looking for the correctly library, but not in the right place:

open("/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/jeff/gentoo/usr/lib/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/jeff/gentoo/lib/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=154450, ...}) = 0
mmap(NULL, 154450, PROT_READ, MAP_PRIVATE, 6, 0) = 0x2acdf7e58000
close(6)                                = 0
open("/usr/lib64/qt4/lib64/libQtGui.so.4", O_RDONLY) = 6
Comment 3 Jeffrey Ratcliffe 2016-02-16 15:29:22 UTC
With a basic PyQt4 program, it finds the library:

open("/home/jeff/gentoo/usr/lib/qt4/tls/x86_64/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/jeff/gentoo/usr/lib/qt4/tls/x86_64", 0x7fff3a41f4d0) = -1 ENOENT (No such file or directory)
open("/home/jeff/gentoo/usr/lib/qt4/tls/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/jeff/gentoo/usr/lib/qt4/tls", 0x7fff3a41f4d0) = -1 ENOENT (No such file or directory)
open("/home/jeff/gentoo/usr/lib/qt4/x86_64/libQtGui.so.4", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/jeff/gentoo/usr/lib/qt4/x86_64", 0x7fff3a41f4d0) = -1 ENOENT (No such file or directory)
open("/home/jeff/gentoo/usr/lib/qt4/libQtGui.so.4", O_RDONLY) = 4
Comment 4 Fabian Groffen gentoo-dev 2016-02-16 18:32:37 UTC
can you please try re-emerging binutils-config-5 and re-emerging vtk?
Comment 5 Jeffrey Ratcliffe 2016-02-17 13:14:47 UTC
Thanks for the help.

I re-emerged binutils-config and then gcc-config for good measure. vtk then wouldn't even emerge, stopping right at the beginning of configure, looking for symbols in from libstdc++.so.6 and not finding them in the host.

I then re-emerged gcc (which took me coincidently from 4.8.4->4.8.5). I was then able to re-emerge vtk, but still cannot import vtk from python, failing with the same error as before.
Comment 6 Fabian Groffen gentoo-dev 2016-02-17 14:02:56 UTC
what does scanelf --rpath /home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1 return?
Comment 7 Jeffrey Ratcliffe 2016-02-17 14:13:28 UTC
$ scanelf --rpath /home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1
 TYPE   RPATH FILE
ET_DYN /home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/usr/lib:/home/jeff/gentoo/lib:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/lib:/home/jeff/gentoo/usr/lib /home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1
Comment 8 Fabian Groffen gentoo-dev 2016-02-17 15:07:52 UTC
ok, so it's built wrong, because it doesn't include the rpath entry to where the qt lib it needs is supposed to be
Comment 9 Jeffrey Ratcliffe 2016-02-17 15:35:06 UTC
From my understanding, the libraries are first built, then stripped, then copied to the image directory before they are merged. From what I can tell, the qt directory is in the path after being built and stripped, but not in the image:

$ scanelf --rpath /scratch/portage/sci-libs/vtk-6.1.0-r2/work/vtk-6.1.0_build/lib/libvtkGUISupportQt.so.1 /scratch/portage/sci-libs/vtk-6.1.0-r2/work/vtk-6.1.0_build/lib/libvtkGUISupportQt.so.1-stripped /scratch/portage/sci-libs/vtk-6.1.0-r2/image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1
 TYPE   RPATH FILE
ET_DYN /scratch/portage/sci-libs/vtk-6.1.0-r2/work/vtk-6.1.0_build/lib:/home/jeff/gentoo/usr/lib/qt4:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/usr/lib:/home/jeff/gentoo/lib::/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/lib:/home/jeff/gentoo/usr/lib /scratch/portage/sci-libs/vtk-6.1.0-r2/work/vtk-6.1.0_build/lib/libvtkGUISupportQt.so.1
ET_DYN /scratch/portage/sci-libs/vtk-6.1.0-r2/work/vtk-6.1.0_build/lib:/home/jeff/gentoo/usr/lib/qt4:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/usr/lib:/home/jeff/gentoo/lib::/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/lib:/home/jeff/gentoo/usr/lib /scratch/portage/sci-libs/vtk-6.1.0-r2/work/vtk-6.1.0_build/lib/libvtkGUISupportQt.so.1-stripped
ET_DYN /home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/usr/lib:/home/jeff/gentoo/lib:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib/gcc:/home/jeff/gentoo/usr/x86_64-pc-linux-gnu/lib:/home/jeff/gentoo/lib:/home/jeff/gentoo/usr/lib /scratch/portage/sci-libs/vtk-6.1.0-r2/image/home/jeff/gentoo/usr/lib/libvtkGUISupportQt.so.1
Comment 10 Jeffrey Ratcliffe 2016-02-18 09:12:25 UTC
That made me look in the cmake-utils.eclass - which indeed does not include the path to the qt4 libraries:

 SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)

So I hacked the ebuild to add the qt4 path to the cmake before cmake-utils_src_install:

 sed -i "s!${EPREFIX}/usr/$(get_libdir);!${EPREFIX}/usr/$(get_libdir);${EPREFIX}/usr/$(get_libdir)/qt4;!" "${BUILD_DIR}"/gentoo_rules.cmake || die

This is a horrible, horrible hack, but python -c "import vtk" now works.

What would be a less hacky solution?
Comment 11 Larry the Git Cow gentoo-dev 2019-12-28 16:10:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dd17f5b702e2f5fd47c9ddf33bd306b1a8dffab

commit 4dd17f5b702e2f5fd47c9ddf33bd306b1a8dffab
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-12-28 16:05:59 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-12-28 16:09:54 +0000

    sci-libs/vtkdata: Remove last-rited package
    
    Closes: https://bugs.gentoo.org/542756
    Closes: https://bugs.gentoo.org/554388
    Closes: https://bugs.gentoo.org/555768
    Closes: https://bugs.gentoo.org/557974
    Closes: https://bugs.gentoo.org/574854
    Closes: https://bugs.gentoo.org/574890
    Closes: https://bugs.gentoo.org/589182
    Closes: https://bugs.gentoo.org/590640
    Closes: https://bugs.gentoo.org/612302
    Closes: https://bugs.gentoo.org/622574
    Closes: https://bugs.gentoo.org/698940
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 profiles/package.mask                 |  7 -------
 sci-libs/vtkdata/Manifest             |  1 -
 sci-libs/vtkdata/metadata.xml         |  8 --------
 sci-libs/vtkdata/vtkdata-6.1.0.ebuild | 26 --------------------------
 4 files changed, 42 deletions(-)