Change History (6)

comment:1 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

The problem seems to be that Clang does not provides max_align_t in stdio.h as it should for a C11 compiler.
This causes problems in at least three files.
One solution is to patch the three files.
The other option is to use a more standards compliant compiler (see the pull request).
N.B. that this fix requires another pull request to be merged first.

comment:2 Changed 5 years ago by kencu (Ken)

It looks like clang fixed this in <https://reviews.llvm.org/rL201729>.. Presumably that made it into clang-3.7.

comment:3 Changed 5 years ago by kencu (Ken)

While we sort this out, for the impatient, sudo port -v upgrade icu configure.compiler=macports-clang-3.7 or a newer clang than that.

comment:4 Changed 5 years ago by erikbs

I am also on 10.9 and encountered this problem. Even though I have set clang 9.0 (mp-clang-9.0) as my default compiler (and also llvm 9.0 as my default llvm), MacPorts chose to use the one from Xcode 6.2 instead:

:debug:configure Preferred compilers: clang macports-clang-9.0 macports-clang-8.0 macports-clang-7.0 macports-clang-6.0 macports-clang-5.0 macports-clang-3.7 macports-clang-3.4
:debug:configure Using compiler 'Xcode Clang'
[…]
:debug:configure CC='/usr/bin/clang'
[…]
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstddef:55:21: note: 'std::max_align_t' declared here

The path /Library/Developer/CommandLineTools belongs to the Xcode command line tools, which have not been updated for Mavericks in years. I examined the file mentioned, and just as the compiler output says, there is no definition of a max_align_t type in there. It is, however, defined in the std namespace, just as the compiler suggests. Xcode 6.2’s clang is apparently based on LLVM 3.5.

Then I looked into the version that llvm/clang 9.0 provides, i.e. /opt/local/libexec/llvm-9.0/include/c++/v1/cstddef, and in it I found these lines:

#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
    defined(__DEFINED_max_align_t) || defined(__NetBSD__)
// Re-use the compiler's <stddef.h> max_align_t where possible.
using ::max_align_t;
#else
typedef long double max_align_t;
#endif

So the fix did make it into more recent versions of clang then and icu built just fine with the configure.compiler option set, but why does MacPorts ignore my compiler choice?

comment:5 in reply to:  3 Changed 5 years ago by jmroot (Joshua Root)

Replying to kencu:

While we sort this out, for the impatient, sudo port -v upgrade icu configure.compiler=macports-clang-3.7 or a newer clang than that.

Interestingly, macports-clang-3.4 also works.

comment:6 Changed 5 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In a6a321c3be0395f4fc884cbfb607234e4fb7eb1f/macports-ports (master):

icu: fix build on 10.9

C++11 does not guarantee that max_align_t will be defined unless you
but under the std namespace.

Technically 10.9 is broken in that it doesn't implement the C
compatibility header <stddef.h> correctly in C++, but that is
deprecated anyway, so using std::max_align_t is better all round.

Closes: #59391
Closes: https://github.com/macports/macports-ports/pull/5564

Note: See TracTickets for help on using tickets.