[vtkusers] VTK on Mac: vtkgl.h error

Vivek Dwivedi vivekd at mail630.gsfc.nasa.gov
Mon Jul 10 12:15:10 EDT 2006


Hi I don't think your pointing to the correct OpenGL libraries.  Take  
a look at the tutorial I wrote for compiling VTK with Java Wrappings  
for Tiger:

-Vivek

Compiling VTK 5.0 for OS X Tiger 10.4.x with Java Wrappings



STEP 1:  Downloading Software



1. Java:  Make sure your JAVA is update go to your terminal app and  
type:

java -version



You should have at least build 1.5



2.  Download the CMAKE Darwin Universal binary (Tiger only  
installer ) from:

http://www.cmake.org/HTML/Download.html



Install CMAKE by double clicking on the icon



3. Download the VTK source from:

  http://vtk.org/get-software.php



(Note:  The Latest Release (5.0.0) does not allow the java wrapping  
to work you need to get the source code via the CVS source-code  
repository)



Open the terminal app.  cd to /Users/user-name

type the following:



cvs -d :pserver:anonymous at public.kitware.com:/cvsroot/VTK login
(respond with password vtk)



cvs -d :pserver:anonymous at public.kitware.com:/cvsroot/VTK checkout VTK

You will see the source code and corresponding folders downloading in  
to a new folder called VTK

cd to that folder in my case the folder path is /Users/vivekd/VTK

STEP 2: Compiling VTK

1) Type ccmake ../vtk

2) Type c

3) Edit the list of options with the following:

BUILD_EXAMPLES                                                        
ON                                                                       
                                                       
BUILD_SHARED_LIBS                                                     
ON                                                                       
                                                       
CMAKE_BACKWARDS_COMPATIBILITY                 
2.4                                                                      
                                                       
CMAKE_BUILD_TYPE                                                         
                                                                         
                CMAKE_INSTALL_PREFIX                              / 
usr/ 
local                                                                    
                                                
CMAKE_OSX_ARCHITECTURES                       
ppc                                                                      
                                                       
CMAKE_OSX_SYSROOT                /Developer/SDKs/ 
MacOSX10.4u.sdk                                                          
                                       
VTK_DATA_ROOT                                                         
VTK_DATA_ROOT- 
NOTFOUND                                                                 
                                         
VTK_USE_CARBON                                                        
OFF                                                                      
                                                       
VTK_USE_COCOA                                                         
OFF                                                                      
                                                       
VTK_USE_FFMPEG_ENCODER                                    
OFF                                                                      
                                                       
VTK_USE_PARALLEL                                                      
OFF                                                                      
                                                       
VTK_USE_RENDERING                                  
ON                                                                       
                                                       
VTK_USE_RPATH                                                         
ON                                                                       
                                                       
VTK_USE_X                                                             
ON                                                                       
                                                       
VTK_WRAP_JAVA                                                         
ON                                                                       
                                                       
VTK_WRAP_PYTHON                                           
OFF                                                                      
                                                       
VTK_WRAP_TCL                                                         OFF

4) Type c

5) Type t for advanced options:  Change the following

JAVACOMMAND

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java



JAVA_ARCHIVE

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/jar



JAVA_AWT_INCLUDE_PATH

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Headers



JAVA_AWT_LIBRARY

-framework JavaVM -framework JavaEmbedding



JAVA_COMPILE

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/javac



JAVA_INCLUDE_PATH

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Headers



JAVA_INCLUDE_PATH2

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Headers



JAVA_RUNTIME

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java

OPENGL_INCLUDE_DIR:PATH=/usr/X11R6/include



OPENGL_gl_LIBRARY:STRING=-framework OpenGL



OPENGL_glu_LIBRARY:STRING=-framework AGL

6) Type c then Type g

STEP 3:  Editing build.make

Go to  VTK/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/
Using Text edit open the build.make file
Change the following:
cd /Users/vivekd/vtk/Wrapping/Java && /System/Library/Frameworks/ 
JavaVM.framework/Versions/1.5/Commands/javac -classpath /Users/vivekd/ 
vtk/java/vtk/.. -d /Users/vivekd/vtk/java/vtk/.. /Users/vivekd/vtk/ 
java/vtk/vtkBuildAllDriver.java

to

cd /Users/vivekd/vtk/Wrapping/Java && /System/Library/Frameworks/ 
JavaVM.framework/Versions/1.5/Commands/javac -J-Xmx256m -classpath / 
Users/vivekd/vtk/java/vtk/.. -d /Users/vivekd/vtk/java/vtk/.. /Users/ 
vivekd/vtk/java/vtk/vtkBuildAllDriver.java

STEP 4:  MAKE

At the command prompt in your terminal application go to the VTK  
directory in my case it is at /Users/vivekd/VTK

Type make and wait, on a MAC G5 it takes about 25 minutes to build  
the application.



STEP 5:  Editing or creating .tcshrc

My shell is the T shell.

You need to tell java where your .dylib and vtk.jar file is located

1) If you don’t have a .tcshrc file type emacs .tcshrc file

2) Add the following lines

setenv DYLD_LIBRARY_PATH /Users/vivekd/VTK/bin

setenv CLASSPATH .:/Users/vivekd/VTK/bin/vtk.jar

don’t forget the .: before the path to the vtk.jar file

3) exit emacs by typing ctrl x then ctrl c it will ask you if you  
want to save type y and hit return

4) at the command prompt type source .tcshrc

5) check to see if the paths were added by typing env

  STEP 6:  Testing with an example

Make sure you are in X11

Go to the Java examples which are located at /Users/vivekd/VTK/ 
Examples/Tutorials/Step*/Java

Type javac Step*.java

Type java Step*

* = 1,2,3,4,5
















On Jul 10, 2006, at 11:56 AM, Martin Baumann wrote:

> Hi,
>
> I get the following errors compiling VTK-5.0 on a Mac system:
>
> .../Rendering/vtkgl.h error: 'Display' was not declared in this scope
> .../Rendering/vtkgl.h error: 'dpy' was not declared in this scope
> .../Rendering/vtkgl.h error: expected primary-expression before  
> "drawable"
> .../Rendering/vtkgl.h error: expected primary-expression before  
> "target_sbc"
>
> Did anyone have similar problems?
> Any ideas what to do?
>
> Regards, M.B.
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on- 
> topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060710/e6ac9e9c/attachment.htm>


More information about the vtkusers mailing list