[vtkusers] VTK and MinGW on Windows 7

Jim Peterson jimcp at cox.net
Fri Sep 24 13:22:13 EDT 2010


Jim Peterson wrote:
>
> The good news is the System.LoadLibrary() statements work from java. 
> the problem is when I try to create my first vtk object I get:
>
> Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: 
> vtk.vtkPolyDataMapper.VTKInit()J
>    at vtk.vtkPolyDataMapper.VTKInit(Native Method)
>    at vtk.vtkObject.<init>(vtkObject.java:96)
>    at vtk.vtkAlgorithm.<init>(vtkAlgorithm.java:765)
>    at vtk.vtkAbstractMapper.<init>(vtkAbstractMapper.java:79)
>    at vtk.vtkAbstractMapper3D.<init>(vtkAbstractMapper3D.java:46)
>    at vtk.vtkMapper.<init>(vtkMapper.java:405)
>    at vtk.vtkPolyDataMapper.<init>(vtkPolyDataMapper.java:119)
>    at my.vtk.Avtk.<init>(Avtk.java:82)
>
> The source statement at the time is:
>
>    pm = new vtkPolyDataMapper();
>
> This would appear to mean the export names are not a match.
I couldn't let this go without one more look.... I noticed the link.txt 
in the .Common\CMakeFiles\vtkCommon.dir contains:

C:\MinGW\bin\mingw32-c++.exe   -Wl,--export-all-symbols   -mthreads 
-shared -o ..\bin\vtkCommon.dll 
-Wl,--out-implib,..\bin\libvtkCommon.dll.a 
-Wl,--major-image-version,5,--minor-image-version,6 
-Wl, at CMakeFiles\vtkCommon.dir\objects1.rsp -lgdi32 
..\bin\libvtksys.dll.a -lwsock32 -lgdi32 -lws2_32 -lkernel32 -luser32 
-lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

while the link.txt in the .\Common\CMakeFiles\vtkCommonJava.dir has:

C:\MinGW\bin\mingw32-c++.exe     -mthreads -shared -o 
..\bin\vtkCommonJava.dll -Wl,--out-implib,..\bin\libvtkCommonJava.dll.a 
-Wl,--major-image-version,5,--minor-image-version,6 
-Wl, at CMakeFiles\vtkCommonJava.dir\objects1.rsp -lgdi32 
..\bin\libvtkCommon.dll.a ..\bin\libvtksys.dll.a -lgdi32 -lws2_32 
-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 
-luuid -lcomdlg32 -ladvapi32

Possibly significantly missing is the -Wl,--export-all-symbols which 
could result in the Unsatisfied Link Error.

It appears the link.txt is generated by CMAKE during the Generate 
process, but I am unclear exactly where. If someone has an idea where to 
effect that change, I will test again to see if we can get MingW to 
produce Java Wrappers.

Thanks,
Jim
 



More information about the vtkusers mailing list