[vtk-developers] Fun with OS X frameworks
David Gobbi
david.gobbi at gmail.com
Wed Feb 27 18:54:40 EST 2013
I recently overcame a CMake OS X framework issue when building VTK,
a conflict between a package that I installed myself, and a package
that already existed on the system.
I have two frameworks for Tk, one that I installed, and the system one:
/Library/Frameworks/Tk.framework/ (for Tk 8.6)
/System/Library/Frameworks/Tk.framework/ (For Tk 8.5, 8.4)
My CMakeCache.txt specified the system Tk framework:
TK_LIBRARY:FILEPATH=/System/Library/Frameworks/tk.framework/
However, this just causes CMake to pass "-framework Tk" to the linker.
CMake doesn't tell the linker which of the frameworks to use (the CMake
documentation makes this clear, but I didn't read the docs until later).
It turns the linker defaulted to /Library/Frameworks/Tk.framework and
I ended up with a vtk that segfaulted when I ran it.
The solution, fortunately, was very simple. I just had to specify the
full path to the library in the framework:
TK_LIBRARY:FILEPATH=/System/Library/Frameworks/Tk.framework/Tk
or, even better,
TK_LIBRARY:FILEPATH=/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk
Obviously the same issue can pop up if you install your own python,
or in fact if you install any framework in /Library for which a system
framework already exists.
Sadly, I knew all this years ago when I was doing some builds
against tk 8.4 and others against tk 8.5. But I forgot, which is why
I had to rediscover the solution. Hopefully by writing this email, it
will help me remember for when I run into this issue in the future.
- David
More information about the vtk-developers
mailing list