Hi everyone,

I am currently working on creating an OSGi bundle embedding VTK, the 
Visualization ToolKit (http://www.vtk.org), written in C++, on Mac OS X.

I have written an article about my adventures and the related issues I have 
encountered so far: http://dev.artenum.com/blog/ben/posts/osgi_vtk_and_macosx

The short story is that by default, the compilation configuration of VTK does 
not create and link properly the dynamic libraries on Mac OS X. I thus had to 
modify 3 things:
        • change the .dylib extensions to .jnilib
        • prepend the @loader_path prefix to the library transitive dependencies
        • remove the version numbers from the library file names and 
dependencies.

This way, I managed to execute the bundle without an UnsatisfiedLinkError with 
Equinox. I however have a new problem, that seems much more complex to me.

When the bundle starts, it creates a "vtkPanel", which extends the AWT Canvas. 
The rendering on the panel is then performed by a native method call that 
crashes.

> WARNING in native
>  method: JNI call made with exception pending
>       at vtk.vtkPanel.RenderCreate(Native Method)
>       at vtk.vtkPanel.Render(vtkPanel.java:166)
>       - locked <1060ffa88> (a vtk.vtkPanel)
>       at vtk.vtkPanel.paint(vtkPanel.java:189)
>       at sun.awt.RepaintArea.paintComponent(RepaintArea.java:276)
>       at sun.awt.RepaintArea.paint(RepaintArea.java:241)
>       at apple.awt.ComponentModel.handleEvent(ComponentModel.java:263)
>       at java.awt.Component.dispatchEventImpl(Component.java:4790)
>       at java.awt.Component.dispatchEvent(Component.java:4544)
>       at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
>       at 
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
>       at 
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
>       at 
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
>       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
>       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
>       at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> FATAL ERROR in 
> native
>  method: Bad global or local ref passed to JNI
>       at vtk.vtkPanel.RenderCreate(Native Method)
>       at vtk.vtkPanel.Render(vtkPanel.java:166)
>       - locked <1060ffa88> (a vtk.vtkPanel)
>       at vtk.vtkPanel.paint(vtkPanel.java:189)
>       at sun.awt.RepaintArea.paintComponent(RepaintArea.java:276)
>       at sun.awt.RepaintArea.paint(RepaintArea.java:241)
>       at apple.awt.ComponentModel.handleEvent(ComponentModel.java:263)
>       at java.awt.Component.dispatchEventImpl(Component.java:4790)
>       at java.awt.Component.dispatchEvent(Component.java:4544)
>       at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
>       at 
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
>       at 
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
>       at 
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
>       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
>       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
>       at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> Invalid memory access of location 0x0 rip=0x1010af1f4
> ./ben.sh: line 11: 23453 Abort trap              java -Xcheck:jni -jar 
> org.eclipse.osgi_3.6.0.v20100517.jar -console

This native method crashes when calling the jawt.h method 
GetDrawingSurfaceInfo(ds), and I have no idea where it may come from.

The pure Java (no OSGi) application works fine, so I thought it could be 
Equinox-related. This is why I tried to load the same bundle in Felix.
But here I have a new error message:

> org.osgi.framework.BundleException: Unresolved constraint in bundle 
> test-osgi-vtk [5]: No matching native libraries found.


... and nothing more (even with log level at 4).
How can I know what does not work?
What did I do that is Equinox-compatible and Felix-incompatible? I don't recall 
using specific Manifest entries...

Project source code can be downloaded here: 
http://dev.artenum.com/blog/ben/download/test-osgi-vtk_zip?action=download&nodecorator

Kind regards,

Benoît
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to