Packaging dylibs into app bundles

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Packaging dylibs into app bundles

Harry Mallon-2

Hello all,

 

Is there a good tutorial/article on getting CMake to package required dylibs and frameworks into an app bundle for you on mac. We have a lot of custom stuff to do it and it is fragile and breaks a lot.

 

Thanks,

Harry

Harry Mallon

Senior Software Engineer

T <A id=c1-id-17 style="TEXT-DECORATION: none; COLOR: gray" href="callto:+44 203 7000 989">+44 203 7000 989 

60 Poland Street | London | England | W1F 7NT

Three Billboards Blade Runner 2049  I, Tonya



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Packaging dylibs into app bundles

Stephen McDowell
Hi Harry,

I don't know how useful this will be, but the Instant Meshes application creates an app bundle that has always worked reliably for me. Looking at the code, it doesn't appear like there's much custom stuff going on either. It starts here


And there's an if APPLE block below that appears to be the core.

Hope that is useful :) I've never actually done this for any of my own projects though. And I'm pretty sure them setting the underlying GUI library and TBB to be static (as opposed to shared) is skirting around the issue that you are trying to solve (dylib stuff)...

-Stephen

On Thu, Jul 19, 2018, 9:03 AM Harry Mallon <[hidden email]> wrote:

Hello all,

 

Is there a good tutorial/article on getting CMake to package required dylibs and frameworks into an app bundle for you on mac. We have a lot of custom stuff to do it and it is fragile and breaks a lot.

 

Thanks,

Harry

Harry Mallon

Senior Software Engineer

T <a id="m_2507027356817711930c1-id-17" style="TEXT-DECORATION:none;COLOR:gray" href="callto:+44%20203%207000%20989" target="_blank" rel="noreferrer">+44 203 7000 989 

60 Poland Street | London | England | W1F 7NT

Three Billboards Blade Runner 2049  I, Tonya


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Packaging dylibs into app bundles

Harry Mallon-2

Hi,

 

I have been messing arounds with fixup_bundle (which seems to be the correct function). It worked for a small test case, but only if the dylibs required had otool ids of their full path. Ours currently have rpath based ones (e.g. @rpath/libcrypto.dylib). So I get a lot of:

 

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: '@rpath/ libcrypto.dylib’: No such file or directory 

 

Hmm, seems like the stuff is there somewhere to make this work…

 

Best,

Harry

 

From: Stephen McDowell <[hidden email]>
Date: Thursday, 19 July 2018 at 17:35
To: Harry Mallon <[hidden email]>
Cc: CMake MailingList <[hidden email]>
Subject: Re: [CMake] Packaging dylibs into app bundles

 

Hi Harry,

 

I don't know how useful this will be, but the Instant Meshes application creates an app bundle that has always worked reliably for me. Looking at the code, it doesn't appear like there's much custom stuff going on either. It starts here

 

 

And there's an if APPLE block below that appears to be the core.

 

Hope that is useful :) I've never actually done this for any of my own projects though. And I'm pretty sure them setting the underlying GUI library and TBB to be static (as opposed to shared) is skirting around the issue that you are trying to solve (dylib stuff)...

 

-Stephen

 

On Thu, Jul 19, 2018, 9:03 AM Harry Mallon <[hidden email]> wrote:

Hello all,

 

Is there a good tutorial/article on getting CMake to package required dylibs and frameworks into an app bundle for you on mac. We have a lot of custom stuff to do it and it is fragile and breaks a lot.

 

Thanks,

Harry

Harry Mallon

Senior Software Engineer

T <a href="callto:&#43;44%20203%207000%20989" target="_blank">+44 203 7000 989 

60 Poland Street | London | England | W1F 7NT

Three Billboards

Blade Runner 2049

 I, Tonya

 

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Packaging dylibs into app bundles

Michael Jackson

You need to pass in more paths to the “fixup_bundle()” method. Those paths are the paths where the libraries are located so CMake has somewhere else to look in case the absolute path is not encoded in the dylib itself. I could point you to our project but it is pretty scary in there. We use a custom generated CMake script that does a bunch of extra stuff that Qt requires (qt.conf) and stuff like that. Does work reliably for use once we got it setup.

 

https://github.com/BlueQuartzSoftware/CMP/tree/develop/OSX_Tools

https://github.com/BlueQuartzSoftware/CMP/blob/develop/OSX_Tools/CompleteBundle.cmake.in

https://github.com/BlueQuartzSoftware/CMP/blob/develop/OSX_Tools/MacOSXBundleInfo.plist.in

 

They probably are not an “exemplar” of how to do things as they were created when CMake 3.1 was new so there are probably better ways to get the same thing done but this works in our environment. I have a whole separate bash script that lets us create a signed .dmg file.

 

--

Mike Jackson

 

On 7/19/18, 2:04 PM, "CMake on behalf of Harry Mallon" <[hidden email] on behalf of [hidden email]> wrote:

 

Hi,

 

I have been messing arounds with fixup_bundle (which seems to be the correct function). It worked for a small test case, but only if the dylibs required had otool ids of their full path. Ours currently have rpath based ones (e.g. @rpath/libcrypto.dylib). So I get a lot of:

 

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: '@rpath/ libcrypto.dylib’: No such file or directory 

 

Hmm, seems like the stuff is there somewhere to make this work…

 

Best,

Harry

 

From: Stephen McDowell <[hidden email]>
Date: Thursday, 19 July 2018 at 17:35
To: Harry Mallon <[hidden email]>
Cc: CMake MailingList <[hidden email]>
Subject: Re: [CMake] Packaging dylibs into app bundles

 

Hi Harry,

 

I don't know how useful this will be, but the Instant Meshes application creates an app bundle that has always worked reliably for me. Looking at the code, it doesn't appear like there's much custom stuff going on either. It starts here

 

 

And there's an if APPLE block below that appears to be the core.

 

Hope that is useful :) I've never actually done this for any of my own projects though. And I'm pretty sure them setting the underlying GUI library and TBB to be static (as opposed to shared) is skirting around the issue that you are trying to solve (dylib stuff)...

 

-Stephen

 

On Thu, Jul 19, 2018, 9:03 AM Harry Mallon <[hidden email]> wrote:

Hello all,

 

Is there a good tutorial/article on getting CMake to package required dylibs and frameworks into an app bundle for you on mac. We have a lot of custom stuff to do it and it is fragile and breaks a lot.

 

Thanks,

Harry

Harry Mallon

Senior Software Engineer

T <a href="callto:+44%20203%207000%20989" target="_blank">+44 203 7000 989 

60 Poland Street | London | England | W1F 7NT

Three Billboards

Blade Runner 2049

 I, Tonya

 

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Packaging dylibs into app bundles

Harry Mallon-2
In reply to this post by Harry Mallon-2

Hi all,

 

Fixup_bundle works very well for app bundles and seems to be the way to go! The problem I was previously seeing was fixed by setting CMAKE_INSTALL_RPATH_USE_LINK_PATH to True. This fills in the rpath on the installed executable with enough paths to resolve all the dylibs.

 

I also added a merge request to cmake to fail more obviously if the file cannot be found as in previous message.

 

My next question is: Is there a way to do a fixup bundle without a bundle?

 

i.e. I want to fixup (copy required dylibs, fix otool ids and rpaths etc) a structure like this:

 

/usr/local/myapp/bin/myapp

/usr/local/myapp/lib/libA.dylib

/usr/local/myapp/lib/libB.dylib # etc

 

 

Is there a sensible way to do this without rewriting a lot of Bundle Utilities?

 

Best,

Harry

 

 

From: Harry Mallon <[hidden email]>
Date: Thursday, 19 July 2018 at 19:04
To: Stephen McDowell <[hidden email]>
Cc: CMake MailingList <[hidden email]>
Subject: Re: [CMake] Packaging dylibs into app bundles

 

Hi,

 

I have been messing arounds with fixup_bundle (which seems to be the correct function). It worked for a small test case, but only if the dylibs required had otool ids of their full path. Ours currently have rpath based ones (e.g. @rpath/libcrypto.dylib). So I get a lot of:

 

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: '@rpath/ libcrypto.dylib’: No such file or directory 

 

Hmm, seems like the stuff is there somewhere to make this work…

 

Best,

Harry

 

From: Stephen McDowell <[hidden email]>
Date: Thursday, 19 July 2018 at 17:35
To: Harry Mallon <[hidden email]>
Cc: CMake MailingList <[hidden email]>
Subject: Re: [CMake] Packaging dylibs into app bundles

 

Hi Harry,

 

I don't know how useful this will be, but the Instant Meshes application creates an app bundle that has always worked reliably for me. Looking at the code, it doesn't appear like there's much custom stuff going on either. It starts here

 

 

And there's an if APPLE block below that appears to be the core.

 

Hope that is useful :) I've never actually done this for any of my own projects though. And I'm pretty sure them setting the underlying GUI library and TBB to be static (as opposed to shared) is skirting around the issue that you are trying to solve (dylib stuff)...

 

-Stephen

 

On Thu, Jul 19, 2018, 9:03 AM Harry Mallon <[hidden email]> wrote:

Hello all,

 

Is there a good tutorial/article on getting CMake to package required dylibs and frameworks into an app bundle for you on mac. We have a lot of custom stuff to do it and it is fragile and breaks a lot.

 

Thanks,

Harry

Harry Mallon

Senior Software Engineer

T <a href="callto:&#43;44%20203%207000%20989" target="_blank">+44 203 7000 989 

60 Poland Street | London | England | W1F 7NT

Three Billboards

Blade Runner 2049

 I, Tonya

 

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake