[cmake-developers] "Inconsistent sizeofcmds" on Mac

Mike Gelfand mikedld at mikedld.com
Thu Sep 17 16:18:06 EDT 2015


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?

Regards,
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/20150917/6b174b23/attachment.sig>


More information about the cmake-developers mailing list