[ITK] ITK 4.7 + VTK 6.1 leads to "Undefined symbols for architecture x86_64"

Quan Qi quentan at gmail.com
Wed Feb 25 07:17:54 EST 2015


Dear Matt,

It's weird that I cannot pass compilation yesterday but get no error now… I’m running on ITK 4.7.1 and VTK 6.2.rc1.

But any way I post the CMakeLists.txt here, and I shared the simple rendering on GitHub: https://github.com/quentan/DICOM_ITK_VTK <https://github.com/quentan/DICOM_ITK_VTK>

```
#### CMakeLists.txt start

cmake_minimum_required(VERSION 2.8.4)
project(TEST)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -std=c++11")

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

add_executable(test1 MACOSX_BUNDLE main.cxx)

target_link_libraries(test1 ${VTK_LIBRARIES} ${ITK_LIBRARIES})
# If the simple include of VTK_LIBRARIES and ITK_LIBRARIES gives "Undefined symbols for architecture x86_64" error. Then include some other VTK libraries explicitly as shown below.
# target_link_libraries(test1 ${VTK_LIBRARIES} ${ITK_LIBRARIES} vtkRenderingVolume vtkRenderingOpenGL vtkRenderingVolumeOpenGL vtkInteractionStyle vtkRenderingFreeType vtkRenderingFreeTypeOpenGL)

#### CMakeLists.txt end
```

Another issue is a warning about redefined macro when compiling. Is there any redefinition in both ITK and VTK?

```
#### Warning information start
[100%] Building CXX object CMakeFiles/test1.dir/main.cxx.o
In file included from <built-in>:188:
<command line>:4:9: warning: 'vtkRenderingCore_AUTOINIT' macro redefined
#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
        ^
<command line>:3:9: note: previous definition is here
#define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL)
        ^
1 warning generated.
Linking CXX executable test1.app/Contents/MacOS/test1
[100%] Built target test1

#### Warning information end
```

Cheers, 
Quentan

> On 24 Feb 2015, at 18:23, Matt McCormick <matt.mccormick at kitware.com> wrote:
> 
> Hi Quentan,
> 
> Could you please share the full CMakeLists.txt?  Fixes in VTK 6.2rc1
> should have fixed this issue.  Could you also please verify that CMake
> is using the correct version of VTK?
> 
> Thanks,
> Matt
> 
> PS.  Please keep messages on the list by using reply-to-all.
> 
> On Tue, Feb 24, 2015 at 12:20 PM, Quan Qi <quentan at gmail.com> wrote:
>> Dear Matt,
>> 
>> I tried once again using both the latest VTK (6.2.rc1) and ITK (4.7.1), but no improvement gained.
>> 
>> However, I manually added more libraries in target_link_libraries, and it works. I wonder there is any conflict with simply include both ITK_LIBRARIES and VTK_LIBRARIES in volume rendering? Because the single use of VTK works, but ITK makes some VTK libraries unavailable and needs explicitly included.
>> 
>> #### CMakeLists.txt snippet start
>> 
>> target_link_libraries(test1 ${VTK_LIBRARIES} ${ITK_LIBRARIES}
>>                      vtkRenderingVolume vtkRenderingOpenGL vtkRenderingVolumeOpenGL
>>                      vtkInteractionStyle vtkRenderingFreeType vtkRenderingFreeTypeOpenGL)
>> 
>> #### CMakeLists.txt snipped end
>> 
>> Cheers,
>> Quentan
>> 
>>> On 24 Feb 2015, at 16:16, Matt McCormick <matt.mccormick at kitware.com> wrote:
>>> 
>>> Hi Quentan,
>>> 
>>> Is this the latest release of ITK?  What release of VTK is this?  If
>>> not already attempted, please use ITK 4.7.1 or newer and VTK 6.2rc1 or
>>> newer.
>>> 
>>> Thanks,
>>> Matt
>>> 
>>> On Tue, Feb 24, 2015 at 10:56 AM, Quan Qi <quentan at gmail.com> wrote:
>>>> Dear community members,
>>>> 
>>>> I’m trying to read DICOM series with ITK and render the volume with VTK. The single use of VTK is able to render the volume, but once ITK is included, an “Undefined symbols for architecture x86_64” compilation error is produced:
>>>> 
>>>> Undefined symbols for architecture x86_64:
>>>> "vtkRenderingOpenGL_AutoInit_Destruct()", referenced from:
>>>>     vtkRenderingCore_AutoInit::~vtkRenderingCore_AutoInit() in test1.cxx.o
>>>> ...
>>>> 
>>>> I’m running on OS X 10.10, I want to know how to adjust included libraries to avoid this errors?
>>>> 
>>>> CMakeLists.txt
>>>> 
>>>> #### CMakeLists.txt start
>>>> 
>>>> cmake_minimum_required(VERSION 2.8.4)
>>>> project(VolumeShow2)
>>>> 
>>>> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -std=c++11")
>>>> 
>>>> find_package(ITK REQUIRED) # these 2 lines leads to the undefined symbols error
>>>> include(${ITK_USE_FILE})
>>>> 
>>>> find_package(VTK REQUIRED)
>>>> include(${VTK_USE_FILE})
>>>> 
>>>> add_executable(test1 MACOSX_BUNDLE test1.cxx)
>>>> 
>>>> target_link_libraries(test1 ${Glue} ${VTK_LIBRARIES} ${ITK_LIBRARIES})
>>>> # target_link_libraries(test1 ${VTK_LIBRARIES} ${ITK_LIBRARIES} vtkRenderingVolume vtkRenderingOpenGL vtkRenderingVolumeOpenGL) # this call helps the project pass the compilation, but leaves an error when executing: no override found for 'vtkRayCastImageDisplayHelper'.
>>>> 
>>>> #### CMakeLists.txt end
>>>> 
>>>> I am confused about the integration of ITK and VTK. Can anybody help me?
>>>> 
>>>> Cheers,
>>>> Quentan
>>>> _______________________________________________
>>>> Community mailing list
>>>> Community at itk.org
>>>> http://public.kitware.com/mailman/listinfo/community
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150225/a65d2f8e/attachment.html>


More information about the Community mailing list