[PATCH]: PR target/80204 (Darwin macosx-version-min problem)

Simon Wright simon@pushface.org
Fri Sep 1 22:05:00 GMT 2017


In gcc/config/darwin-driver.c, darwin_find_version_from_kernel() assumes
that the minor version in the Darwin kernel version (16.7.0, => minor
version 7) is equal to the bugfix component of the macOS version, so that
the compiler receives -mmacosx-version-min=10.12.7 and the linker receives
-macosx_version_min 10.12.7.

Unfortunately, Apple don’t apply this algorithm; the macOS version is
actually 10.12.6.

Getting this wrong means that it’s impossible to run an executable from 
within a bundle: Sierra complains "You have macOS 10.12.6. The application
requires macOS 10.12.7 or later".

A workround would perhaps be to link the executable with
-Wl,-macosx_version_min,`sw_vers -productVersion` (I assume that it’s only
the linker phase that matters?)

I see that Apple’s gcc (Apple LLVM version 8.0.0
(clang-800.0.42.1)) specifies - only at link time -
 -macosx_version_min 10.12.0

This patch does the same.

gcc/Changelog:

	2017-09-01 Simon Wright <simon@pushface.org>

	PR target/80204
	* config/darwin-driver.c (darwin_find_version_from_kernel): eliminate calculation of the
	  minor version, always output as 0.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 80204-darwin-driver.c.diff
Type: application/octet-stream
Size: 1832 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170901/487745e7/attachment.obj>


More information about the Gcc-patches mailing list