Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: PyVTKAddFile_vtkNIFTIWriter #20

Closed
malaterre opened this issue Jun 30, 2014 · 5 comments
Closed

undefined symbol: PyVTKAddFile_vtkNIFTIWriter #20

malaterre opened this issue Jun 30, 2014 · 5 comments

Comments

@malaterre
Copy link
Contributor

I cannot build + run vtk-dicom with the following settings:

$ export CFLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
$ export CXXFLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
$ cmake
$ make && make test
[...]
8/9 Test #9: TestDICOMJava ....................***Failed 1.21 sec
Ran the vtk-dicom Java test.
Exception in thread "main" java.lang.UnsatisfiedLinkError: vtk.vtkDICOMReader.VTKInit()J
at vtk.vtkDICOMReader.VTKInit(Native Method)
at vtk.vtkObject.(vtkObject.java:97)
at vtk.vtkAlgorithm.(vtkAlgorithm.java:378)
at vtk.vtkImageAlgorithm.(vtkImageAlgorithm.java:78)
at vtk.vtkImageReader2.(vtkImageReader2.java:258)
at vtk.vtkDICOMReader.(vtkDICOMReader.java:166)
at TestDICOMJava.main(TestDICOMJava.java:72)

9/9 Test #8: TestDICOMPython ..................***Failed 2.74 sec
Traceback (most recent call last):
File "/home/mathieu/debian/debian-med/trunk/packages/vtk-dicom/trunk/vtk-dicom-0.5.0/Testing/TestDICOMPython.py", line 5, in
import vtkDICOMPython
ImportError: /home/mathieu/debian/debian-med/trunk/packages/vtk-dicom/trunk/vtk-dicom-0.5.0/obj-x86_64-linux-gnu/lib/vtkDICOMPython.so: undefined symbol: PyVTKAddFile_vtkNIFTIWriter

@malaterre
Copy link
Contributor Author

Same goes for python.

Troubles starts here:

#if defined(WIN32)
extern "C" { __declspec( dllexport ) void PyVTKAddFile_vtkDICOMParser(PyObject *, const char *); }
#else
extern "C" { void PyVTKAddFile_vtkDICOMParser(PyObject *, const char *); }
#endif

@malaterre
Copy link
Contributor Author

I am using vtk 5.8, which may be the root of the actual issue.

@dgobbi
Copy link
Owner

dgobbi commented Jun 30, 2014

I don't think these visibility issues were fixed until VTK 6.0, I'll investigate this tomorrow.

@dgobbi
Copy link
Owner

dgobbi commented Jul 1, 2014

The Python visibility issues are due to vtkWrapPython.c, which didn't correctly set gcc visibility attributes until VTK 6.0. There isn't any way to fix them without upgrading VTK.

The Java visibility issues can be avoided by using java-7-openjdk, which adds visibility attributes to JNIEXPORT. There might be other ways, but at least on my Mac and Linux boxes, using java-7-openjdk was enough to fix the issue.

@dgobbi dgobbi added wontfix and removed wontfix labels Jul 1, 2014
@dgobbi
Copy link
Owner

dgobbi commented Jul 5, 2014

Closing. Visibility works with python and vtk 6, but not with earlier versions of vtk.

@dgobbi dgobbi closed this as completed Jul 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants