conda-forge / itk-feedstock

A conda-smithy repository for itk.
BSD 3-Clause "New" or "Revised" License
1 stars 11 forks source link

Linking errors on Windows #37

Open ghisvail opened 1 year ago

ghisvail commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

I am in the process of submitting a Conda package for ANTs, a medical image registration package based on ITK.

I managed to build a working package for Linux and macOS successfully, but I am unable to build it for Windows due to linking errors such as:

2023-06-03T20:49:24.5920686Z ITKOptimizers-5.3.lib(ITKOptimizers-5.3.dll) : error LNK2005: "protected: __cdecl itk::CostFunctionTemplate<double>::CostFunctionTemplate<double>(void)" (??0?$CostFunctionTemplate@N@itk@@IEAA@XZ) already defined in antsUtilities.lib(antsRegistration4DDouble.cxx.obj)
2023-06-03T20:49:24.5922719Z ITKOptimizers-5.3.lib(ITKOptimizers-5.3.dll) : error LNK2005: "protected: virtual __cdecl itk::CostFunctionTemplate<double>::~CostFunctionTemplate<double>(void)" (??1?$CostFunctionTemplate@N@itk@@MEAA@XZ) already defined in antsUtilities.lib(antsRegistration4DDouble.cxx.obj)
2023-06-03T20:49:24.5924701Z ITKOptimizers-5.3.lib(ITKOptimizers-5.3.dll) : error LNK2005: "protected: virtual void __cdecl itk::CostFunctionTemplate<double>::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class itk::Indent)const " (?PrintSelf@?$CostFunctionTemplate@N@itk@@MEBAXAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VIndent@2@@Z) already defined in antsUtilities.lib(antsRegistration4DDouble.cxx.obj)
2023-06-03T20:49:38.3031489Z Examples\antsAffineInitializer.exe : fatal error LNK1169: one or more multiply defined symbols found

I am not familiar with the specificities of Windows builds. Could you help me figure out where the issue comes from (ITK, ANTS or their respective Conda packages)? Would you have any suggestions w.r.t. how to fix this?

Thank you in advance.

Installed packages

n/a

Environment info

n/a