clang-3.8 on 10.4 and 10.5 PPC - available for testing for the adventuresome

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

clang-3.8 on 10.4 and 10.5 PPC - available for testing for the adventuresome

Ken Cunningham Webuse
I believe I have clang-3.8 / llvm-3.8 to a state now where people with these machines who are, shall we say, advanced MacPorters might want to waste a few minutes (and four hours building) to try it. If setting up a repo and figuring out your own dependencies is not peanuts for you, I wouldn't suggest it, though.

The portfile and supporting patches are here:

<https://github.com/kencu/LeopardPorts/tree/master/lang/llvm-3.8>

Clang-3.8 does build and work reasonably correctly on 10.5 PPC (and to a lesser extent 10.4 PPC at present).

I have backported recent fixes in the ppc va_args handling from clang-trunk, the libgcc5ABI compatibility additions made to clang-3.9+ (using patches from Debian), and also Marcus' macports-libstdc++ enhancement to allow linking against gcc6's libstdc++ (for c++11 features).


Why?
I have 8 of these machines, and I don't like to throw away perfectly good Apple hardware, especially that can still run MacOS 9.
On PPC machines, apple-gcc42 can build a lot, but not c++11 and onwards. gcc6 can build c++11 and onwards, but not more advanced ObjC.
So there is a gap for some ports, with no compiler that can build them.
Of course, there are some limitations regarding SDK as well.

It is built using gcc6, so the clang binaries themselves are linked against gcc6's libstdc++.
On 10.5 PPC, clang-3.8 can link against libc++, libstdc++, or gcc's libstdc++. This latter might in the end turn out to be the best option, although linking libc++ works  as well.
It can build reasonably complex ports successfully, like aria2, poppler, and many more that work correctly.

There are a couple of known gaps, all of which are in the range of fixable:
1) exceptions are not presently working due an addressing bug Jeremy identified. Not many ports appear to use exceptions at present. You can pass the flag -fno-exceptions to generate an error in the build if exceptions are used, so you find out during the build rather than during use.

2) openmp doesn't build on PPC. libgomp does, and that might be able to be invoked.

3)  the blocks runtime doesn't exist on 10.5 (although it has been backported to 10.5, and probably can be added).

There are probably other gaps that nobody knows about yet.

There is one caveat in the build for 10.5 -- the clang_rt_osx build file does not consider PPC builds, so until that build script gets re-written correctly to support ppc, there is one manual step needed at 14% of the build on 10.5 PPC to fix a lipo error:

{{{
cd /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/projects/compiler-rt/lib/builtins &&
sudo lipo -output /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a -create -arch ppc /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a
}}}

The build for 10.4 PPC requires a bit more manual intervention when building the same library, but in the end succeeds. This is more experimental. If you are interested in that bit, ask and I'll send you the script I use. The official build script will be rewritten eventually, I presume.

The last ld64 for 10.5 PPC was 127, which is reasonably capable. Newer versions require the blocks runtime, which is available for 10.5 PPC and newer ld64 versions have had PPC support reinstated <https://github.com/michaelweiser/ld64>, so it's not inconceivable that 136 or even newer (241.9 has been) might  work.

K


Loading...