Some settings in bootstrap-prefix.sh prevent bootstrap directly into LLVM/clang-5.0.1: 1. libcxx-headers is still requested but does not exist any more for new versions. 2. libcxx* is requested in versions < 3.6 for bootstraps directly into current LLVM/clang. This collides with the compiler's dependencies on current versions of the libs. 3. cmake-3.10 wants to use the system libuv even without use server. 4. llvm/clang slot bin directory needs to be added to PREROOTPATH. Reproducible: Always
Created attachment 511970 [details, diff] Changes to bootstrap-prefix.sh This is just to show the workarounds that enable bootstrap directly into LLVM/clang-5. No idea how to fix this properly. Also, bootstrap via intermediate LLVM/clang-3.4 remains broken because libcxx-headers will most likely block upgrade of libcxx{,abi}. libcxx-headers would still need to be eradicated for the old versions as well (https://bugs.gentoo.org/538364) and somehow declared as replaced by libcxx so it's automatically unmerged upon upgrade.
With these changes and LATEST_TREE_YES=1 I am able to bootstrap directly into LLVM/clang-5.0.1 on 10.12 and 10.13. Additional resources needed: - ldwrapper with -rpath from https://bugs.gentoo.org/642616 - libcxx* ebuilds from https://bugs.gentoo.org/538364 - clang ebuilds from https://bugs.gentoo.org/642644 - changes to cmake-utils.eclass (bug with details forthcoming) - package.keywords keywording sys-devel/llvm, sys-devel/llvm-common, sys-devel/clang, sys-devel/clang-runtime, sys-libs/compiler-rt, sys-libs/compiler-rt-sanitizers * ~* for the time being - package.use: dev-lang/python -aqua
... and I needed to patch the stage1 m4. Did that by hand (lib/vasnprintf.c) after unpacking being too lazy to add any automation to bootstrap-prefix.sh. Also, stage 3 fails with portage (rather wget) being unable to download files from HTTPS URLs. Just restarting the exact same command then instantly merges wget against the already installed openssl and portage can continue. I have not looked into the reason for that.
> - clang ebuilds from https://bugs.gentoo.org/642644 https://bugs.gentoo.org/642668
> - changes to cmake-utils.eclass (bug with details forthcoming) https://bugs.gentoo.org/642668
I tried bootstrapping on 10.8. It needs some help to work itself out of llvm-3.4.2 but looks good regarding compilation of 5.0.1 versions of LLVM components. I have noticed two problems that would need fixing for older macOS releases: 1. binutils-config wrapper in ${ROOT}/tmp adds rpaths to ${ROOT}/tmp/{,usr/}lib. This is fine and necessary during stage2 but problematic in stage3 when compiling into ${ROOT}. In particular it makes stage 3 compier binaries in ${ROOT} load ${ROOT}/tmp/usr/lib/libc++.1.dylib, which is an older version than what they were compiled against. This is bound to cause breakage. Maybe at the end of stage2 binutils-config could be installed again into ${ROOT}/tmp but targetting ${ROOT}? 2. Whether clang defaults to -stdlib=libc++ is system not compiler version dependant. On 10.8 clang-3.4.2 as well as stage 3 clang-5.0.1 need intensive help finding the library headers as well as linking against it.
While the stdlib default can be overridden in clang-5.0.1 (cmake -DCLANG_DEFAULT_CXX_STDLIB=libc++), it's hardcoded in 3.4.2: libstdc++ for <10.10 and libc++ for >=10.10. So bootstrap would need to inject -stdlib=libc++ and maybe -I${ROOT}/usr/include/c++/v1 into CXXFLAGS and LDFLAGS(!). On the positive side: libcxx-headers is a non-issue since it only ever appears in ${ROOT}/tmp and poses no conflict when merging newer versions without a -headers package into ${ROOT}.
Just BTW: Bootstrap on 10.5 x86_64 is not a happy camper: - binutils-apple-3.2 are missing - gmp-6.1.2 runs into https://bugs.gentoo.org/536894 again - gcc-apple-4.2.1 fails to compile because binutils-apple-4.3-r1 ld64 segfaults on configure tests in libstdc++-v3 which makes it fail to configure (with unhelpful configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.) I gave up there, so can't say how LLVM/clang and @rpath would have done.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=dae1cff11a36860ac0ddd1ae18cd02daec894c8a commit dae1cff11a36860ac0ddd1ae18cd02daec894c8a Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2018-01-02 16:26:54 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2018-01-02 16:26:54 +0000 scripts/bootstrap-prefix.sh: change Darwin bootstrap to use clang5 changes by Michael Weiser Bug: https://bugs.gentoo.org/642656 scripts/bootstrap-prefix.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)}
this obviously won't work until I bump the snapshot, which I intend to do tomorrow
The MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" workaround also causes warnings from cmake packages other than cmake itself because they don't define it. It's just warnings though, everything builds fine.
I didn't manage to add keywords to llvm/clang in time, so the snapshot has to wait until tomorrow.
(In reply to Michael Weiser from comment #8) > Just BTW: Bootstrap on 10.5 x86_64 is not a happy camper: > > - binutils-apple-3.2 are missing > - gmp-6.1.2 runs into https://bugs.gentoo.org/536894 again > - gcc-apple-4.2.1 fails to compile because binutils-apple-4.3-r1 ld64 > segfaults on configure tests in libstdc++-v3 which makes it fail to > configure (with unhelpful configure: error: Link tests are not allowed after > GCC_NO_EXECUTABLES.) > > I gave up there, so can't say how LLVM/clang and @rpath would have done. I've re-patched gmp-6.1.2 and re-added binutils-apple-3.2
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=bd802a20f3c8d250fd85ed66272df93583edde2a commit bd802a20f3c8d250fd85ed66272df93583edde2a Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2018-01-04 09:46:00 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2018-01-04 09:46:00 +0000 scripts/bootstrap-prefix: update snapshots Bug: https://bugs.gentoo.org/642656 Bug: https://bugs.gentoo.org/618396 Bug: https://bugs.gentoo.org/632500 Bug: https://bugs.gentoo.org/638816 scripts/bootstrap-prefix.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)}
I think we're done here, everything is pushed