[vtkusers] VTK on Mac: vtkgl.h error

Vivek Dwivedi vivekd at mail630.gsfc.nasa.gov
Thu Jul 13 09:15:47 EDT 2006


Martin:

The tutorial i wrote was for OS X using X-windows and Java  
Wrappings.  You need to do separate compiles for Cocoa/ X-11/Carbon.   
Make sure you get VTK 5.0 from the CVS source.

As for the OpenGL lib paths, if you are compiling for X-windows use  
the following paths:

>> OPENGL_INCLUDE_DIR:PATH=/usr/X11R6/include
>>
>>
>> OPENGL_gl_LIBRARY:STRING=-framework OpenGL
>>
>>
>> OPENGL_glu_LIBRARY:STRING=-framework AGL

-Vivek



On Jul 13, 2006, at 7:58 AM, Martin Baumann wrote:

> Vivek Dwivedi wrote:
>> 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  
>> <mailto:anonymous at public.kitware.com>:/cvsroot/VTK login *
> (respond
>> with password *vtk* )
>>
>>
>> *cvs -d :pserver:anonymous at public.kitware.com  
>> <mailto: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*
>>
>>    1. Go to  VTK/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/
>>    2. Using Text edit open the build.make file
>>    3. 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
>>
> Hi,
>
> thanks Vivek Dwivedi for your information.
> I followed your tutorial but I didn't have success.
> That means when I run 'make tests' nearly all tests fail!
>
> In my case I want to compile a program that uses Qt and VTK library.
> The program already runs under Linux and Windows. But I don't have
> any programming experiences on a Mac System.
> Do I have to use X11 / Cocoa / Carbon? From what depends which I have
> to use?
> By default CMake finds OpenGL parameters
>
> OPENGL_INCLUDE_DIR              */System/Library/Frameworks/ 
> OpenGL.framework
> OPENGL_gl_LIBRARY               */System/Library/Frameworks/ 
> OpenGL.framework
> OPENGL_glu_LIBRARY              */System/Library/Frameworks/ 
> AGL.framework
> OPENGL_xmesa_INCLUDE_DIR        *OPENGL_xmesa_INCLUDE_DIR-NOTFOUND
>
> Are these settings wrong? I changed the values to those of your  
> tutorial. But when I link my
> program to the vtk-lib I get the following warnings:
>
> /usr/bin/ld: warning suggest use of -bind_at_load, as lazy binding  
> may result in errors or different symbols being used
> symbol _glPointParameteri used from dynamic library /System/Library/ 
> Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib 
> (gll_api.o) not from earlier dynamic library /usr/X11R6/lib/libGL. 
> 1.dylib(dri_dispatch.o)
> symbol _glPointParameteriv used from dynamic library /System/ 
> Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib 
> (gll_api.o) not from earlier dynamic library /usr/X11R6/lib/libGL. 
> 1.dylib(dri_dispatch.o
>
> Also Qt comes with own OpenGL lib. Maybe I could use this for vtk?
>
> I would like to give more information on the system I am using. But  
> I don't know how to find out any.
> It is a mini mac with inter processor (dual core).
> Which OS version??? No idea how to find out.
>
> Generally, would't it be a good idea to create a section in the VTK  
> Wiki that explains how to configure
> VTK on certain operating systems? For me it was a long journey to  
> compile VTK on a Windows system, but once
> one uses the right tools it is quite simple. Maybe this could help  
> a lot of new users of VTK.
>
> Regards, M.B.




More information about the vtkusers mailing list