error: expected a platform name, e.g., 'macosx'

Joshua Root jmr at macports.org
Sat Sep 22 03:04:20 PDT 2012


On 2012-9-22 19:51 , Ryan Schmidt wrote:
> The system headers use availability macros, and at least on Mountain Lion their definitions include the word "macosx", e.g. "availability(macosx,introduced=10.5)". The problem occurs when a software package defines its own preprocessor symbol called "macosx". This might take the form of a "#define macosx" inserted into a confdefs.h file by a configure script, or a hand-written Makefile specifying "-Dmacosx". The four projects we recently fixed used this symbol to include code meant only for use on OS X, and for that use case, custom defines aren't necessary because there's already a define available for that purpose on OS X: "__APPLE__". So the fix is to remove the custom "macosx" preprocessor symbol from the project, and to change any "macosx" checks in the source files to checks for "__APPLE__" instead.

It should technically be (__APPLE__ && __MACH__). However, testing for
these is officially frowned upon. Whenever possible, upstream should
really test for specific ways in which platforms are known to differ
(presence of particular headers or libs, behaviour of particular
functions, etc.), not test for specific platforms.

- Josh


More information about the macports-dev mailing list