Hi there,

I recently updated our project by merging in the 2012.12.0 MITK release into 
our github clone of MITK.

Then I had a strange problem whereby our external project plugins were 
resolved, but the plugins that these plugins depended on were not.
I have attached the error in error.txt. I ended up by changing the macro 
gp_resolve_item_override.txt.  I have attaches a before.txt and after.txt.
At the moment I am only testing this solution on my Mac running Snow Leopard, 
but the problem exists also on Scientific Linux.

However, I still don't fully understand it, so Im not sure whether to raise a 
bug??

So, as I see it:
  1. We have our own plugins that get copied into the installation folder 
blah.app/Contents/MacOS/plugins
  2. The fixup_bundle process will determine that the plugin in question, can 
be resolved within the bundle, and calculate the embedded path as 
@executable_path/plugins
  3. But this plugin depends on libuk_ac_ucl_cmic_gui_qt_common.dylib which 
exists in the same directory, and hence otool -L reveals that it has a relative 
path that is empty
  4. So, in gp_resolve_item in GetPrerequisites.cmake this code:

  if(NOT resolved)
    set(ri "ri-NOTFOUND")
    find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
    find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
    if(ri)
      #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
      set(resolved 1)
      set(resolved_item "${ri}")
      set(ri "ri-NOTFOUND")
    endif(ri)
  endif(NOT resolved)

fails to resolve it, as the ${dirs} includes stuff like the 
MITK-build/MITK-build/bin but not the installation folder where the plugins are 
residing.

  5. So I thought about adding more paths to the ${dirs} variable, but there is 
a mechanism to add an addtional function called gp_resolve_item_override.
  6. However, the bit of code I removed in the "before.txt" firstly is only 
defined for non Apple platforms, and secondly it only deals with blueberry 
plugins, which doesn't seem suitable for plugins in general, and certainly not 
for 3rd party plugins for external projects.
  7. So, the function I added in after.txt tries to match the plugin within the 
installation plugin folder.
  8. So, I think that the provided function may be better or more correct, 
although currently needs a bit of refactoring to remove duplications.

BUT

  9. I have no idea why these error messages have only just appeared, as 
looking through the revision history of mitkMacroInstall.cmake, or 
GetPrerequisites.cmake or BundleUtilities.cmake doesn't suggest any relevant 
change between 2012.09 and 2012.12 that I can see.
 10. I have no idea if the proposed change is even valid as I am not 100% sure 
if I understand the original intent of gp_resolve_item_override.

Please can any one help understand what the problem.

Thanks as always

Matt


    macro(gp_resolve_item_override context item exepath dirs resolved_item_var 
resolved_var)
    
      get_filename_component(_item_name \"\${item}\" NAME)
      get_filename_component(_item_path \"\${item}\" PATH)
    
      set(_bundle_dest_dir \"${_bundle_dest_dir}\")
      if(_bundle_dest_dir)
        set(_plugins_path 
\"\${CMAKE_INSTALL_PREFIX}/\${_bundle_dest_dir}/plugins\")
      else()
        set(_plugins_path \"\${CMAKE_INSTALL_PREFIX}/bin/plugins\")
      endif()
          
      if(NOT _item_path MATCHES 
\"\${CMAKE_INSTALL_PREFIX}/${_bundle_dest_dir}\")
        set(full_path \"full_path-NOTFOUND\")
        file(GLOB_RECURSE full_path \${_plugins_path}/\${_item_name} )
        list(LENGTH full_path full_path_length)
        if(full_path_length GREATER 1)
          list(GET full_path 0 full_path)
        endif()
        get_filename_component(_item_path \"\${full_path}\" PATH)      
      endif()

      set(ri \"ri-NOTFOUND\")
      find_file(ri \"\${item}\" \${_item_path})
      if(ri)
        set(resolved 1)
        set(resolved_item \"\${ri}\")
        set(ri \"ri-NOTFOUND\")
      endif(ri)
      
    endmacro()

    if(NOT APPLE)
      macro(gp_resolve_item_override context item exepath dirs 
resolved_item_var resolved_var)
        if(\${item} MATCHES \"blueberry_osgi\")
          get_filename_component(_item_name \${item} NAME)
          set(\${resolved_item_var} \"\${exepath}/plugins/\${_item_name}\")
          set(\${resolved_var} 1)
        endif()
      endmacro()
    endif()
-- fixup_bundle: preparing...
override: 
/Users/mattclarkson/install/niftk-debug/NiftyView.app/Contents/MacOS/plugins/libit_unito_cim_intensityprofile.dylib
found file: 
/Users/mattclarkson/install/niftk-debug/NiftyView.app/Contents/MacOS/plugins/libit_unito_cim_intensityprofile.dylib
override result: @executable_path/plugins
-- 
warning: cannot resolve item 'libuk_ac_ucl_cmic_gui_qt_common.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- 
******************************************************************************
warning: cannot resolve item 'libuk_ac_ucl_cmic_gui_qt_common.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

    
context='/Users/mattclarkson/install/niftk-debug/NiftyView.app/Contents/MacOS/plugins/libit_unito_cim_intensityprofile.dylib'
    item='libuk_ac_ucl_cmic_gui_qt_common.dylib'
    
exepath='/Users/mattclarkson/install/niftk-debug/NiftyView.app/Contents/MacOS'
    
dirs='/Users/mattclarkson/build/NifTK-SuperBuild/VTK-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/ITK-build/bin/;/Users/mattclarkson/install/qt-4.7.4/lib;/Users/mattclarkson/install/qt-4.7.4/lib/../bin;/Users/mattclarkson/build/NifTK-SuperBuild/MITK-build/MITK-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/NifTK-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/NiftyLink-build/NiftyLink-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/NiftyLink-build/OPENIGTLINK-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/CMakeExternals/Install/BOOST/lib/boost-1.46.1/;/Users/mattclarkson/build/NifTK-SuperBuild/CMakeExternals/Install/BOOST/lib/boost-1.46.1;/Users/mattclarkson/build/NifTK-SuperBuild/GDCM-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/MITK-build/OpenCV-build/bin/;/Users/mattclarkson/build/NifTK-SuperBuild/CTK-build/CTK-build/bin/;/Users/mattclarkson/install/niftk-debug/NiftyView.app/Contents/MacOS/plugins/designer'
    resolved_item_var='resolved_file'
******************************************************************************

-- warning: gp_resolved_file_type non-absolute file 
'libuk_ac_ucl_cmic_gui_qt_common.dylib' returning type 'other' -- possibly 
incorrect
-- 
warning: cannot resolve item 'libuk_ac_ucl_cmic_gui_qt_common.dylib'

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to