InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.43k stars 668 forks source link

[ITK 5.1] Problems building ITK GPU python wrappers (unresolved symbol in GPUDenseFiniteDifferenceImageFilter) #1812

Closed Neumann-A closed 4 years ago

Neumann-A commented 4 years ago

Working on https://github.com/microsoft/vcpkg/pull/11208

Trying to get ITK+RTK Python Wrappers to compile

The error I observed is a link error:

[4138/4444] cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\link.exe  @CMakeFiles\ITKGPUFiniteDifferencePython.rsp  /out:lib\_ITKGPUFiniteDifferencePython.pyd /implib:lib\ITKGPUFiniteDifferencePython.lib /pdb:lib\_ITKGPUFiniteDifferencePython.pdb /dll /version:0.0 /machine:x64   /debug /INCREMENTAL   && cd ."
FAILED: lib/_ITKGPUFiniteDifferencePython.pyd 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\link.exe  @CMakeFiles\ITKGPUFiniteDifferencePython.rsp  /out:lib\_ITKGPUFiniteDifferencePython.pyd /implib:lib\ITKGPUFiniteDifferencePython.lib /pdb:lib\_ITKGPUFiniteDifferencePython.pdb /dll /version:0.0 /machine:x64   /debug /INCREMENTAL   && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\link.exe @CMakeFiles\ITKGPUFiniteDifferencePython.rsp /out:lib\_ITKGPUFiniteDifferencePython.pyd /implib:lib\ITKGPUFiniteDifferencePython.lib /pdb:lib\_ITKGPUFiniteDifferencePython.pdb /dll /version:0.0 /machine:x64 /debug /INCREMENTAL /MANIFEST /MANIFESTFILE:Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir/intermediate.manifest Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir/manifest.res" failed (exit code 1120) with the following output:
Microsoft (R) Incremental Linker Version 14.25.28614.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir\ITKGPUFiniteDifferencePython.cpp.obj 
Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir\itkGPUDenseFiniteDifferenceImageFilterPython.cpp.obj 
Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir\itkGPUFiniteDifferenceFilterEnumPython.cpp.obj 
Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir\itkGPUFiniteDifferenceFunctionPython.cpp.obj 
Wrapping\Modules\ITKGPUFiniteDifference\CMakeFiles\ITKGPUFiniteDifferencePython.dir\itkGPUFiniteDifferenceImageFilterPython.cpp.obj -LIBPATH:C:\Scratch\neumann\vcpkg\installed\x64-windows\lib -LIBPATH:C:\PROGRA~1\NVIDIA~2\CUDA\v10.2\lib\x64\CUDART~1.LIB -LIBPATH:C:\Scratch\neumann\vcpkg\buildtrees\itk\src\d7c02f3c7b-db2ba0f808\Wrapping\Threads::Threads -LIBPATH:C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\OpenCL.lib -LIBPATH:C:\Scratch\neumann\vcpkg\buildtrees\itk\x64-windows-dbg\lib -LIBPATH:C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\double-conversion.lib lib\itksys-5.1.lib lib\itkvnl_algo-5.1.lib lib\itkvnl-5.1.lib lib\itkv3p_netlib-5.1.lib lib\itknetlib-5.1.lib lib\itkvcl-5.1.lib lib\itkvnl_algo-5.1.lib lib\itkvnl-5.1.lib lib\itkv3p_netlib-5.1.lib lib\itknetlib-5.1.lib lib\itkvcl-5.1.lib lib\itkNetlibSlatec-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\zlibd.lib lib\ITKMetaIO-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKFastMarching-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPolynomials-5.1.lib lib\ITKBiasCorrection-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKColormap-5.1.lib lib\ITKDICOMParser-5.1.lib lib\ITKDeformableMesh-5.1.lib lib\ITKDenoising-5.1.lib lib\ITKDiffusionTensorImage-5.1.lib lib\ITKPath-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\expat.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmDICT.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmMSFF.lib lib\ITKznz-5.1.lib lib\ITKniftiio-5.1.lib lib\ITKgiftiio-5.1.lib lib\ITKGPUCommon-5.1.lib lib\ITKGPUAnisotropicSmoothing-5.1.lib lib\ITKGPUImageFilterBase-5.1.lib lib\ITKGPUCommon-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPDEDeformableRegistration-5.1.lib lib\ITKGPUPDEDeformableRegistration-5.1.lib lib\ITKGPUSmoothing-5.1.lib lib\ITKGPUThresholding-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\manual-link\gtest_maind.lib lib\ITKIOBioRad-5.1.lib lib\ITKIOBruker-5.1.lib lib\ITKIOGE-5.1.lib lib\ITKIOHDF5-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\jpegd.lib lib\ITKIOJPEG2000-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\tiffd.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\lzmad.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\jpegd.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\zlibd.lib lib\ITKIOLSM-5.1.lib lib\itkminc2-5.1.lib lib\ITKIOMINC-5.1.lib lib\ITKIOMRC-5.1.lib lib\ITKNrrdIO-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\libpng16d.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\zlibd.lib lib\ITKIOSiemens-5.1.lib lib\ITKIOSpatialObjects-5.1.lib lib\ITKIOStimulate-5.1.lib lib\ITKTransformFactory-5.1.lib lib\ITKIOTransformHDF5-5.1.lib lib\ITKIOTransformInsightLegacy-5.1.lib lib\ITKIOTransformMatlab-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKKLMRegionGrowing-5.1.lib lib\itklbfgs-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKLabelMap-5.1.lib lib\ITKMarkovRandomFieldsClassifiers-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKPath-5.1.lib lib\ITKQuadEdgeMeshFiltering-5.1.lib lib\ITKRegionGrowing-5.1.lib lib\ITKRegistrationMethodsv4-5.1.lib lib\ITKTestKernel-5.1.lib lib\ITKVTK-5.1.lib lib\ITKVideoIO-5.1.lib lib\ITKWatersheds-5.1.lib lib\itkRTK-5.1.lib lib\ITKGPUFiniteDifference-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\tiffd.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\lzmad.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\libpng16d.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\expat.lib lib\ITKniftiio-5.1.lib lib\ITKznz-5.1.lib lib\ITKGPUImageFilterBase-5.1.lib lib\ITKGPUCommon-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\OpenCL.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gtestd.lib lib\ITKIOIPL-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\hdf5_cpp_D.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\hdf5_D.lib lib\ITKIOTransformBase-5.1.lib lib\ITKTransformFactory-5.1.lib lib\ITKOptimizersv4-5.1.lib lib\ITKIOBMP-5.1.lib lib\ITKIOGIPL-5.1.lib lib\ITKIOJPEG-5.1.lib lib\ITKIOMeshBYU-5.1.lib lib\ITKIOMeshFreeSurfer-5.1.lib lib\ITKIOMeshGifti-5.1.lib lib\ITKIOMeshOBJ-5.1.lib lib\ITKIOMeshOFF-5.1.lib lib\ITKIOMeshVTK-5.1.lib lib\ITKIOMeshBase-5.1.lib lib\ITKQuadEdgeMesh-5.1.lib lib\ITKIONIFTI-5.1.lib lib\ITKIONRRD-5.1.lib lib\ITKIOPNG-5.1.lib lib\ITKIOVTK-5.1.lib lib\ITKVideoCore-5.1.lib lib\ITKImageFeature-5.1.lib lib\ITKSmoothing-5.1.lib lib\ITKOptimizers-5.1.lib lib\ITKConvolution-5.1.lib lib\ITKStatistics-5.1.lib lib\itkNetlibSlatec-5.1.lib lib\ITKSpatialObjects-5.1.lib lib\ITKMesh-5.1.lib lib\ITKTransform-5.1.lib lib\ITKPath-5.1.lib lib\ITKFFT-5.1.lib lib\ITKCudaCommon.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmMSFF.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmDICT.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\openjp2.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmIOD.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmDSED.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmCommon.lib crypt32.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\lib\expat.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmjpeg8.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmjpeg12.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmjpeg16.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\gdcmcharls.lib rpcrt4.lib lib\ITKIOCSV-5.1.lib lib\ITKIOGDCM-5.1.lib lib\ITKIOTIFF-5.1.lib lib\ITKIOMeta-5.1.lib lib\ITKMetaIO-5.1.lib C:\Scratch\neumann\vcpkg\installed\x64-windows\debug\lib\zlibd.lib comctl32.lib wsock32.lib lib\ITKIOXML-5.1.lib lib\ITKIOImageBase-5.1.lib lib\ITKCommon-5.1.lib lib\itksys-5.1.lib ws2_32.lib dbghelp.lib psapi.lib lib\ITKVNLInstantiation-5.1.lib lib\itkvnl_algo-5.1.lib lib\itkvnl-5.1.lib lib\itkv3p_netlib-5.1.lib lib\itknetlib-5.1.lib lib\itkvcl-5.1.lib "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64\cuda.lib" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64\cudart_static.lib" lib\lpsolve55.lib "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64\cufft.lib" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib\x64\cublas.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib 
   Creating library lib\ITKGPUFiniteDifferencePython.lib and object lib\ITKGPUFiniteDifferencePython.exp
itkGPUDenseFiniteDifferenceImageFilterPython.cpp.obj : error LNK2019: unresolved external symbol "public: static char const * __cdecl itk::GPUDenseFiniteDifferenceImageFilterKernel::GetOpenCLSource(void)" (?GetOpenCLSource@GPUDenseFiniteDifferenceImageFilterKernel@itk@@SAPEBDXZ) referenced in function "public: static char const * __cdecl itk::GPUDenseFiniteDifferenceImageFilter<class itk::GPUImage<float,2>,class itk::GPUImage<float,2>,class itk::DenseFiniteDifferenceImageFilter<class itk::GPUImage<float,2>,class itk::GPUImage<float,2> > >::GetOpenCLSource(void)" (?GetOpenCLSource@?$GPUDenseFiniteDifferenceImageFilter@V?$GPUImage@M$01@itk@@V12@V?$DenseFiniteDifferenceImageFilter@V?$GPUImage@M$01@itk@@V12@@2@@itk@@SAPEBDXZ)
lib\_ITKGPUFiniteDifferencePython.pyd : fatal error LNK1120: 1 unresolved externals

currently I cannot figure out why the symbol is missing since the _Kernel.cxx file is generated and contains the function. I can find the symbol in the _Kernel.obj file but the ITKGPUFiniteDifference.lib seems not to export it. At least dumpbin + findstr does give not hint to GetOpenCLSource

Neumann-A commented 4 years ago

https://github.com/InsightSoftwareConsortium/ITK/blob/ee2ab9c973e66616cc2132f9a96fcf7763a6b94d/CMake/itkOpenCL.cmake#L38

https://github.com/InsightSoftwareConsortium/ITK/blob/ee2ab9c973e66616cc2132f9a96fcf7763a6b94d/CMake/itkOpenCL.cmake#L51

shouldn't this be set(${SRC_VAR} ${${SRC_VAR}} ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE})?

dzenanz commented 4 years ago

This seems to be a duplicate of #1381.