[CMake] find_library and mac os x SDKs

Simmons, Aaron asimmons at rosettastone.com
Sat Mar 27 11:53:46 EDT 2010


> It is a common misconception that one needs to use the 10.4 SDK to
> create an executable that is compatible with 10.4.  This is not so.

In most cases, you're right.  However, we're linking to the iconv library.  If we don't specify the 10.4 SDK via isysroot, it will link to the wrong version of libiconv.dylib and won't run on 10.4 with this error:
    dyld: Library not loaded: /usr/lib/libiconv.2.dylib
      Referenced from: <snip>
      Reason: Incompatible library version: <snip> requires version 7.0.0 or later, but libiconv.2.dylib provides version 5.0.0
    Trace/BPT trap

The problem can be seen by inspecting the exe with otool:
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)

But if we use the 10.4 sdk, otool shows that we get the right "compatibility version" of libiconv:
	/usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.10)
which will run fine on 10.4.


Thanks,
aaron


More information about the CMake mailing list