Problems cross-compiling with clang 3.7 & 3.9 on 10.6

Mojca Miklavec mojca at macports.org
Tue Mar 28 09:18:23 UTC 2017


On 28 March 2017 at 05:07, Ken Cunningham wrote:
> It's been a few months since I went down this rabbit hole, but IIRC,
> it worked a little better to build clang on ppc directly.

Just to clarify. I want to compile some software for multiple
architecture and provide backwards compatibility for as long back as
reasonably feasible and ideally not having to depend on "weird
hardware".

That means compiling on 10.6 for ppc, i386, x86_64. I don't want to
keep a real PPC around just for that, I'm not even sure how many users
there are. As long as I can build everything on a single VM, it
doesn't take any extra effort to do it. If I had to buy a PPC and
power it up each time for building ... no, but no thanks.

It's a collection of various (C/C++) tools. The big majority of those
tools doesn't require C++11, but I'm sure the situation will get
"worse" (or should I call it better?) each year.

I guess I could potentially ship libc++ or gcc's stdlibc++ along with
binaries, but I would like to avoid that. Once maintaining binaries
for PPC becomes too cumbersome, I'll just stop building for PPC. At
the moment building for PPC still works (with gcc 4.0 or 4.2 or
whatever that is) for everything but a tiny fraction of binaries which
I just exclude at the moment.

> 10.5 intel
> fails to build PPC correctly due to the runtime library issues you
> stumbled across. The highest i have been able to go is clang-3.6 on
> ppc so far (building it on PPC, using clang-3.4). clang-3.7+ will not
> build successfully, although llvm-3.7+ does build (wouldn't trust the
> code it produces on PPC, though).

It makes absolutely no sense that I try to use a compiler that has
never been designed or tested to produce binaries for PPC.

> Libc++ works, but the exceptions don't work correctly still. But clang
> 3.4 works in a spotty fashion, and the produced binaries have
> errors. llvm > 3.4 produces buggy ppc code that crashes easily.

While there are some tools that require C++11 (just two out of
hundreds this year), building against libc++ doesn't bring any added
value to start with. If I have to ship stdlib with binaries, I can
just as well ship a newer stdlibc++ that's known to work. But I would
more likely just drop support for PPC at that point (once the set of
non-C++11 tools becomes useless).

It's just that I completely forgot that clang isn't well suited for
PPC. I'm nowadays almost "hardwired" to try to use the latest and
greatest clang that I forgot that this is only a good idea for intel
processors.

Mojca


More information about the macports-dev mailing list