Hello Miklos and Andreas,

thank you for looking into this. Generally, all MITK dependencies may not
build against libc++. However, for my personal use case, VTK, ITK and Qt
4.8.5 were all build consistently with libc++ and I was able to build
dicom, registration, segmentation, imagecropper plugins and mitkWorkbench
successfully. All I had to do was change the super-build setup to include
"-stdlib=libc++" (instead of the current "-stdlib=libstdc++").

Regarding my remaining issues, I had indeed tried to start mitkWorkbench
from the MITK-build directory, but it appears the problem was related to
setting the correct DYLD_LIBRARY_PATH as Miklos pointed out (which of
course is logical, since all those libraries are in a sub-directory called
"plugins").

With the correct DYLD_LIBRARY_PATH (or DYLD_FALLBACK_LIBRARY_PATH) I can
now start mitkWorkbench by calling:

./mitkWorkbench.app/Contents/MacOS/mitkWorkbench

You should not need to set any such environment adjustment after packaging,
though, since your install script does adjust all dependency lookups to
relative paths (@executable_path/... @executable_path/plugins/...). What
exactly is your issue after packaging the application? Have you tried
moving ALL dynamic libraries into the folder the mitkWorkbench executable
is in? Have you checked that all dependencies for "mitkWorkbench" look good?

otool -L
_CPack_Packages/Darwin/DragNDrop/MITK-2013.12.99_r60df56-mac64/ALL_IN_ONE/mitkWorkbench.app/Contents/MacOS/mitkWorkbench

_CPack_Packages/Darwin/DragNDrop/MITK-2013.12.99_r60df56-mac64/ALL_IN_ONE/mitkWorkbench.app/Contents/MacOS/mitkWorkbench:

@executable_path/../MacOS/libmbilog.dylib (compatibility version 0.0.0,
current version 0.0.0)

@executable_path/../MacOS/libPocoFoundationd.22.dylib (compatibility
version 22.0.0, current version 22.0.0)

@executable_path/../MacOS/libPocoUtild.22.dylib (compatibility version
22.0.0, current version 22.0.0)

@executable_path/../MacOS/libPocoXMLd.22.dylib (compatibility version
22.0.0, current version 22.0.0)

@executable_path/../MacOS/libPocoZipd.22.dylib (compatibility version
22.0.0, current version 22.0.0)

[...]

The full version is here: http://pastebin.com/D8iwLQgd
This should allow you to open the application package without setting any
environment variables.

Btw., this adjustment is also the reason, why I have to call "sudo make
package", since my homebrew installed Qt 4.8.5 libraries are read-only, but
the packaging script wants to write the adjusted paths after copying those
libraries:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool:
can't open input file:
/Users/chris/dev/extern/build/MITK-git/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-2013.12.99_r60df56-mac64/ALL_IN_ONE/mitkWorkbench.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore
for writing (Permission denied)

I then also have to readjust the permissions for the final application, but
this should not be a general issue and won't happen, if you build your own
Qt.

Cheers, Chris



On Tue, Feb 4, 2014 at 9:50 AM, Miklos Espak <[email protected]> wrote:

> Hi Chris,
>
> we have managed to build our MITK based app on Mavericks, with the 10.8
> system framework. I paste some instructions below.
>
> We have one remaining issue. The application starts only if we manually
> set the DYLD_LIBRARY_PATH, adding all the bin and bin/plugins directories.
> The same is stands for the installed application.
>
> Some help would be great in this.
>
> Andreas merged a few my changes that allowed to build MITK with 10.8. They
> are in the MITK master, but I do not remember if they are in 2013.12.0. It
> was bug 16776 on the MITK bugzilla.
>
> Note that building with 10.9 did not work for us because some bugs in
> dependent libraries (e.g. ITK, VTK). The MITK master uses more recent
> versions of these libraries, so some of these issues are fixed in them. (I
> have not tried.)
>
> Qt 4.8.5 is not possible to build either with the 10.8 or the 10.9 system
> framework. The errors have been fixed in the git repository.
>
>
>
> git clone git://gitorious.org/qt/qt.git qt
>
> Several dependencies cannot be built with the Clang C++ library (libc++),
> only with the GNU one (libstdc++). The OS X 10.8 framework contains both
> libraries, but the 10.9 framework contains only the Clang one.
>
> To build NifTK with the OS X 10.8 framework, Qt, and all the other
> libraries have to be built with 10.8, consequently, and the architecture
> type needs to be the same, too. The compiler can be either g++ or clang.
>
> Qt has to be configured with the following option:
>
>
>
> -sysroot 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
>
> NifTK has to be configured with the following options:
>
>
>
> -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"
>  -DCMAKE_OSX_DEPLOYMENT_TARGET="10.8" -DCMAKE_OSX_ARCHITECTURES="x86_64"
>
> Building NifTK with OS X 10.9:
>
> You have to use the Qt git repository (as for 10.8), but do not need to
> specify the sysroot, since 10.9 is the default.
>
> E.g. the currently used version of ITK and VTK does not compile because of
> a bug in the tiff library. These are fixed in newer versions of the
> libraries.
>
> The following patch can be applied for both ITK and VTK:
>
> http://review.source.kitware.com/#/c/12924/
>
>
> Miklos
>
>
>
> On 4 February 2014 07:31, Fetzer, Andreas <[email protected]>wrote:
>
>> Hi Chris,
>>
>>
>>
>> thank you very much for your report!
>>
>> As I wrote in my previous email most of the fixes you proposed will be
>> obsolete with the next ITK and VTK update. Until then the easiest way
>> should be to use the 10.8er SDK.  Please note that in this case (compiling
>> MITK on 10.9 against 10.8 SDK) automatically everything is linked against
>> the libstdc++. Of course your Qt has to be linked against libstdc++ either
>> in this case.
>>
>>
>>
>> However the missing library and the problems with the permissions should
>> not happen. It would be helpful to see the actual message. Running make
>> with in combination with sudo is never a good idea and should be avoided.
>>
>>
>>
>> As for the missing liborg_mitk_gui_qt_ext.dylib: This is either a 10.9
>> related issue or it has something to do with a missing
>> install_name/dependency.
>>
>> Did you start the mitkWorkbench application from the MITK-build/bin
>> folder? If not does it work if you start  the workbench from this location?
>>
>> Also here it would be helpful if you could provide us the exact command
>> and your current directory you used for starting the application.
>>
>>
>>
>> Best regards
>>
>> Andreas
>>
>>
>>
>> *From:* [email protected] [mailto:[email protected]] *On
>> Behalf Of *Chris
>> *Sent:* Mittwoch, 29. Januar 2014 13:51
>> *To:* Fetzer, Andreas; [email protected]
>> *Subject:* Re: [mitk-users] Please confirm how to install additional
>> Modules, Plugins and the MITK Mac OS Bundle
>>
>>
>>
>> Hello Andreas,
>>
>>
>>
>> thank you for pointing out the package command. I found that calling
>> "make package" will still trigger similar errors, but with more detailed
>> error messages. In fact, it reported a few "permission denied" errors on
>> certain files and I would thus recommend calling:
>>
>> sudo make package
>>
>>
>>
>> I still could not run the application successfully, but the (dmg) package
>> is created and appears to include all plugins/libraries now.
>>
>> I believe the remaining issue is that my Qt version is linked to "libc++".
>>
>>
>>
>> It would be great to see full support for OS X 10.9 - I have tried to
>> compile it using libc++ and seen only minor issues:
>>
>>
>>
>> (1) std::tr1 is not found (usually used in itk files)
>>
>> This can be resolved by removing all ::tr1 references for Mac OS -
>> example files that are affected:
>>
>> MITK-git/Core/CppMicroServices/usConfig.h.in
>>
>> MITK-git/Core/CppMicroServices/src/util/usListenerFunctors_p.h
>>
>> ITK-src/Modules/Core/Common/include/itkImageAlgorithm.h
>>
>>
>>
>> (2) error: use of undeclared identifier 'mkdtemp' - I found this problem
>> in
>>
>> MITK-git/Utilities/qtsingleapplication/qthandlenewappinstance.cpp
>> It can be resolved by including #include <unistd.h>
>>
>>
>>
>> The good news - with these few adjustments, all ITK and VTK libs actually
>> linked fine with libc++. In my case, all Frameworks and dynamic libraries
>> inside the mitkWorkbench are actually linked to libc++ now. The last thing
>> I struggled with to get it running was the fact that
>> "liborg_mitk_gui_qt_ext.dylib" could not be found by "mitkWorkbench". I
>> copied that library from the internal plugin folder (
>> http://mitkWorkbench.app/Contents/MacOS/plugins) into the working
>> directory (http://mitkWorkbench.app/Contents/MacOS). Now, I can actually
>> run the application.
>>
>>
>>
>> Thanks again for your help - I hope this can guide others, who wish to
>> build mitk on Mac OS X 10.9 Mavericks.
>>
>>
>>
>> Best regards,
>>
>> Chris
>>
>>
>>
>> On Wed, Jan 29, 2014 at 10:32 AM, Fetzer, Andreas <
>> [email protected]> wrote:
>>
>> Hi Chris,
>>
>>
>>
>> welcome to MITK! Please note that Mac OS X 10.9 is not fully supported
>> yet. Regarding your questions:
>>
>>
>>
>> (1)    Yes this is correct. The distributed binary release just contains
>> a small (but well tested) number of plugins
>>
>> (2)    If you need more modules I am afraid but you will have to go with
>> option (A). At the moment we do not support to add/install libraries to a
>> existing MITK application
>>
>> (3)    Great! We recently added the support for building MITK on 10.9
>> with a different SDK version. Actually at the moment it is not possible to
>> build MITK with the SDK of 10.9 which is also due to our current ITK and
>> VTK version. However we are planning to upgrade these toolkits until our
>> next release which should solve this issue.
>> Anyway the bundle is created during the build and can be found in
>> MITK-build/bin/mitkWorkbench.app. If you want to create an installer which
>> you can distribute you should build the PACKAGE target. You can do this by
>> typing "make package" in the MITK-build directory. This will create a _
>> *Cpack*_Packages folder in MITK-build where the installer disk image is
>> contained.
>>
>> (4)    You can start the application from the command line or from the
>> MITK-build/bin folder simply with double click. For starting it from the
>> command line you can use the following command:
>> "open MITK-build/bin/mitkWirkbench.app" or you simply execute the
>> executable with
>> "MITK-build/bin/mitkWorkbench.app/Contents/MacOS/mitkWorkbench"
>> I think this works similar on Linux.
>>
>>
>>
>> Hopefully I was able to answer all your questions. If not please don't
>> hesitate to ask again!
>>
>>
>>
>> Best regards
>>
>> Andreas
>>
>>
>>
>> *From:* Chris [mailto:[email protected]]
>> *Sent:* Dienstag, 28. Januar 2014 20:36
>> *To:* [email protected]
>> *Subject:* [mitk-users] Please confirm how to install additional
>> Modules, Plugins and the MITK Mac OS Bundle
>>
>>
>>
>> Dear all,
>>
>>
>>
>> As I have only recently discovered the potential of MITK, please be
>> patient.
>>
>> First, I did read the FAQ and tried to find answers there, but please
>> help me understand, what remains unclear.
>>
>>
>>
>> (1) Many modules / plugins (e.g. registration) are not included in the
>> distributed binary, correct?
>>
>>
>>
>> (2) If I want to use additional modules / plugins, do I always need to
>> (A) build MITK from scratch or (B) can only build the module / plugin and
>> manually add it to MITK (in form of a shared dll/dylib)?
>>
>>
>>
>> (3) I have successfully compiled MITK on Mac OS X (10.9), by setting
>> OSX_DEPLOYMENT_TARGET and OSX_SYSROOT to 10.8 respectively. To create the
>> OS App Bundle (mitkWorkbench.app), I then switched to the "MITK-build"
>> directory and called "make install". Unfortunately, it fails to validate
>> the bundle and it immediately crashes on startup (error below). [It appears
>> it has some issue with my Qt libraries that I installed using homebrew, but
>> I have no idea how to fix this.]
>>
>>
>>
>> (4) Is there another way under to start the application (e.g. from the
>> command line) without creating this bundle? How does it work under Linux ?
>>
>>
>>
>> Thank you!!
>>
>> Chris
>>
>>
>>
>>
>>
>> -- fixup_bundle: cleaning up...
>>
>> -- fixup_bundle: verifying...
>>
>> --
>> ===========================================================================
>>
>> -- Analyzing
>> app='/Users/chris/dev/extern/build/MITK-git/MITK-build/install/mitkWorkbench.app'
>>
>> --
>> bundle='/Users/chris/dev/extern/build/MITK-git/MITK-build/install/mitkWorkbench.app'
>>
>> --
>> executable='/Users/chris/dev/extern/build/MITK-git/MITK-build/install/mitkWorkbench.app/Contents/MacOS/mitkWorkbench'
>>
>> -- valid='1'
>>
>> -- executable file 1:
>> /Users/chris/dev/extern/build/MITK-git/MITK-build/install/mitkWorkbench.app/Contents/MacOS/mitkWorkbench
>>
>> -- verified='0'
>>
>> -- info='external prerequisites found:
>>
>>
>> f='/Users/chris/dev/extern/build/MITK-git/MITK-build/install/mitkWorkbench.app/Contents/MacOS/mitkWorkbench'
>>
>>
>> external_prereqs='/usr/local/Cellar/qt/4.8.5/lib/QtCore.framework/Versions/4/QtCore;/usr/local/Cellar/qt/4.8.5/lib/QtGui.framework/Versions/4/QtGui;/usr/local/Cellar/qt/4.8.5/lib/QtNetwork.framework/Versions/4/QtNetwork'
>>
>> '
>>
>> --
>>
>> CMake Error at
>> /Users/chris/dev/extern/src/MITK-git/CMake/BundleUtilities.cmake:773
>> (message):
>>
>>   error: verify_app failed
>>
>> Call Stack (most recent call first):
>>
>>   /Users/chris/dev/extern/src/MITK-git/CMake/BundleUtilities.cmake:655
>> (verify_app)
>>
>>   Applications/mitkWorkbench/cmake_install.cmake:201 (fixup_bundle)
>>
>>   Applications/cmake_install.cmake:33 (INCLUDE)
>>
>>   cmake_install.cmake:99 (INCLUDE)
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Managing the Performance of Cloud-Based Applications
>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>> Read the Whitepaper.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>> _______________________________________________
>> mitk-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>
>>
>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to