[MacPorts] #58199: cmake: build failure on OSX 10.11 due to LegacySupport PortGroup

MacPorts noreply at macports.org
Fri Mar 15 21:59:43 UTC 2019


#58199: cmake: build failure on OSX 10.11 due to LegacySupport PortGroup
---------------------+-----------------------
  Reporter:  dbl001  |      Owner:  michaelld
      Type:  defect  |     Status:  assigned
  Priority:  Normal  |  Milestone:
 Component:  ports   |    Version:  2.5.4
Resolution:          |   Keywords:
      Port:  cmake   |
---------------------+-----------------------

Comment (by kencu):

 Michael did some analysis on this a few weeks ago -- it has to do with
 10.11 using the 10.12 SDK:
 {{{
 Hi Ken - I was just updating cmake-devel on my various systems, and came
 upon an interesting issue that involves the legacy support port and PG on
 exactly 1 system (thus far):

 On (at least) OSX 10.11, if -both- of the following flags are used at the
 same time:

 -mmacosx-version-min=10.11

 -isysroot
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk

 ... then __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ == 101100 -but-
 "clockid_t" is defined by time.h in the SDK and thus the build errors out
 when using the Legacy support project's headers.

 If just the "-isysroot" flag is used, then
 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ == 101200 as desired and
 things work correctly. Likewise if just the -mmacosx-version-min=10.11
 flag is used (but no specific SDK), then
 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ == 101100 as desired and the
 correct headers are used that do not contain "clockid_t" and things work
 correctly. It's just this one condition that fails, which of course is
 what CMake sets by default :)

 If I do:
 {{{
 clang++ -x c++ -mmacosx-version-min=10.11 -isysroot
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
 -std=gnu++11 -dM -E - < /dev/null
 }}}
 and the like varying the "min" and "sdk", then when "-mmacosx-version-
 min=10.11" is used I can vary the SDK but the macros output are identical.
 If I remove the "-mmacosx-version-min=10.11" then I get the different
 macros for the different SDKs as desired.

 I'm really not sure of a way around this, but I'm sure there is one.
 Hopefully you can poke around some & figure out what's going on & a way
 around. If/when you get there let me know & I can test / verify on my end
 too. Cheers! - MLD
 }}}

 The build error seems to be:
 {{{
 90 /opt/local/include/LegacySupport/time.h:44:13: error: typedef
 redefinition with different types ('int' vs 'enum clockid_t')
 91      typedef int clockid_t;
 92                  ^
 93
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/time.h:171:3:
 note: previous definition is here
 94      } clockid_t;
 95
 }}}
 so if we make sure we use exactly the same typedefs in `time.h` as used in
 the 10.12 SDK I would think we should be OK.

-- 
Ticket URL: <https://trac.macports.org/ticket/58199#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list