Page MenuHomePhabricator

[BUG] FunctionCreateModule Missing dependency error warning
Closed, InvalidPublic

Description

We realised that in case a module has a missing dependency the function "mitk_create_module" does not provide any information, that the library will not be build.
Instead cmake complains at the target_link_libraries line, which is quite confusing.

If we remove the following if statement (in mitkFunctionCreateModule:230-232) and just print the message it gives us the expected warning. Seems MODULE_NO_FEATURE_INFO is never set.

if(MODULE_NO_FEATURE_INFO)
  message("${_Module_type} ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}")
endif()

Could you please check that? And maybe replace the warning with an error, because in my opinion should not proceed in this case.

Best regards

Event Timeline

jung updated the task description. (Show Details)
jung updated the task description. (Show Details)

I disagree a module not being build should not be an error, as there is currently no way to select which modules are being build. Instead all that can be build are by default. Switching to an error would result in just about no build ever being possible.

Regarding the information, there is a summary at the end of the CMake configure looking like this:

------- FEATURE SUMMARY FOR MITK -------
-- The following features have been enabled:

 * MitkIpPic
 * MitkIpFunc
 * MitkIpSegmentation
 * mbilog
 * qtsingleapplication
 * MitkCore
 * MitkTestingHelper
 * MitkCommandLine
 * MitkAppUtil
 * MitkDCMTesting
 * MitkLegacyIO
 * MitkDataTypesExt
 * MitkAnnotation
 * MitkLegacyGL
 * MitkAlgorithmsExt
 * MitkMapperExt
 * MitkDICOMReader
 * MitkDICOMReaderServices
 * MitkDICOMTesting
 * MitkSceneSerializationBase
 * MitkPlanarFigure
 * MitkImageDenoising
 * MitkImageExtraction
 * MitkLegacyAdaptors
 * MitkSceneSerialization
 * MitkGizmo
 * MitkGraphAlgorithms
 * MitkMultilabel
 * MitkImageStatistics
 * MitkContourModel
 * MitkSurfaceInterpolation
 * MitkSegmentation
 * MitkPlanarFigureSegmentation
 * MitkOpenViewCore
 * MitkQtWidgets
 * MitkQtWidgetsExt
 * MitkC3js
 * MitkQmlItems
 * MitkSegmentationUI
 * MitkCLCore
 * MitkCLUtilities
 * MitkCLMRUtilities
 * MitkCLLibSVM
 * MitkCLVigraRandomForest
 * MitkDataCollection
 * MitkCLImportanceWeighting
 * MitkDiffusionCore
 * MitkDiffusionCoreIO
 * MitkFiberTracking
 * MitkConnectomics
 * MitkQuantification
 * MitkDiffusionIO
 * MitkGPGPU
 * MitkIGTBase
 * MitkIGTIO
 * MitkRigidRegistration
 * MitkRigidRegistrationUI
 * MitkDeformableRegistration
 * MitkDeformableRegistrationUI
 * MitkQtOverlays
 * MitkDicomUI
 * MitkRemeshing
 * MitkPersistence
 * MitkVtkShaders
 * MitkDicomRT
 * MitkRTUI
 * MitkIOExt
 * MitkXNAT
 * MitkTubeGraph
 * MitkTumorInvasionAnalysis
 * MitkMatchPointRegistration
 * MitkMatchPointRegistrationIO
 * MitkMatchPointRegistrationUI
 * MitkBoundingShape
 * MitkRenderWindowManager
 * MitkRenderWindowManagerUI
 * MitkCEST
 * MitkCESTIO
 * MitkIpPicSupportIO

-- The following OPTIONAL packages have been found:

 * Doxygen
 * Git
 * OpenMP
 * OpenSSL

-- The following REQUIRED packages have been found:

 * Qt5Gui (required version >= 5.7.1)
 * Qt5Script
 * Qt5Qml (required version >= 5.7.1)
 * Qt5WebChannel (required version >= 5.7.1)
 * Qt5Positioning (required version >= 5.7.1)
 * Qt5WebEngineCore (required version >= 5.7.1)
 * PocoNet
 * PocoXML
 * Eigen
 * GDCM
 * DCMTK
 * Boost (required version >= 1.60.0)
 * PocoUtil
 * OpenGL
 * Qt5Concurrent
 * Qt5Svg
 * Qt5Quick
 * Qt5Sql
 * usCore
 * CppMicroServices
 * Qt5Help
 * Qt5PrintSupport
 * Qt5WebEngineWidgets
 * Qt5XmlPatterns
 * ITK
 * VTK
 * Qt5Widgets
 * Qt5Xml
 * Qt5OpenGL
 * PocoZip
 * Qt5UiTools
 * Qt5LinguistTools
 * Qt5Network
 * PocoFoundation
 * Poco
 * Qt5Core
 * Qt5
 * HDF5

-- The following features have been disabled:

 * MitkRDF , (missing dependencies: Redland)
 * MitkMultilabelIO , (missing dependencies: DCMQI)
 * MitkOpenIGTLink , (missing dependencies: OpenIGTLink)
 * MitkIGT , (missing dependencies: MitkOpenIGTLink;OpenIGTLink)
 * MitkCameraCalibration , (missing dependencies: MitkIGT;OpenCV)
 * MitkOpenCVVideoSupport , (missing dependencies: OpenCV)
 * MitkToFHardware , (missing dependencies: MitkOpenCVVideoSupport;MitkCameraCalibration)
 * MitkToFProcessing , (missing dependencies: MitkCameraCalibration;OpenCV)
 * MitkToFUI , (missing dependencies: MitkToFHardware;MitkToFProcessing)
 * MitkUS , (missing dependencies: MitkOpenCVVideoSupport;MitkOpenIGTLink)
 * MitkUSNavigation , (missing dependencies: MitkUS;MitkIGT)
 * MitkUSUI , (missing dependencies: MitkUS)
 * MitkSimulation , (missing dependencies: SOFA)
 * MitkOpenIGTLinkUI , (missing dependencies: MitkOpenIGTLink)
 * MitkIGTUI , (missing dependencies: MitkIGT)
 * MitkIGTUIConfigurationWidgetRegistry , (missing dependencies: MitkIGTUI)

-- The following OPTIONAL packages have not been found:

 * Ant

Configuring done

Is this sufficient?

Ok I understand that, but my problem is something else.

Our build fails and I didn't get the needed information to understand why.
And mitk already has Cmake code to give exactly this information, but that code is never reached (at least for us).

Edit: Maybe I should add that we are not building mitk itself, but an mitk project.
And the target_link_libraries in the modules cmakelists.txt is the problem.
We saw that your modules usually don't link any external libraries using this line to your modules.

This is our module cmake file.

mitk_create_module(ArticulatedModel
DEPENDS PUBLIC MitkQtWidgetsExt CommonModule ObjectDetection)

target_link_libraries(ArticulatedModel PUBLIC ${OpenSG_LIBRARIES})

When the module ObjectDetection is not build, cmake quits at the target_link_libraries line with:

CMake Error at Modules/ArticulatedModel/CMakeLists.txt:18 (target_link_libraries):

Cannot specify link libraries for target "ArticulatedModel" which is not
built by this project.

But it doesn't give us the information that the ArticulatedModel is not built because the ObjectDetection is missing.

Is there a specific reason you are using

mitk_create_module(ArticulatedModel
DEPENDS PUBLIC MitkQtWidgetsExt CommonModule ObjectDetection)

target_link_libraries(ArticulatedModel PUBLIC ${OpenSG_LIBRARIES})

instead of

mitk_create_module(ArticulatedModel
DEPENDS 
  PUBLIC MitkQtWidgetsExt CommonModule ObjectDetection
PACKAGE_DEPENDS 
  PUBLIC ${OpenSG_LIBRARIES}
)

If not the only issue remaining should be the fact that the project template does not produce the summary MITK does? Would this work for you?

No there is no specific reason.
The target_link_libraries was legacy code and we weren't aware that it could done like you proposed.

That completely solves our problem.
Thank you very much for the help.

goch closed this task as Invalid.EditedMar 29 2017, 2:44 PM

No problem. Closing.