Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#16327 closed defect (fixed)

vtk5 5.0.3_0 +python build failure

Reported by: casbon@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: Cc: cgtobi@…, mf2k (Frank Schima), stromnov (Andrey Stromnov), truemped@…
Port: vtk5

Description

vtk5 python variant fails to build. I got the port to build with these actions:

  1. Edit the port file and set "-DBUILD_SHARED_LIBS:BOOL=ON"
  1. in .../work/VTK/CMake/CMakeLists.txt add cmake_minimum_required(VERSION 2.6) at the top of the file
  1. Add missing " in line 19 of .../work/VTK/Wrapping/Python/PythonInstall.cmake

However, even then the build does not work:

Python 2.5.2 (r252:60911, Jul 24 2008, 10:25:53) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/lib/python2.5/site-packages/vtk/__init__.py", line 29, in <module>
    from common import *
  File "/opt/local/lib/python2.5/site-packages/vtk/common.py", line 7, in <module>
    from libvtkCommonPython import *
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/vtk/libvtkCommonPython.so, 10): Library not loaded: libvtkCommonPythonD.5.0.dylib
  Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/vtk/libvtkCommonPython.so
  Reason: image not found

Change History (20)

comment:1 Changed 16 years ago by casbon@…

I got slightly further with this:

Flapjack:~ james$ export DYLD_LIBRARY_PATH=/opt/local/lib
Flapjack:~ james$ python -c "import vtk"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/lib/python2.5/site-packages/vtk/__init__.py", line 29, in <module>
    from common import *
  File "/opt/local/lib/python2.5/site-packages/vtk/common.py", line 7, in <module>
    from libvtkCommonPython import *
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/vtk/libvtkCommonPython.so, 10): Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libJPEG.dylib

but this thread suggests it is not a good idea: http://www.nabble.com/Re:--MacPorts---15891:-Undefined-symbols:-_xmlTextReaderSchemaValidate-_xmlTextReaderSchemaValidate-td18326514.html

comment:2 Changed 16 years ago by casbon@…

It works if I cd to /opt/local/lib :

Flapjack:lib james$ pwd
/opt/local/lib
Flapjack:lib james$ python -c 'import vtk'

but no combination of DYLD_LIBRARY_PATH, PYTHONPATH or PATH seems to replicate that behaviour

comment:3 Changed 16 years ago by blb@…

Milestone: Port Bugs
Owner: changed from macports-tickets@… to rene.donner@…

Assigning to maintainer.

comment:4 Changed 16 years ago by cgtobi@…

Cc: cgtobi@… added

Cc Me!

comment:5 Changed 15 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added

Cc Me!

comment:6 Changed 15 years ago by mf2k (Frank Schima)

Port: vtk5 added

I too am unable to build vtk5 +python. This is with vtk version 5.2.0. Here is my error log:

--->  Configuring vtk5
Error: Target org.macports.configure returned: shell command "cd /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_graphics_vtk5/work/VTK && LDFLAGS=\"-L/opt/local/lib\" CPPFLAGS=\"-I/opt/local/include\" MACOSX_DEPLOYMENT_TARGET=10.5 cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_LIBRARY_PATH:PATH=/opt/local/lib -DCMAKE_INCLUDE_PATH:PATH=/opt/local/include -DCMAKE_INSTALL_PREFIX:PATH=/opt/local -DCMAKE_INSTALL_NAME_DIR:STRING=/opt/local/lib -DCMAKE_EXE_LINKER_FLAGS:STRING=-rpath /opt/local/lib -DVTK_INSTALL_PREFIX:PATH=/opt/local -DVTK_USE_HYBRID:BOOL=ON -DVTK_USE_CARBON:BOOL=OFF -DVTK_WRAP_TCL:BOOL=ON -DVTK_USE_COCOA:BOOL=ON -DVTK_DATA_ROOT:PATH=/opt/local/share/VTKData -DVTK_TCL_LIBRARY_DIR:FILEPATH=/opt/local/lib/tcl8.4 -DVTK_REQUIRED_EXE_LINKER_FLAGS:STRING=-rpath /opt/local/lib -DPYTHON_DEBUG_LIBRARY:FILEPATH=/opt/local/lib/libpython2.5.dylib -DPYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python2.5 -DPYTHON_INCLUDE_PATH:FILEPATH=/opt/local/include/python2.5 -DPYTHON_LIBRARY:FILEPATH=/opt/local/lib/libpython2.5.dylib -DVTK_WRAP_PYTHON:BOOL=ON -DVTK_PYTHON_SETUP_ARGS:STRING=\"--prefix=/opt/local --root=destroot /opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_graphics_vtk5/work/VTK" returned error 1
Command output: -- Check size of short
-- Check size of short - failed
-- Check size of float
-- Check size of float - failed
-- Check size of double
-- Check size of double - failed
-- Looking for include files CMAKE_HAVE_LIMITS_H
-- Looking for include files CMAKE_HAVE_LIMITS_H - not found.
-- Looking for include files CMAKE_HAVE_UNISTD_H
-- Looking for include files CMAKE_HAVE_UNISTD_H - not found.
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.
-- Looking for include files CMAKE_HAVE_SYS_PRCTL_H
-- Looking for include files CMAKE_HAVE_SYS_PRCTL_H - not found.
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at /opt/local/share/cmake-2.6/Modules/TestBigEndian.cmake:31 (MESSAGE):
  no suitable type found
Call Stack (most recent call first):
  CMake/CMakeBackwardCompatibilityC.cmake:31 (TEST_BIG_ENDIAN)
  CMakeLists.txt:357 (INCLUDE)


-- Configuring done

Error: Status 1 encountered during processing.

comment:7 Changed 15 years ago by stromnov (Andrey Stromnov)

Cc: stromnov@… added

Cc Me!

comment:8 Changed 15 years ago by truemped@…

Hi,

I have been able to build vtk with python using above instructions but I got the exact same error as mentioned above. I then found this:

https://mail.enthought.com/pipermail/enthought-dev/2006-September/002706.html

where they say that adding "-DVTK_USE_RPATH:BOOL=ON" will remove the "import" problem.

Unfortunately I now get an error building "vtk5 +python":

Linking CXX executable ../../bin/vtkpython
ld: library not found for -lhistory
collect2: ld returned 1 exit status
make[2]: *** [bin/vtkpython] Error 1
make[1]: *** [Wrapping/Python/CMakeFiles/vtkpython.dir/all] Error 2
make: *** [all] Error 2

Any idea?

comment:9 in reply to:  8 ; Changed 15 years ago by stromnov (Andrey Stromnov)

Replying to truemped@…:

Linking CXX executable ../../bin/vtkpython
ld: library not found for -lhistory
collect2: ld returned 1 exit status
make[2]: *** [bin/vtkpython] Error 1
make[1]: *** [Wrapping/Python/CMakeFiles/vtkpython.dir/all] Error 2
make: *** [all] Error 2

Any idea?

-lhistory requires -L{prefix}/lib in make args

comment:10 Changed 15 years ago by blb@…

Cc: truemped@… added

Cc reporter of dup #17016.

comment:11 in reply to:  9 ; Changed 15 years ago by truemped@…

Replying to stromnov@…:

-lhistory requires -L{prefix}/lib in make args

In the portfile I find this:

configure.env   LDFLAGS="-L${prefix}/lib"\
   CPPFLAGS="-I${prefix}/include"

Which should be the same as you suggested, right? Or do I have to set it somewhere else again?

comment:12 in reply to:  11 ; Changed 15 years ago by stromnov (Andrey Stromnov)

Replying to truemped@…:

In the portfile I find this:

configure.env   LDFLAGS="-L${prefix}/lib"\
   CPPFLAGS="-I${prefix}/include"

Which should be the same as you suggested, right? Or do I have to set it somewhere else again?

There are weird post-configure section:

post-configure {
  reinplace "s|c++|c++ -L${prefix}/lib |" ${worksrcpath}/Infovis/Testing/Cxx/CMakeFiles/InfovisCxxTests.dir
  ...
}

Needs similar line for python bindings files.

comment:13 in reply to:  12 ; Changed 15 years ago by truemped@…

Ok, to summarize my changes to the portfile so far:

This is my 'variant' section:

variant python {
    depends_build-append    port:python25
    configure.args-delete "-DBUILD_SHARED_LIBS:BOOL=OFF"
    configure.args-append -DBUILD_SHARED_LIBS:BOOL=ON \
        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.5 \
        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/python2.5 \
        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
        -DVTK_WRAP_PYTHON:BOOL=ON \
        -DVTK_PYTHON_SETUP_ARGS:STRING="--prefix=${prefix} --root=${destdir} \
        -DVTK_USE_RPATH:BOOL=ON \
        -DVTK_USE_PARALLEL:BOOL=ON\
        -DCMAKE_BUILD_WITH_INSTALL_PATH:BOOLL=ON
}

This is my post-configure section:

post-configure {
    reinplace "s|c++|c++ -L${prefix}/lib |" ${worksrcpath}/Infovis/Testing/Cxx/CMakeFiles/InfovisCxxTests.dir/link.txt \
        ${worksrcpath}/IO/Testing/Cxx/CMakeFiles/IOCxxTests.dir/link.txt \
        ${worksrcpath}/Views/Testing/Cxx/CMakeFiles/ViewsCxxTests.dir/link.txt \
        ${worksrcpath}/Wrapping/Tcl/CMakeFiles/vtk.dir/link.txt \
        ${worksrcpath}/Wrapping/Python/CMakeFiles/vtkpython.dir/link.txt
}

I can now successfully build with "port install vtk5 +darwin_9 +python". Unfortunately there is no python package "vtk" anymore:

$ python -c "import vtk"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named vtk

Do you have another hint/idea? :)

comment:14 Changed 15 years ago by truemped@…

Another thing: after installing this all the libraries are stored in /opt/local/lib/vtk-5.2/ rather than /opt/local/lib

This basically leads to this:

$ vtk
dyld: Library not loaded: /opt/local/lib/libvtkCommonTCL.5.2.dylib
  Referenced from: /opt/local/bin/vtk
  Reason: image not found
Trace/BPT trap

and:

$ vtkpython
dyld: Library not loaded: /opt/local/lib/libvtksys.5.2.dylib
  Referenced from: /opt/local/bin/vtkpython
  Reason: image not found
Trace/BPT trap

hm...

comment:15 Changed 15 years ago by stromnov (Andrey Stromnov)

There are another bug: during destroot phase python bindings installed DIRECTLY to /opt/local/lib/python... (instead of local destroot), causing troubles with uninstallation.

comment:16 in reply to:  13 ; Changed 15 years ago by truemped@…

Please note that I am using vtk5 5.2 Portfile which is the current.

Replying to truemped@…:

I have nearly achived to install everything correctly.

This is my (updated) 'variant' section:

variant python {
    depends_build-append    port:python25
    configure.args-delete "-DBUILD_SHARED_LIBS:BOOL=OFF"
    configure.args-append -DBUILD_SHARED_LIBS:BOOL=ON \
        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.5 \
        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/python2.5 \
        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
        -DVTK_WRAP_PYTHON:BOOL=ON \
        -DVTK_PYTHON_SETUP_ARGS:STRING="--prefix=${prefix} --root=${destdir} \
        -DCMAKE_BUILD_WITH_INSTALL_PATH:BOOLL=ON
}

port install vtk5 +darwin_9 +python

Unfortunately there is no python package "vtk" anymore:

$ python -c "import vtk"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named vtk

It turns out that if you use vtkpython and set DYLD_LIBRARY_PATH="/opt/local/lib/vtk-5.2/" Python finds the vtk package.

BUT:

If you want to use the wx part of VTK:

$ DYLD_LIBRARY_PATH="/opt/local/lib/vtk-5.2/" vtkpython simpleWxScriptWithVTK.py 
This program needs access to the screen.
Please run with 'pythonw', not 'python', and only when you are logged
in on the main display of your Mac.

and:

$ DYLD_LIBRARY_PATH="/opt/local/lib/vtk-5.2/" pythonw2.5 simpleWxScriptWithVTK.py 
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap

This seems to be some SWIG issue as far as gogol told me.

Another problem is the fact that after I have built and installed vtk5 the vtk python package is not installed in the site-packages dir. This should have been done with ${workdir}/Wrappers/Python/setup.py

Anyone there who can help me?

comment:17 in reply to:  16 Changed 15 years ago by truemped@…

Replying to truemped@…:

Another problem is the fact that after I have built and installed vtk5 the vtk python package is not installed in the site-packages dir. This should have been done with ${workdir}/Wrappers/Python/setup.py

Sorry, there is a VTK-5.2.0-py2.5.egg directory containing the vtk packge; so this issue is solved :)

comment:18 Changed 15 years ago by blb@…

Owner: changed from rene.donner@… to macports-tickets@…

René no longer maintains vtk5, r44858.

comment:19 Changed 15 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: newclosed

I fixed this. Note I made +python default.

comment:20 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.