[cmake-developers] "Inconsistent sizeofcmds" on Mac
Mike Gelfand
mikedld at mikedld.com
Thu Sep 17 18:30:02 EDT 2015
Hello,
> On Sep 17, 2015, at 11:44 PM, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> On Thursday, September 17, 2015 11:18:06 PM Mike Gelfand wrote:
>> Hello everyone,
>>
>> I’m using cmake 3.3.1 on Mac 10.10.4. I’m building an executable target on
>> Mac with the following settings:
>>
>> CMAKE_OSX_ARCHITECTURES = i386;x86_64
>> CMAKE_OSX_DEPLOYMENT_TARGET = 10.5
>> CMAKE_OSX_SYSROOT = .../MacOSX10.10.sdk
>>
>> Right after build, executable is runnable (from inside the binary dir) and
>> everything’s fine. But once I do `make install`, the executable in the
>> install prefix starts giving out errors:
>>
>> % otool -L /install/prefix/myexecutable
>> ...
>> Inconsistent sizeofcmds
>>
>> Adding INSTALL_RPATH target property (the executable depends on a number of
>> shared libraries) results in another error during `make install`, although
>> the command isn’t failing:
>>
>> % make install
>> ...
>> -- Installing: /tmp/prefix/usr/local/rmmagent/rmmagentd
>> .../install_name_tool: for architecture x86_64 object:
>> /install/prefix/myexecutable malformed object (inconsistent sizeofcmds
>> field in mach header) ...
>>
>> What helps is either a) setting BUILD_WITH_INSTALL_RPATH target property to
>> ON (with obvious inconvenience while debugging) or b) making the executable
>> non-fat (i.e. setting architecture to either i386 or x86_64, but not both;
>> which is not what I want in the end).
>>
>> Is this a defect in cmake? Is there anything I can do to work this around?
>
> I'm not sure where the defect is, or how to work around it, without getting
> more details.
>
> I've seen problems similar to this, but not exactly the same as what you are
> seeing. What I have seen before was discussed here:
> http://public.kitware.com/pipermail/cmake/2014-October/058868.html
>
> Perhaps you can go over that and see if it applies to you.
> In that case, the bug was in install_name_tool, and there was a simple test
> case to demonstrate the bug. Apple reported that it was fixed in Xcode 6.3.
With Clint’s help it became clear that it is a bug in install_name_tool after all. I reproduced the issue with Xcode 6.4 and 7.0, using the same commands as at link above except adding `-arch i386 -arch x86_64` to gcc command line. Bug reported to Apple and awaits their reply.
Thanks,
Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150918/d5ce9e91/attachment.sig>
More information about the cmake-developers
mailing list