If you’re compiling a package and run into:
:error:configure Failed to configure gmp, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_gmp/gmp/work/gmp-6.1.1/config.log :error:configure org.macports.configure for port gmp returned: configure failure: command execution failed
Then look at config.log, and find:
... In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__mutex_base:17: /usr/include/pthread.h:423:1: error: C++ requires a type specifier for all declarations __SWIFT_UNAVAILABLE_MSG("Use lazily initialized globals instead") ^ /usr/include/pthread.h:423:66: error: expected ';' after top level declarator __SWIFT_UNAVAILABLE_MSG("Use lazily initialized globals instead") ^ 2 errors generated.
In this case __SWIFT_UNAVAILABLE_MSG hasn’t been been defined. The definition is meant to come from Availability.h at /usr/include/Availability.h
A few OSX/Macports releases ago there was Issue 48471. As a workaround, some people used a locally modified Availability.h installed in /usr/local/include/ or /opt/local/include/, which are preferentially included over /usr/include/.
As the underlying problem is now resolved they are no longer required and can be deleted.
$ sudo rm /usr/local/include/Availability.h /opt/local/include/Availability.h
Once they are gone the current version of Availability.h from /usr/include/ will be included next time you try to build your package.
If you wiped out your original /usr/include/Availability.h for any reason, restore it with:
$ sudo cp /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/Availability.h /usr/include/Availability.h
Permissions are fine as they are.
Alternatively, according to https://trac.macports.org/ticket/52258#comment:13
you can comment out the problem line in pthread.h as a workaround. (note: I do not recommend this)