[CMake] Installation corrupts library on OS X

Peter Eastman peastman at stanford.edu
Tue Oct 14 13:19:41 EDT 2014


Hi Clint,

You're absolutely right:

$ otool -l libOpenMMAmoebaCUDA.dylib | grep -A2 LC_RPATH
          cmd LC_RPATH
      cmdsize 32
         path /usr/local/cuda/lib (offset 12)
--
          cmd LC_RPATH
      cmdsize 32
         path /usr/local/cuda/lib (offset 12)

I'll try to figure out where the duplicate is coming from and see if that fixes it.

I'd be glad to report this to Apple, but I can't figure out how to reproduce the problem without using CMake.  I tried using install_name_tool to directly change all the paths myself, and that worked fine.  It didn't produce the problem.  Is CMake doing something different from just a series of calls to "install_name_tool -change" and "install_name_tool -id"?

Peter


On Oct 13, 2014, at 7:33 PM, clinton at elemtech.com wrote:

> Yeah, I think you have duplicate LC_RPATH load commands.  In that case, your binaries can be corrupted by install_name_tool during "make install."
> To check if that is your case, you can run this on the binary before installation to see if you have duplicates.
> otool -l app | grep -A2 LC_RPATH
> 
> If the duplicates come from your own linker flags such as, -Wl,-rpath,/some/path, you may need to remove those.
> Otherwise, it would help if you can provide a minimal test case to reproduce the problem.
> 
> It would also help if someone could report this corruption by install_name_tool bug to Apple.  You are the second to come to this mailing list about this bug.
> 
> Clint
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141014/deab4108/attachment-0001.html>


More information about the CMake mailing list