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 666 forks source link

CMake Error: install(EXPORT "ITKTargets" ...) includes target "gdcmjpeg8" more than once in the export set. #2162

Closed SimonRit closed 3 years ago

SimonRit commented 3 years ago

Description

RTK CI now fails with this error in the Build ITK step, see https://github.com/SimonRit/RTK/runs/1524238640. I noticed #2146 but the problem is on Ubuntu, not on mac OS. Since RTK uses the new github actions, I assume that the same problem will occur with the CI of all remote modules which use the ITKModuleTemplate.

Steps to Reproduce

See https://github.com/SimonRit/RTK/blob/master/.github/workflows/build-test-package.yml#L52-L56.

Expected behavior

ITK configuration and compilation!

Actual behavior

Error in the title when configuring ITK.

Reproducibility

100%

Versions

ITK v5.1.2

issakomi commented 3 years ago

There is already the issue on Sourceforge 515. Probably the owner will look at it soon. It is related to code like (not only here, many places)

if(NOT JPEG_INSTALL_NO_LIBRARIES)
  install(TARGETS ${JPEG_LIBRARY_NAME}8
    EXPORT ${GDCM_TARGETS_NAME} <---------------------------------
    RUNTIME DESTINATION ${JPEG_INSTALL_BIN_DIR} COMPONENT Applications
    LIBRARY DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT Libraries ${NAMELINK_SKIP}
    ARCHIVE DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT DebugDevel
  )
  if(NAMELINK_ONLY)
  install(TARGETS ${JPEG_LIBRARY_NAME}8
    EXPORT ${GDCM_TARGETS_NAME} <-----------------------------------
    LIBRARY DESTINATION ${JPEG_INSTALL_LIB_DIR} COMPONENT DebugDevel ${NAMELINK_ONLY}
  )
  endif()
endif()

In top level GDCM CMakeLists.txt file is block

if(BUILD_SHARED_LIBS)
  set(NAMELINK_ONLY NAMELINK_ONLY)
  set(NAMELINK_SKIP NAMELINK_SKIP)
endif()

where it is possible e.g. to comment _NAMELINKONLY and Cmake 3.19.1 will generate files, for example, not tested, just FYI.

issakomi commented 3 years ago

Seems to work again as is with nightly build CMake 3.19.2

SimonRit commented 3 years ago

Thanks. The .github action of remote packages does not install cmake, it uses the version delivered with the ubuntu-18.04 os. Should this be changed? I admit I don't understand this problem because it appeared suddenly without changing the os nor the ITK version...

SimonRit commented 3 years ago

Sorry, they actually update the os env, see the problem here.

thewtex commented 3 years ago

This is related to a regression in CMake 3.19.1, xref https://gitlab.kitware.com/cmake/cmake/-/issues/21529

Yes, we should start using an explicit CMake version in the remote module GitHub Actions. I can start a patch.

CC @bradking @malaterre

thewtex commented 3 years ago

PR: https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/pull/98

SimonRit commented 3 years ago

This worked for me, thanks, see here, (but I now have another problem with MacOS python packages).

thewtex commented 3 years ago

This worked for me, thanks, see here,

:+1:

(but I now have another problem with MacOS python packages).

I am working on this -- a different issue, but also related to updates on the build system.

thewtex commented 3 years ago

@SimonRit both issues should now be addressed following updates in ITKModuleTemplate master -- if not, please re-open.

SimonRit commented 3 years ago

Yes, thanks, I confirm that it solved it.