← Back to team overview

kicad-developers team mailing list archive

Re: OS X build: bundled dylibs?

 

Hi folks,

I have isolated the problem and solved it.  Thankfully, the CMake folks
have already ran into it, and solved it.

(The following is mostly for my own use when I try to figure out how these
bundles are made again.)

CMake provides BundleUtilities, which use a variety of command line OS X
tools for making standalone bundles.  They copy libraries local to the
build system into the bundle, and rewrite some things so the bundle
executables look for the bundle libraries.  To do that, they have to modify
the libraries because OS X libraries have their path encoded into the file
(or something like that.)  Many of the common ways OS X users install
libraries to their system leave the libraries with no write permissions.
This means when CMake copies the library in and tries to modify it, it
fails making the modifications.  The end result is the copied library is
included in the bundle, but the bundle executable doesn't ever look for it.

At the bottom of
http://www.cmake.org/cmake/help/v3.0/module/BundleUtilities.html, they
mention:

If the BU_CHMOD_BUNDLE_ITEMS variable is set then bundle items will be
marked writable before install_name_tool tries to change them.

I added this for kicad.app, and I think that solves the problem for all the
applications (because the other applications are symlinks into kicad.app.)

I have ran the results of make install after this through my packaging
script, and then installed contents of the resulting DMG on a clean image
of OS X 10.10 I created for regression testing this type of issue, and it
worked.

I would like to especially thank Bernhard for helping me troubleshoot this.

Adam Wolf
Cofounder and Engineer,
W&L

On Wed, Nov 5, 2014 at 2:50 PM, Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx>
wrote:

> I guess one problem is here:
>
> -- 51/66: fixing up
> '/Users/jenkins/remoteroot/workspace/KiCadMacBuild/bin/kicad.app/Contents/Frameworks/libGLEW.1.11.0.dylib'
> error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool:
> can't open input file:
> /Users/jenkins/remoteroot/workspace/KiCadMacBuild/bin/kicad.app/Contents/Frameworks/libGLEW.1.11.0.dylib
> for writing (Permission denied)
>
> Seems as if CMake can’t rewrite libGLEW.1.11.0.dylib of your build folder…
> can you check permissions?
> Do you run make and make install with different users or something like
> that?
>
> The script has to rewrite the .dylib to probably make it reference a dylib
> inside the bundle…
>
>
> Regards,
> Bernhard
>
> On 05.11.2014, at 21:47, Adam Wolf <adamwolf@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Looking at that output, for me, it is grabbing the libwx libraries, but I
> don't see libcairo or libpixman or libpng on that list.
>
> Adam Wolf
> Cofounder and Engineer
> W&L
>
> On Wed, Nov 5, 2014 at 2:46 PM, Adam Wolf <adamwolf@xxxxxxxxxxxxxxxxxxxx>
> wrote:
>
>> Hi Bernhard,
>>
>> Thank you!  Here is the make install output:
>> http://pastebin.com/pPSNTLv5
>>
>> Adam Wolf
>> Cofounder and Engineer
>> W&L
>>
>> On Wed, Nov 5, 2014 at 2:35 PM, Bernhard Stegmaier <
>> stegmaier@xxxxxxxxxxxxx> wrote:
>>
>>> Hi Adam,
>>>
>>> can you send me the output of the “make install” command?
>>> This uses CMake functions similar to what macdylibbundler does… and for
>>> me it relocates all non-standard libs to the bundle.
>>>
>>>
>>> Regards,
>>> Bernhard
>>>
>>> On 05.11.2014, at 20:55, Adam Wolf <adamwolf@xxxxxxxxxxxxxxxxxxxx>
>>> wrote:
>>>
>>> Hi folks,
>>>
>>> After sending out my dev preview to a few users, the biggest issue by
>>> far is that my OS X build points to some libraries in /usr/local, vs inside
>>> the bundle.
>>>
>>> For instance,
>>>
>>> dlopen(/Volumes/Kicad/Kicad/kicad.app/Contents/PlugIns/_pcbnew.kiface,
>>> 10): Library not loaded: /usr/local/lib/libpixman-1.0.dylib
>>>   Referenced from:
>>> /Volumes/Kicad/Kicad/kicad.app/Contents/Frameworks/libcairo.2.dylib
>>>   Reason: image not found
>>>
>>> as well as libpng.
>>>
>>> I see that there's a copy of libpng at kicad.app/Contents/Frameworks/libpng16.16.dylib.
>>> Any idea how to make it point to there instead?
>>>
>>> Could we use https://github.com/auriamg/macdylibbundler/ to make sure
>>> this doesn't happen in the future?
>>>
>>> Adam Wolf
>>> Cofounder and Engineer
>>> W&L
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>>
>>
>
>

Attachment: osx-bundlefix.patch
Description: Binary data


Follow ups

References