[cmake-developers] "Inconsistent sizeofcmds" on Mac

Clinton Stimpson clinton at elemtech.com
Thu Sep 17 16:44:42 EDT 2015


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.

Clint


More information about the cmake-developers mailing list