[vtkusers] Installing VTK 5.0 on Mac OSX 10.4.6

Mike Jackson imikejackson at gmail.com
Fri May 12 14:56:18 EDT 2006


You also need to link against the vtk libs. I don't see those
arguments in your command line compile. I think those are the "-L" for
what directory to look for libraries and "-l" to tell g++ what
libraries to link against. so something line g++ test.cpp
-I/usr/local/include/vtk-5.0 -L/Develop/VTKBuild/bin -lvtkCommon
-lvtkFiltering -lvtkRendering ......

To add the libraries to your xcode project drag them from the Finder
into your Xcode project. Xcode should add them to your target as
libraries to link against. The reason you are getting the runtime
error in Xcode is because XCode is using "Zero Link" by default to
lazily link against the Libraries. You can open up the build settings
window for your target and uncheck this option. It is in the same
place that you added the Include files.

Mike

On 5/12/06, Siddartha Krishnan <sidd.krish at gmail.com> wrote:
> Hi,
> Thanks for your help, I recompiled vtk and used make install and now /
> usr/local/include /vtk-5.0 exists. However, when I now try to run the
> sample code, I get the following errors:
>
> mie-13-4:~ siddarthakrishnan$ g++ test.cpp -I/usr/local/include/vtk-5.0
> In file included from /usr/include/c++/4.0.0/backward/strstream:51,
>                   from /usr/local/include/vtk-5.0/vtkIOStream.h:36,
>                   from /usr/local/include/vtk-5.0/vtkSystemIncludes.h:
> 40,
>                   from /usr/local/include/vtk-5.0/vtkIndent.h:24,
>                   from /usr/local/include/vtk-5.0/vtkObjectBase.h:43,
>                   from /usr/local/include/vtk-5.0/vtkObject.h:41,
>                   from /usr/local/include/vtk-5.0/vtkProperty.h:31,
>                   from test.cpp:1:
> /usr/include/c++/4.0.0/backward/backward_warning.h:32:2: warning:
> #warning This file includes at least one deprecated or antiquated
> header. Please consider using one of the 32 headers found in section
> 17.4.1.2 of the C++ standard. Examples include substituting the <X>
> header for the <X.h> header for C++ includes, or <iostream> instead
> of the deprecated header <iostream.h>. To disable this warning use -
> Wno-deprecated.
> /usr/bin/ld: Undefined symbols:
> vtkProperty::SetColor(double, double, double)
> vtkRenderer::New()
> vtkRenderer::AddActor(vtkProp*)
> vtkRenderWindow::New()
> vtkSphereSource::New()
> vtkPolyDataMapper::New()
> vtkPolyDataMapper::SetInput(vtkPolyData*)
> vtkPolyDataAlgorithm::GetOutput()
> vtkRenderWindowInteractor::SetRenderWindow(vtkRenderWindow*)
> vtkRenderWindowInteractor::New()
> vtkActor::GetProperty()
> vtkActor::New()
> collect2: ld returned 1 exit status
>
> and in Xcode I get the following error:
>
> Session started at 2006-05-12 14:06:37 -0400.]
> ZeroLink: unknown symbol '__ZN15vtkSphereSource3NewEv'
>
> VTKTEST has exited due to signal 6 (SIGABRT).
>
> I'm not sure what these errors mean.
> Thanks for the help,
>
> Sidd
>
>
> Also, The source code for the sample file is:
>
> #include <iostream>
>
> #include "vtkProperty.h"
> #include "vtkSphereSource.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkActor.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindowInteractor.h"
>
> int main ()
> {
>
>    // create sphere geometry
>    vtkSphereSource *sphere = vtkSphereSource::New();
>    sphere->SetRadius(1.0);
>    sphere->SetThetaResolution(18);
>    sphere->SetPhiResolution(18);
>
>    // map to graphics library
>    vtkPolyDataMapper *map = vtkPolyDataMapper::New();
>    map->SetInput(sphere->GetOutput());
>
>    // actor coordinates geometry, properties, transformation
>    vtkActor *aSphere = vtkActor::New();
>    aSphere->SetMapper(map);
>    aSphere->GetProperty()->SetColor(0,0,1); // sphere color blue
>
>    // a renderer and render window
>    vtkRenderer *ren1 = vtkRenderer::New();
>    vtkRenderWindow *renWin = vtkRenderWindow::New();
>    renWin->AddRenderer(ren1);
>
>    // an interactor
>    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>    iren->SetRenderWindow(renWin);
>
>    // add the actor to the scene
>    ren1->AddActor(aSphere);
>    ren1->SetBackground(1,1,1); // Background color white
>
>    // render an image (lights and cameras are created automatically)
>    renWin->Render();
>
>    // begin mouse interaction
>    iren->Start();
>
>    return 0;
> }
>
>
> On 11-May-06, at 5:03 PM, Mike Jackson wrote:
>
> > On 5/11/06, Siddartha Krishnan <sidd.krish at gmail.com> wrote:
> >> Hi again,
> >> Thanks for your prompt replies. I corrected the alias line to alias
> >> vtk='${VTKBUILD}/bin/vtk'
> >>
> >> However, the headers still cannot be found:
> >> main.cpp:3:29: error: vtkSphereSource.h: No such file or directory
> >> main.cpp:4:31: error: vtkPolyDataMapper.h: No such file or directory
> >> main.cpp:5:22: error: vtkActor.h: No such file or directory
> >> main.cpp:6:29: error: vtkRenderWindow.h: No such file or directory
> >> main.cpp:7:25: error: vtkRenderer.h: No such file or directory
> >> main.cpp:8:39: error: vtkRenderWindowInteractor.h: No such file or
> >> directory
> >>
> >> I tried both using the command line and XCode (after changing the
> >> Header Search Paths), but still get these messages.
> >> Are there any other suggestions to solve this problem?
> >>
> >> Thanks.
> >>
> >>
> >>
> >> On 11-May-06, at 4:06 PM, Mike Jackson wrote:
> >>
> >> > On 5/11/06, Siddartha Krishnan <sidd.krish at gmail.com> wrote:
> >> >> Hi,
> >> >>
> >> >> I relatively new to Mac OSX and am having trouble setting up
> >> VTK 5.0
> >> >> on OSX 10.4.6. I used cmake to build vtk and it did so without any
> >> >> errors, but cannot seem to run the sample code on the vtk.org
> >> site.
> >> >> I get the following errors:
> >> >>  <snip>
> >> >> export VTKBUILD=/Develop/VTKBuild
> >> >> export VTKSOURCE=/Develop/VTK
> >> >> export TCLLIBPATH=${VTKSOURCE}/Wrapping/Tcl:
> >> >> export PYTHONPATH=${VTKSOURCE}/Wrapping/Python:${VTKBUILD}
> >> >> export DYLD_LIBRARYN32_PATH=${VTKBUILD}
> >> >> alias vtk ${VTKBUILD}/bin/vtk
> >> >>
> >> >> but whenever I try to source .profile, the following errors occur:
> >> >> -bash: alias: vtk: not found
> >> >> -bash: alias: /Develop/VTKBuild/bin/vtk: not found
> >> >>
> >> >> These files do exist.
> >> >>
> >> >> I would appreciate any help I can get.
> >> >> Thanks in Advance,
> >> >>
> >> >> Sidd
> >> >>
> >> >
> >> > I also run bash as my shell but I make an alias like the following:
> >> >
> >> > alias vtk='${VTKBUILD}/bin/vtk'
> >> >
> >> > Are you trying to compile from the command line or in Xcode? If you
> >> > are in Xcode you will probably have to set the Header Search
> >> Paths to
> >> > find the VTK Headers.
> >> >
> >> > If you do a "make install" for VTK, I think that is where it
> >> will dump
> >> > all the headers in /usr/local/include/vtk-5.0
> >> >
> >> > If you want to contiue to use cmake from the command line it
> >> does work
> >> > pretty good on OS X, assuming you do NOT need to build for multiple
> >> > Architectures.
> >> > --
> >> > Mike Jackson
> >> > imikejackson _at_ gee-mail dot com
> >>
> >
> > Well,
> >     I no expert on compiling from the command line. I know there is
> > the -I flag that should point to the vtk Headers. If you are
> > referencing the headers in the /Develop/VTK location, note that the
> > headers are broken into several different directories ( Common.
> > Filtering, Graphics....) so you will need an include path for EACH
> > directory that you are using headers from. So for example,
> > vtkSphereSource is in Graphics and vtkPolyDataMapper is in Rendering.
> >   The same idea goes for Xcode. In Xcode disclose the "Targets" group
> > to show all your targets. Double Click on the target you are trying to
> > build. Then click on the "Build" tab. Now look down the list for the
> > "User Header Search Path". Edit the value next to the setting using a
> > SPACE delimited set of paths that point to the include directories.
> >
> > The easiest way to set this up is to do a "make install". I _think_
> > (some one correct me here) that will just make a single directory down
> > in /usr/local/include named "vtk-5.0" and put ALL the headers in
> > there. That way you only need to spell out ONE include directory for
> > ALL the VTK headers.
> >
> > Also, if you are having troubles with Xcode itself, then I might
> > suggest trying:
> >
> > http://www.lists.apple.com/mailman/listinfo/xcode-users
> >
> > Hope that helps.
> > --
> > Mike Jackson
> > imikejackson _at_ gee-mail dot com
>
>


-- 
Mike Jackson
imikejackson _at_ gee-mail dot com



More information about the vtkusers mailing list