Dear all,

We are experiencing a problem packaging our application in macOS.

First, let me provide some context. We are implementing our application
running as an external project over an MITK build (2018.04.2), we followed
the Extension project template and through recent time and help from this
mailing list, we managed to make our project compile in both ubuntu and
macOS. We are also using an external project (VMTK), which is cloned and
built into the ep/src successfully.

The problem we are running into comes when packaging, i.e running a *make
package* in the MITK-build directory. Everything seems to be linked and
copied correctly, except for our external project VMTK. I'll first get
errors regarding libraries not being copied correctly, and when actually
trying to link the files, we get the bigger error that stops the packaging:

208/530: copying '@rpath/libvtkvmtkComputationalGeometry.dylib'

Error copying file "@rpath/libvtkvmtkComputationalGeometry.dylib" to
"/path/to/mitk-super/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-v2018.04.2-local_changes-macos-x86_64/MitkMainApp.app/Contents/MacOS/libvtkvmtkComputationalGeometry.dylib".

...

...

error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: can't
open file: 
/path/to/mitk-super/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-v2018.04.2-local_changes-macos-x86_64/MitkMainApp.app/Contents/MacOS/libvtkvmtkCommon.dylib
(No such file or directory)

CMake Error at /path/to/mitk-src/CMake/BundleUtilities.cmake:883 (message):

  Command failed:


   'install_name_tool' '-id'
'@executable_path/../MacOS/libvtkvmtkCommon.dylib' '/path/to/mitk-super
/MITK-build/_CPack_Packages/Darwin/DragNDrop/MITK-v2018.04.2-local_changes-macos-x86_64/MitkMainApp.app/Contents/MacOS/libvtkvmtkCommon.dylib'



I have two hypotheses as to why this is happening and how to fix it:
First: VMTK does not have an install target built, therefore it is not
possible to do a make install, and its libraries are not being copied into
the ep/lib/ folder.
Second: I remember the FixMacOSInstaller.cmake file, which is not linking
any of the libraries from the external projects. I thought I could add
something there.. but I'm not sure how.

I wonder if (in the meantime) it would suffice to copy VMTK's libraries
(which are properly being generated) into the ep/lib folder. Any ideas?

Thank you very much for your time, looking forward to your answer.

Kind regards,
José Alonso

On Wed, 5 Jun 2019 at 09:07, Dinkelacker, Stefan <
s.dinkelac...@dkfz-heidelberg.de> wrote:

> Thank you! We plan to add an example app in near future to the project
> template and your input will probably save us quite some time. :-)
>
>
>
> Regarding the shortlinks it is a dirty workaround for now as far as I
> remember. The thing is, there shouldn’t be a compile-time or link-time
> dependence to any autoload module, making the autoloading pretty much
> pointless, right? However, we didn’t notice we have one of such a
> dependency last minute before the actual release and it only showed up on
> macOs so we decided to work around this by creating symlinks to autoload
> modules beside the application executable until the affected module is
> restructured accordingly.
>
>
>
> We also run into the CMake warning regarding CMP0042 but as far as I can
> tell it doesn’t lead to any issues.
>
>
>
> Best,
>
> Stefan
>
>
>
> *From:* José Alonso Solís Lemus [mailto:alonso.j...@gmail.com]
> *Sent:* Tuesday, June 4, 2019 4:46 PM
> *To:* Dinkelacker, Stefan <s.dinkelac...@dkfz-heidelberg.de>
> *Cc:* mitk-users@lists.sourceforge.net
> *Subject:* Re: [mitk-users] [Migrating to MITK v2018.04.2] Problems with
> external applications
>
>
>
> Hi all!
>
> Regarding the ID issue, I did three things on the
> Applications/CMakeLists.txt in my project folder. (For context, I have a
> variable called MY_APP_NAME, which I'll reference in the text below:
>
>
>
> 1. *Removed the **_plugins variable*. Before I would have only the
> plugins I thought I needed for our project, I removed it in favour of
> building all MITK plugins. I added a variable _exclude_plugins which I add
> to the mitkFunctionCreateBlueBerryApplication macro. The excluded plugins
> are exactly the same as the ones set in the Workbench.
>
> 2. *Added the meta-dependencies*.
>
> if(TARGET ${CMAKE_PROJECT_NAME}-autoload)
>
>     add_dependencies(${MY_APP_NAME} ${CMAKE_PROJECT_NAME}-autoload)
>
> endif()
>
> 3. *Added a build time dependency to  legacy BlueBerry bundles*.
>
>   if(MITK_MODULES_ENABLED_PLUGINS)
>
>     add_dependencies(${MY_APP_NAME} ${MITK_MODULES_ENABLED_PLUGINS})
>
>   endif()
>
>
>
> After that, it all seemed to work! If it still doesn't make sense for you,
> I'm happy to have a look into my git changes, but I'm 95% sure I did
> nothing outside these three aspects.
>
>
>
> Regarding the macOS installation, thank you for the hint. I'll try digging
> to see what can find, the only difference I see is some symlinks being
> created. Although, you did make me question whether I have the right MITK
> tag (I think I have a different one on the Mac than on linux, so I'll
> check).
>
>
>
> The problem I'm seeing is that I see no error or flag being raised. The
> MITK build seems to work perfectly fine, but at the end of the make
> command, I do not see the "[100%] Built target MyApp" I would expect to see
> and of course, the MITK-build/bin folder does not have MyApp anywhere.
>
>
>
> The only thing that seems different is when running make, just after the
> summary of all modules being built, I get the following:
>
>
>
> CMake Warning (dev):
>
>   Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run
> "cmake
>
>   --help-policy CMP0042" for policy details.  Use the cmake_policy command
> to
>
>   set the policy and suppress this warning.
>
>
>
>   MACOSX_RPATH is not specified for the following targets:
>
>
>
>    CppMicroServices
>
>    TestModuleA
>
>    TestModuleA2
>
>    TestModuleAL
>
>    TestModuleAL2
>
>    TestModuleAL2_1
>
>    TestModuleAL_1
>
>    TestModuleB
>
>    TestModuleH
>
>    TestModuleM
>
>    TestModuleR
>
>    TestModuleRA
>
>    TestModuleRL
>
>    TestModuleS
>
>    TestModuleSL1
>
>    TestModuleSL3
>
>    TestModuleSL4
>
>    mymodule
>
>
>
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
>
>
> Do you think this is related? I have no idea how to fix this. In fact, I
> think MITK already addresses this?
>
>
>
> Will keep in touch :)
>
>
>
> Kind regards,
>
> José Alonso
>
>
>
> On Tue, 4 Jun 2019 at 13:26, Dinkelacker, Stefan <
> s.dinkelac...@dkfz-heidelberg.de> wrote:
>
> Hi, good to hear. Do you have any hints on the missing ID issue?
>
>
>
> Regarding macOS packaging, well, it’s complicated and we would need
> specific information on what is going wrong. Getting our packaging script
> right on macOS was a little nightmare and we still have a custom fix script
> after the actual packaging to get things working (maybe that’s already a
> good hint):
> https://github.com/MITK/MITK/blob/v2018.04.2/CMake/FixMacOSInstaller.cmake
>
>
>
> Best,
>
> Stefan
>
>
>
> *From:* José Alonso Solís Lemus [mailto:alonso.j...@gmail.com]
> *Sent:* Tuesday, June 4, 2019 12:59 PM
> *To:* Dinkelacker, Stefan <s.dinkelac...@dkfz-heidelberg.de>
> *Cc:* mitk-users@lists.sourceforge.net
> *Subject:* Re: [mitk-users] [Migrating to MITK v2018.04.2] Problems with
> external applications
>
>
>
> Hello!
>
>
>
> I've managed to compile properly the project properly by following both
> the Diffusion app and the Workbench. It works well on Ubuntu, even the
> packaging.
>
>
>
> Now our focus is building the app for macOS. We have managed to make the
> project compile, however our app is not being packaged properly. Do you
> have any ideas?
>
>
>
> Kind regards,
>
> José Alonso
>
>
>
> On Fri, 24 May 2019 at 20:02, José Alonso Solís Lemus <
> alonso.j...@gmail.com> wrote:
>
> Hello!
>
>
>
> Thank you for your reply. I started following the Workbench. I got it to
> work (compiled+running), it is now not "finding the editor". I followed
> both the Workbench and the Diffusion app. I'll be happy to give more
> information as needed. So if I get it to work, I'll reply back to this
> thread.
>
>
>
> Thank you for confirming I'm on the right track!
>
>
>
> Kind regards,
>
> José Alonso
>
>
>
> On Fri, 24 May 2019 at 16:45, Dinkelacker, Stefan <
> s.dinkelac...@dkfz-heidelberg.de> wrote:
>
> Hi Jose, recently two colleagues stumbled upon the same id problem. One
> person started from the Diffusion app as an example and run into the
> problem, the second person did it as well at the same time but it worked
> and they continued with that version then. It possibly will take a few days
> but we try to identify the difference and may give you an answer. Please
> tell us if you figure it out by yourself, though. :)
>
>
>
> *From:* José Alonso Solís Lemus [mailto:alonso.jasl+...@gmail.com]
> *Sent:* Thursday, May 23, 2019 4:01 PM
> *To:* mitk-users@lists.sourceforge.net
> *Subject:* [mitk-users] [Migrating to MITK v2018.04.2] Problems with
> external applications
>
>
>
> Dear MITKers,
>
>
>
> Thank you very much for your help so far.
>
>
>
> We have other inquiries regarding the upgrade of our app. For context,
> I'll repeat some of the things I've said already in this thread. We are in
> the process of migrating our application from v2016.03 to v2018.04.2,
> following the external project template. We used to have an application,
> for which in the 2016 build would have its *Apps* directory, which we
> took from the external project template in v2016.
>
>
>
> Right now, we got the MITK build to compile with our external Modules and
> Plugins, some of them even come through nicely in the Workbench. However,
> as mentioned before, we used to have a standalone app developed. The
> external projects template only includes examples for modules, plugins and
> command line applications. I looked through the ./CMakeLists.txt and
> noticed that it is possible to have an Applications folder, so I tried
> adapting our original Apps directory into an Applications, following
> roughly the Applications folder in the MITK source. The whole MITK build
> finishes successfully, however, when trying to run it, we get an error
> message, which in summary shows the following:
>
>
>
> 0.325! WARNING: Application launch failed: Application Exception: No
> application id has been found.
> ...
> !0.325! WARNING: Startup error: Application Exception: No application id
> has been found.
> ...
> Segmentation fault (core dumped)
>
>
>
> Perhaps a problem with libMitkAppUtil, of some of the CTK libraries? I'm
> not sure. I'm pasting the full error message at the bottom of this.
>
>
>
> Specifically, if we're aiming to produce a standalone application in which
> our developments can then be later be packaged into binaries, do we need to
> do something extra that is not in the External Project Template? Is there a
> place we could check how to make it work or perhaps a checklist of places
> we could try looking into?
>
>
>
> I hope I explained the problem well, please ask any questions you might
> still have. Looking forward to your response.
>
>
>
> Kind regards,
>
> Jose Alonso
>
>
>
> Full error:
>
> 0.325! WARNING: Application launch failed: Application Exception: No
> application id has been found.
> at 0x7f9fe1830837: ??? + 0xe1830837 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKCore.so.0.1
> at 0x7f9fe18303a1: ctkBackTrace::ctkBackTrace(unsigned long) + 0xd3 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKCore.so.0.1
> at 0x7f9fe18594af: ctkException::ctkException(QString const&) + 0x49 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKCore.so.0.1
> at 0x7f9fe8a723c7: ctkApplicationException::ctkApplicationException(int,
> QString const&) + 0x35 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fc4ba538b: ??? + 0xc4ba538b in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/plugins/liborg_blueberry_core_runtime.so
> at 0x7f9fc4c11287: ??? + 0xc4c11287 in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/plugins/liborg_blueberry_core_runtime.so
> at 0x7f9fe8a004e7: ??? + 0xe8a004e7 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe89ffd80: ??? + 0xe89ffd80 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe8a3307a: ctkPluginFrameworkLauncher::run(QVariant const&) +
> 0x2f6 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe8a32981: ctkPluginFrameworkLauncher::run(QRunnable*, QVariant
> const&) + 0x159 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe9db79d1:
> mitk::BaseApplication::main(std::vector<std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > > > const&) + 0x15d in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/libMitkAppUtil.so
> at 0x7f9fe87848ae: Poco::Util::Application::run() + 0x6a in
> /home/jsl19/dev/mitk-cemrg/ep/lib/libPocoUtild.so.60
> at 0x7f9fe9dba7f4: mitk::BaseApplication::run() + 0x64 in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/libMitkAppUtil.so
> at 0x401130: ??? + 0x401130 in ./MITK-build/bin/CemrgApp
> at 0x7f9fe8ccd830: __libc_start_main + 0xf0 in
> /lib/x86_64-linux-gnu/libc.so.6
> at 0x400f39: ??? + 0x400f39 in ./MITK-build/bin/CemrgApp
> !0.325! WARNING: Startup error: Application Exception: No application id
> has been found.
> at 0x7f9fe1830837: ??? + 0xe1830837 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKCore.so.0.1
> at 0x7f9fe18303a1: ctkBackTrace::ctkBackTrace(unsigned long) + 0xd3 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKCore.so.0.1
> at 0x7f9fe18594af: ctkException::ctkException(QString const&) + 0x49 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKCore.so.0.1
> at 0x7f9fe8a723c7: ctkApplicationException::ctkApplicationException(int,
> QString const&) + 0x35 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fc4ba538b: ??? + 0xc4ba538b in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/plugins/liborg_blueberry_core_runtime.so
> at 0x7f9fc4c11287: ??? + 0xc4c11287 in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/plugins/liborg_blueberry_core_runtime.so
> at 0x7f9fe8a004e7: ??? + 0xe8a004e7 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe89ffd80: ??? + 0xe89ffd80 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe8a3307a: ctkPluginFrameworkLauncher::run(QVariant const&) +
> 0x2f6 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe8a32981: ctkPluginFrameworkLauncher::run(QRunnable*, QVariant
> const&) + 0x159 in
> /home/jsl19/dev/mitk-cemrg/ep/src/CTK-build/CTK-build/bin/libCTKPluginFramework.so.0.1
> at 0x7f9fe9db79d1:
> mitk::BaseApplication::main(std::vector<std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > > > const&) + 0x15d in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/libMitkAppUtil.so
> at 0x7f9fe87848ae: Poco::Util::Application::run() + 0x6a in
> /home/jsl19/dev/mitk-cemrg/ep/lib/libPocoUtild.so.60
> at 0x7f9fe9dba7f4: mitk::BaseApplication::run() + 0x64 in
> /home/jsl19/dev/mitk-cemrg/MITK-build/lib/libMitkAppUtil.so
> at 0x401130: ??? + 0x401130 in ./MITK-build/bin/CemrgApp
> at 0x7f9fe8ccd830: __libc_start_main + 0xf0 in
> /lib/x86_64-linux-gnu/libc.so.6
> at 0x400f39: ??? + 0x400f39 in ./MITK-build/bin/CemrgApp
> Segmentation fault (core dumped)
>
>
>
>
> --
>
> - José Alonso Solís Lemus -
>
>
>
>
> --
>
> - José Alonso Solís Lemus -
>
>
>
>
> --
>
> - José Alonso Solís Lemus -
>
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to