[vtkusers] Solution : VTK compilation on Mac OS X with the Java Wrapping

Mike Jackson imikejackson at gmail.com
Mon Nov 12 15:03:32 EST 2007


NO NO NO NO.. Editing the link.txt is NOT necessary. You need to  
correct some settings from CMake/VTK:

JAVA_ARCHIVE                    */usr/bin/jar
JAVA_AWT_INCLUDE_PATH           */System/Library/Frameworks/ 
JavaVM.framework/Headers
JAVA_COMPILE                    */usr/bin/javac
JAVA_INCLUDE_PATH               */System/Library/Frameworks/ 
JavaVM.framework/Headers
JAVA_INCLUDE_PATH2              */System/Library/Frameworks/ 
JavaVM.framework/Headers
JAVA_RUNTIME                    */usr/bin/java
VTK_PARSE_JAVA_EXE              */Users/Shared/OpenSource/vtk503-gcc/ 
bin/vtkParseJava
VTK_WRAP_HINTS                  */Users/Shared/OpenSource/VTK-5.0.3/ 
Wrapping/hints
VTK_WRAP_JAVA_EXE               */Users/Shared/OpenSource/vtk503-gcc/ 
bin/vtkWrapJava

The proper solution is here
<http://www.vtk.org/pipermail/vtkusers/2007-January/089333.html>

Please use that solution. It _Should_ work as advertised.


Also, note that as of CMake 2.4.7 the FindJNI.cmake file is _still_  
wrong after 10 months and a promised fix. IMO the FindJNI.cmake file  
should be patched to be:
----- Existing ------------
IF(EXISTS ~/Library/Frameworks/JavaVM.framework)
     SET(JAVA_HAVE_FRAMEWORK 1)
   ENDIF(EXISTS ~/Library/Frameworks/JavaVM.framework)
   IF(EXISTS /Library/Frameworks/JavaVM.framework)
     SET(JAVA_HAVE_FRAMEWORK 1)
   ENDIF(EXISTS /Library/Frameworks/JavaVM.framework)

------- Patched -----------
IF(EXISTS /System/Library/Frameworks/JavaVM.framework)
   SET(JAVA_HAVE_FRAMEWORK 1)
ENDIF(EXISTS /System/Library/Frameworks/JavaVM.framework)

Which should pretty much _always_ exist. I can not think of a system  
where that framework would NOT exist. And it certainly should NOT be  
in /Library/Frameworks or the users or Library/Frameworks folder, at  
under any scenario that I can think of. If someone has a scenario  
where the JavaVM.framework was located outside of /System/Library/ 
Frameworks I would like to know.


-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Nov 12, 2007, at 2:40 PM, Sebastien Jourdain wrote:

> Hello,
>
> I just wanted to post a solution to a common problem where it is  
> difficult to find a clear answear.
> I've also  updated the wiki to explain the tricky part here http:// 
> www.vtk.org/Wiki/Cocoa_VTK
>
> So if you want to compile VTK on Mac OS X with the Java Wrapping  
> you might get an error like the following one:
>
> /building shared library ///usr/local/src/VTK/bin/ 
> libvtkRenderingJava.dylib...
> l//d: Undefined symbols:
> //_JAWT_GetAWT
>
> If so just add at the end of the line of the file Rendering/ 
> CMakeFiles/vtkRenderingJava.dir/link.txt
> the following text without the double quote: "-framework JavaVM"
> => Thanks to /*Mike Jackson : http://www.vtk.org/pipermail/vtkusers/ 
> 2007-January/089156.html*
>
>
> The full procedure is described below:
>
> Download : http://www.vtk.org/files/release/5.0/vtk-5.0.3.tar.gz
>
> cd MY_INSTALL_VTK
> tar xvfz vtk-5.0.3.tar.gz
> mkdir build
> mkdir bin
> cd build
> ccmake -i ../VTK
>
> ####### CMake Config ########
> BUILD_SHARED_LIBS            ON
> VTK_USE_CARBON                OFF
> VTK_USE_COCOA                   ON
> VTK_USE_RENDERING          ON
> VTK_USE_RPATH                    ON
> VTK_WRAP_JAVA                   ON
> CMAKE_INSTALL_PREFIX    MY_INSTALL_VTK/bin
> ###########################
>
> make
>
> IF YOU GET THE Undefined symbols:/ _JAWT_GetAWT/  ERROR
> edit the file Rendering/CMakeFiles/vtkRenderingJava.dir/link.txt  
> and add : -framework JavaVM
> at the end of the line. Then keep going.
>
> make
> make install
>
> Seb
>
> PS: On the CVS I have a problem with the compilation on the C++/ 
> ObjectiveC layer for the rendering.
> If someone has a clue how to solve this error, he's welcome...
>
> This is the error that I get with the CVS code when I compile  
> without the java wrapping.
>
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm: In  
> member function 'virtual const char*  
> vtkCocoaRenderWindow::ReportCapabilities()':
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:206:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:209:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:212:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:215:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:218:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:221:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:224:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:227:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:230:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm: In  
> member function 'virtual int vtkCocoaRenderWindow::SupportsOpenGL()':
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:256:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm: In  
> member function 'virtual int vtkCocoaRenderWindow::IsDirect()':
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:275:  
> error: invalid conversion from 'GLint*' to 'long int*'
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm: In  
> member function 'void vtkCocoaRenderWindow::CreateGLContext()':
> /Users/seb/latest-src/VTK/Rendering/vtkCocoaRenderWindow.mm:591:  
> error: invalid conversion from 'GLint*' to 'const long int*'
> make[2]: *** [Rendering/CMakeFiles/vtkRendering.dir/ 
> vtkCocoaRenderWindow.o] Error 1
> make[1]: *** [Rendering/CMakeFiles/vtkRendering.dir/all] Error 2
> make: *** [all] Error 2
> _______________________________________________
> 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




More information about the vtkusers mailing list