[vtkusers] Ongong woes building vtk on Mac OSX
Jens Thomas
j.m.h.thomas at dl.ac.uk
Fri Oct 1 11:06:46 EDT 2004
Hi
I'd just like to thank everybody for their advice, without which I would
almost certainly now be bald, having pullled all my hair out...
I haven't ended up doing it exactly as was suggested, as I couldn't get
it to work for me: if I tried to build the shared library from
libpython2.3a, I got:
cc -dynamiclib -all_load -framework System -framework CoreServices
-framework Foundation ./lib/python2.3/config/libpython2.3.a -o
./lib/libpython2.3.dylib -install_name ./python/lib/libpython2.3.dylib
-current_version 2.3 -compatibility_version 2.3
ld: Undefined symbols:
_environ
/usr/bin/libtool: internal link edit command failed
However, I've found an alternative and I thought I'd let people know
what I did in case it helps anyone in a similar situation, or anyone can
think of a better way around it (I've cobbled this together from all
sorts of place without a full understanding of why it all works, so a
few of the steps may be redundant).
Anyway, ..
1. I downloaded Python 2.3.4 into my home directory and configured it with:
./configure --prefix=/Users/jens/Python-2.3.4 -with-dyld
then edited the Makefile to add the following flags to BASECFLAGS:
-fno-common -fPIC
running make and make install created the Python installation in
/Users/jens/Python-2.3.4
2. I then checked out the latest CVS version of vtk to the directory
(/Users/Jens/VTK) and made it with the following (these are what I think
are the relevant bits from my CMakeCache.txt):
//Build VTK with shared libraries.
BUILD_SHARED_LIBS:BOOL=ON
//Python Framework
PYTHON_DEBUG_LIBRARY:FILEPATH=/Users/jens/Python-2.3.4lib/python2.3/config/libpython2.3.a
//Path to a program.
PYTHON_EXECUTABLE:FILEPATH=/Users/jens/Python-2.3.4/bin/python2.3
//What is the path where the file Python.h can be found
PYTHON_INCLUDE_PATH:PATH=/Users/jens/Python-2.3.4/include/python2.3
//Python Framework
PYTHON_LIBRARY:FILEPATH=/Users/jens/Python-2.3.4/lib/python2.3/config/libpython2.3.a
//Utility library needed for vtkpython
PYTHON_UTIL_LIBRARY:FILEPATH=PYTHON_UTIL_LIBRARY-NOTFOUND
//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/Users/jens/VTK_INSTALL
(I linked against the framework version of tcl and tk, which were picked
up automatically and so I haven't included these).
For some reason couldn't get ccmake to run a build outside the source
directory. I'm sure that before, I've created an empty directory (e.g
/Users/jens/VTK_INSTALL) cd'd to this and then run ccmake
/Users/jens/VTK (where VTK is the directory containing the source
files), and this has built everything in VTK_INSTALL.
However, since this didn't work, after I ran make and make install, I
had to run the command:
cmake -P cmake_install.cmake
in /Users/jens/VTK to get the stuff copied across to /Users/jens/VTK_INSTALL
I then had to cd to /Users/jens/VTK/Wrapping/Python and run the command:
/Users/jens/Python-2.3.4/bin/python2.3 setup.py install
to get the vtk into the python directory tree.
After this, I could run /Users/jens/Python-2.3.4/bin/python2.3 and get
it to import vtk fine.
Thanks again for the help,
Jens
Sander Niemeijer wrote:
>> Also ... and of possible help to you ... If you are linking static
>> objects into a dynamic library, you will likely need to compile your
>> static objects as "position independent" or "relocatable" objects.
>> Depending on your compiler, this just means adding '-fPIC', '-KPIC',
>> etc. to the compiler flags.
>
>
> You are right. I must confess that I don't really know the rationale
> anymore about why we chose the solution we chose back then (it might
> also just have been a 'it looks like it works now, so lets not touch
> it anymore' solution). Anyway we also have a patch that we apply to
> the Python package for Mac OS X.
> I will have to dig into it a bit more to figure out if what we did was
> actually the proper way to do it, but somehow we were able to create a
> working version of VTK(X11)/Python/wxPython(Gtk) in the end.
>
> If you want to have a look at the build system/patches/etc. for our
> application, you can download it for free from our website
> <http://www.science-and-technology.nl/beat/>. You should get the
> visan-1.0.0.tar.gz from the download section. This file contains the
> appropriate sources for Python/VTK/wxPython/etc. and an automatic
> build system. The Python patch I mentioned is located in the
> 'packages/patches' directory and the build options we use for building
> Python can be found in the python.mk file.
>
>
> And for Mathieu:
>
> On woensdag, sep 29, 2004, at 20:27 Europe/Amsterdam, Mathieu
> Malaterre wrote:
>
>> Could someone confirm that vtkpython doesn't work on MacOSX then ?
>
>
> It does seem to work for us (using VTK4.4 and X11).
>
> Best regards,
> Sander
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list