Hi there,

We have a longstanding problem, with our app crashing on startup on Mavericks. 
We work around this by setting the DYLD_LIBRARY_PATH before launching the app 
from a terminal console, or using the Mac Automator scripts to set the 
DYLD_LIBRARY_PATH before launching the GUI. Neither of these should be 
necessary.

However, this
https://github.com/MITK/MITK/commit/ae1fc222bd3ca4c5d988c814615d2e5866eaa0e2

was recently committed, (thanks Andreas), and I thought that would fix it. 
However, the app still crashes. We are currently using a branch based on MITK 
2013.09, but we are working on an update to MITK 2014.03, and the same problem 
exists in both, even with the above fix. (incidentally, Andreas' fix should 
probably also be applied to loading the CTK Dicom library???)

So, I eventually found this fix:
https://github.com/NifTK/MITK/commit/f47f8bc6342b42bed61a286f1fa8dd46d6a57a36

which seemed to resolve my problem, and this patch could be relevant to both 
2013.09 and 2014.03, as the same code exists in both. So, the app was crashing 
because it was taking a substring of a string that was too short.

However, Im not sure why this piece of code exists. So, I have not yet raised a 
bug. So, here’s some more detail for those that are still reading.

Our app was working OK from the build environment, but not when double clicked 
in Finder. I googled and found that when launching from finder the working 
directory is typically just /. Sure enough, having done a make package, and 
installing the GUI into /Applications/  I could reproduce the problem.  If I did

cd /
/Applications/niftk-14.04.0/NiftyView.app/Contents/MacOS/NiftyView

the application crashed here:
https://github.com/MITK/MITK/blob/master/BlueBerry/Bundles/org.blueberry.osgi/src/berryBundleLoader.cpp#L247

where the bundle->GetStorage() had a base directory of /, so this line:
https://github.com/MITK/MITK/blob/master/BlueBerry/Bundles/org.blueberry.osgi/src/berryBundleLoader.cpp#L223

adds “bin", and so, the app was looking through /bin for dynamic libraries. 
However, in my /bin, I have several small programs like sh, zsh, cp and so on. 
So, none of these are dynamic libraries, and hence none of this have a name 
longer than .dylib, so the app crashes.

However when I

cd /Users/mattclarkson
/Applications/niftk-14.04.0/NiftyView.app/Contents/MacOS/NiftyView

the bundle->GetStorage() has a base directory or /Users/mattclarkson, so the 
section in question is looking for dynamic libraries in 
/Users/mattclarkson/bin, which does not exist, and hence this line:
https://github.com/MITK/MITK/blob/master/BlueBerry/Bundles/org.blueberry.osgi/src/berryBundleLoader.cpp#L233

returns no entries, and so this loop:
https://github.com/MITK/MITK/blob/master/BlueBerry/Bundles/org.blueberry.osgi/src/berryBundleLoader.cpp#L237

is never executed.

So my fix here:
https://github.com/NifTK/MITK/commit/f81bbf980c937530dadb01d2433f8a759c026ba3

at least avoids the simple case of processing a string that is too short. 
However, I don’t understand why we are looking in those directories at all.

Any suggestions? I believe a bug should be raised, but Im not sure about the 
bigger picture.

Matt

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to