https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80204

            Bug ID: 80204
           Summary: macosx-version-min wrong for macOS Sierra 10.12.3
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---
              Host: x86_64-apple-darwin

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

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

Getting this wrong means that it’s impossible to run an executable from 
within a bundle: Sierra complains "You have macOS 10.12.3. The application
requires macOS 10.12.4 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?)

There are several suggestions at e.g. http://stackoverflow.com/q/11072804/40851
which are perhaps unsatisfactory because of using objective-C. Perhaps we
could set up an environment variable during configure, using sw_vers as
above?

As an alternative, 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
Maybe we don’t need to include a specific bugfix component at all? That 
would make life a lot easier!

Reply via email to