[MacPorts] #53184: A cxx11-compatible clang compiler on 10.5 PPC ?Some progress...

MacPorts noreply at macports.org
Fri Dec 30 21:55:01 CET 2016


#53184: A cxx11-compatible clang compiler on 10.5 PPC ?Some progress...
-------------------------+-----------------
 Reporter:  kencu        |      Owner:
     Type:  defect       |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  ports        |    Version:
 Keywords:  leopard PPC  |       Port:
-------------------------+-----------------
 We have been trying for a while now to get a current version of clang
 working on 10.5 - specifically PPC - and this ticket is keep a log of
 successes and failures in this regard. Jeremy's recent 10.5 fixes have
 enabled 10.5 Intel to have a working version of libc++ and clang-3.7 that
 can cross-compile simple PPC apps.

 I have had some success with clang-3.6 on 10.5 PPC, so I thought I would
 document how that worked in case anyone would like to try it, or
 alternatively has some ideas how to better test it and/or improve the
 situation.

 When I tried, I could not build libcxx on PPC with clang-3.4, but it does
 (as Jeremy documents) build with clang-3.4 on 10.5 Intel with PPC slices.
 I copied the following files built on the 10.5 Intel system

 {{{
 libcxx-3.9.0_0+universal.darwin_9.i386-ppc-x86_64.tbz2
 libcxxabi-3.9.0_0+universal.darwin_9.i386-ppc-x86_64.tbz2
 libffi-3.2.1_0+universal.darwin_9.i386-ppc-x86_64.tbz2
 libmacho-886_0+universal.darwin_9.i386-ppc-x86_64.tbz2
 libedit-20160618-3.1_1+universal.darwin_9.i386-ppc-x86_64.tbz2
 libunwind-3.9.0_3+universal.darwin_9.i386-ppc-x86_64.tbz2
 libunwind-headers-3.9.0_0.darwin_9.noarch.tbz2
 ncurses-6.0_0+universal.darwin_9.i386-ppc-x86_64.tbz2
 }}}

 over to a 10.5 PPC machine, placing them into
 `/opt/local/var/macports/incoming/verified`, and then installed each one
 like this:
 {{{
 sudo port -v install PORTNAME +universal universal_arches="i386 ppc
 x86_64" supported_arches="i386 ppc x86_64"
 }}}

 I believe that was the full list of cross-compiled files that I had to
 move over.

 Next, I tried to cross-compile clang-3.7 and clang-3.8 with ppc slices.
 LLVM-3.7 and 3.8 did build with ppc slices, but they segfault when moved
 to the 10.5 ppc machine with what appears to be an error in the address
 lookup for strlen(). Neither clang-3.7 nor clang-3.8 would cross-compile
 on 10.5 Intel, in each case delivering up `error 12` during the link
 phase. Whether or not that can be overcome is to be discovered.

 Back to the 10.5 PPC machine, clang-3.4 proved to be quite touchy
 compiling software, however with some modifications as below, it would
 compile llvm/clang-3.6 through to completion.

 adding this to the clang-3.6 portfile
 {{{
 configure.cflags-append -fPIE
 configure.cxxflags-append -fPIE
 configure.ldflags-append -fPIE -nodefaultlibs -lc++ -lc++abi -lgcc_s.10.5
 configure.ldflags-append -lSystem

 and editing this to include ppc
     supported_archs i386 x86_64 ppc

 }}}

 updating macports.conf as usual
 {{{
 cxx_stdlib        libc++
 buildfromsurce    always
 delete_la_files   yes
 default_compilers macports-clang-3.4 gcc-4.2
 }}}
 and installing clang-3.6 did go through to completion.
 {{{
 clang-3.6 @3.6.2_5+analyzer (active) platform='darwin 9' archs='ppc'
 llvm-3.6 @3.6.2_4 (active) platform='darwin 9' archs='ppc'
 }}}

 clang-3.6 appears to work correctly
 {{{
 $ clang --version
 clang version 3.6.2 (tags/RELEASE_362/final)
 Target: powerpc-apple-darwin9.8.0
 Thread model: posix
 }}}
 and the llvm-binaries don't segfault (like the cross-compiled ones did)
 {{{

 $ /opt/local/bin/llvm-tblgen-mp-3.6 --version
 LLVM (http://llvm.org/):
   LLVM version 3.6.2
   Optimized build.
   Built Dec 29 2016 (18:30:54).
   Default target: powerpc-apple-darwin9.8.0
   Host CPU: 970
 }}}

 and so far simple apps build and link against libc++
 {{{

 $ helloworld
 Hello World!

 $ otool -L /opt/local/bin/helloworld
 /opt/local/bin/helloworld:
         /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
 version 3.9.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 111.1.7)
         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
 version 697.0.0)
         /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current
 version 3.9.0)
 }}}

 and a few more complex apps also build and run
 {{{

 $ otool -L /opt/local/bin/nzbget
 /opt/local/bin/nzbget:
         /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current
 version 1.2.8)
         /opt/local/lib/libgnutls.30.dylib (compatibility version 37.0.0,
 current version 37.8.0)
         /opt/local/lib/libncurses.6.dylib (compatibility version 6.0.0,
 current version 6.0.0)
         /opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0,
 current version 12.4.0)
         /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
 version 3.9.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 111.1.7)
         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
 version 697.0.0)
         /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current
 version 3.9.0)


 $ nzbget --version
 nzbget version: 14.1
 }}}

 at this time, clang-3.7 / llvm-3.7 will not build through on 10.5 PPC, and
 the cross-compiled llvm-3.7 segfaults on PPC.

 Hope this helps someone. K

--
Ticket URL: <https://trac.macports.org/ticket/53184>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list