Opened 5 years ago

Last modified 4 years ago

#59717 closed defect

clang >= 3.4: Unable to build/bootstrap on Intel Tiger — at Initial Version

Reported by: dgelessus (dgelessus) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: tiger i386 Cc: @…, @…
Port: clang-3.4

Description

It is currently not possible to build clang-3.4 or newer on Intel Tiger. As a result, any ports that require C++11 cannot be built on Tiger, because MacPorts selects a recent clang (currently 9.0) when looking for a C++11-capable compiler.

This issue is somewhat complex because a lot of bootstrapping is involved, and multiple ports in the bootstrap process don't work properly on Tiger. The (simplified) bootstrap dependency chain looks like this:

  • Xcode 2.5 gcc
  • apple-gcc42
  • clang-3.4
  • icu
  • libxml2
  • libcxx
  • clang-3.7
  • newer clang (e. g. 9.0)

So far I've run into the following individual issues in the chain:

  • clang-3.4 requires libxml2 to build, which requires icu. icu requries a C++11 compiler, and MacPorts selects clang-3.4 here, which leads to a circular dependency.
    • The clang-3.4 Portfile already has a special case to handle this issue, but it doesn't get triggered on Tiger, because the cxx_stdlib is set to libstdcxx and not libcxx.
    • I've submitted a fix for this as PR 5771.
  • llvm/clang-3.7 always wants libcxx as its C++ stdlib, but the libcxx port doesn't support Tiger.
    • In PR 5783 I've attempted to make libcxx build on Tiger, but the PR is currently incomplete and would also need more extensive testing.
    • Perhaps an alternative fix would be to make clang use libstdcxx instead of libcxx on Tiger. I haven't looked into this further yet, but @kencu has a customized llvm/clang-3.8 port that uses libstdcxx, so it seems to be possible.
  • llvm-3.7's configure script tries to call clang-3.4 with the option -stdlib=macports-libstdcxx, which that version of the clang port doesn't support. This option is patched in by MacPorts for clang-5.0 and newer with the +libstdcxx variant (which is enabled by default). clang ports older than 5.0 (including 3.4) don't have a +libstdcxx variant.
    • I'm currently experimenting with backporting the +libstdcxx variant from clang-5.0 to clang-3.4. This seems to be fairly easy to do - the code affected by the patch hasn't changed significantly between the two versions.
    • It may be better to figure out why the configure script tries to use -stdlib=macports-libstdcxx in the first place. It shouldn't need to, since llvm/clang-3.7 will be built agianst libcxx, not libstdcxx.
  • llvm-3.7 references a couple of macros that don't exist on Tiger.
    • This only requires some very minor patches, which I can submit once I've tested them.
  • There may be more issues after this; I'm currently working on getting clang-3.7 fully built.

I've already discussed some of these issues separately on IRC and GitHub (thanks to @jmroot and @kencu for the help so far!). This ticket is meant to be an overview of how the issues are related, as the issues further down the list usually can't be observed without first fixing/working around the previous issues.

Also I'm not sure what the best solutions are for some of the issues, or if it even makes sense to use clang (rather than gcc) as the C++11 compiler on Tiger. Any opinions and suggestions are welcome.

Change History (0)

Note: See TracTickets for help on using tickets.