[MacPorts] #53184: A cxx11-compatible clang compiler on 10.5 PPC ?Some progress...
MacPorts
noreply at macports.org
Mon May 15 18:41:49 UTC 2017
#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:
Resolution: | Keywords: leopard powerpc
Port: |
---------------------+-----------------------------
Comment (by kencu):
building clang-3.8 with gcc6 also works, with one small error in the lipo
script:
{{{
projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.10.4.dir/build
make[2]: Entering directory
`/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build'
[ 14%] Generating
../../../../lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a
cd
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/projects
/compiler-rt/lib/builtins && /opt/local/bin/cmake -E make_directory
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin
cd
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/projects
/compiler-rt/lib/builtins && lipo -output
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a
-create -arch i386
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a
-arch x86_64
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_x86_64_10.4.a
fatal error: lipo: specifed architecture type (i386) for file
(/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a)
does not match its cputype (18) and cpusubtype (0) (should be cputype (7)
and cpusubtype (3))
make[2]: *** [lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a] Error 1
make[2]: Leaving directory
`/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build'
make[1]: *** [projects/compiler-
rt/lib/builtins/CMakeFiles/clang_rt.10.4.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 14%] Building CXX object tools/clang/utils/TableGen/CMakeFiles/obj
.clang-tblgen.dir/ClangCommentCommandInfoEmitter.cpp.o
}}}
This probably is due to an assumption in the script that the build is on
Intel, because this file is actually ppc code
`libclang_rt.builtins_i386_10.4.a` and this is worked around quite easily
by going into this folder:
{{{
cd
/opt/local/var/macports/build/_opt_peggedports_lang_llvm-3.8/clang-3.8/work/build/projects
/compiler-rt/lib/builtins
}}}
And executing this slightly altered line:
{{{
sudo lipo -output
/opt/local/var/macports/build/_opt_peggedports_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_peggedports_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a
}}}
That then gives you a completed installation of clang-3.8. llvm-3.8 also
builds nicely through to completion using gcc6, so in the end we have
success:
{{{
$ clang --version
clang version 3.8.1 (tags/RELEASE_381/final)
Target: powerpc-apple-darwin9.8.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-3.8/bin
}}}
We then have two clang compilers, 3.7 and 3.8, that work without
segfaulting on 10.5 PPC. This was successful at building a fairly complex
cxx11 port, aria2:
{{{
$ port -v installed aria2
The following ports are currently installed:
aria2 @1.31.0_0 (active) platform='darwin 9' archs='ppc'
date='2017-05-14T18:21:11-0700'
}}}
which has proper linking against libc++:
{{{
$ otool -L /opt/local/bin/aria2c
/opt/local/bin/aria2c:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
(compatibility version 150.0.0, current version 476.19.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current
version 1.2.11)
/opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0,
current version 12.4.0)
/opt/local/lib/libgnutls.30.dylib (compatibility version 45.0.0,
current version 45.2.0)
/opt/local/lib/libnettle.6.dylib (compatibility version 6.0.0,
current version 6.1.0)
/opt/local/lib/libgmp.10.dylib (compatibility version 14.0.0,
current version 14.2.0)
/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0,
current version 10.5.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security
(compatibility version 1.0.0, current version 26935.0.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)
}}}
which runs, finds it's libraries, and appears to work normally so far,
with limited testing:
{{{
$ aria2c
Specify at least one URL.
Usage: aria2c [OPTIONS] [URI | MAGNET | TORRENT_FILE | METALINK_FILE]...
See 'aria2c -h'.
}}}
--
Ticket URL: <https://trac.macports.org/ticket/53184#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list