Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM 15 bump #11

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

LLVM 15 bump #11

wants to merge 25 commits into from

Conversation

bollu
Copy link
Owner

@bollu bollu commented Oct 3, 2022

Check that bumping the release up to LLVM 15, and adding LLVM 14 to the nix config does not break the build.

@github-actions
Copy link

github-actions bot commented Oct 3, 2022

Thanks for your contribution! Please make sure to follow our Commit Convention.

bollu and others added 19 commits October 14, 2022 13:28
Co-authored-by Sebastian Ullrich<sebasti@nullri.ch>
This replaces the hardcoded 'llvm/lib/x86_64-unknown-linux-gnu/lib'
with 'llvm/lib/*/lib'. This is necessary to be able to handle both
x86_64 and aarch64.
This is for me to check my mental model; AFAIU, we want
to set the host compiler to have this configured correctly.
By luck, on the other builds, it used to be the case that
'llvm-host' is symlinked to 'llvm'.
Just like the 'lib/' data is now in 'lib/<target-triple>',
it seems like a similar change has happened to 'include'. Copy
the file '__config_site' outside of
'include/<target-triple>/c++/v1/__config_site'
to live in
'include/c++/v1/__config_site'.
set '-resource-dir $PWD/stage1/lib/clang/14.0.0'
to '-resource-dir $PWD/stage1/lib/clang/15.0.1'.

TIL what '-resource-dir' is. It holds compiler
specific includes (eg. `stdbool`) and libraries
(eg. constructor and destructor things from 'libcrt{begin/end}'.
We use the `host` compiler (which is going to be `x86_64`), while
linking against the `target`runtime (which is `aarch64`) to produce the
Lean toolchain.

The `sysroot` option sets the path for the `host` compiler to pickup the
runtimes for the `target`? So in our case, the `sysroot` should point to
the `aarch64` runtime (ie, the `target` runtime).
We only care about 'llvm' (target), not 'llvm-host',
as the runtime we link against is the target `aarch64` runtime,
not the host `x86_64` runtime.
Note that the path bugs exist for both the host and the
target compiler. Setup the paths for the host compiler
runtime as well, thereby preventing errors like:

-- Check for working CXX compiler: /home/runner/work/lean4/lean4/build/llvm-host/bin/clang++ - broken
  The C++ compiler
"/home/runner/work/lean4/lean4/build/llvm-host/bin/clang++"
is not able to compile a simple test program.
It fails with the following output:
/home/runner/work/lean4/lean4/build/llvm-host/bin/clang++    -o CMakeFiles/cmTC_a289a.dir/testCXXCompiler.cxx.o -c /home/runner/work/lean4/lean4/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
/home/runner/work/lean4/lean4/build/llvm-host/bin/clang++: error while loading shared libraries: libunwind.so.1: cannot open shared object file: No such file or directory
make[1]: *** [CMakeFiles/cmTC_a289a.dir/build.make:78: CMakeFiles/cmTC_a289a.dir/testCXXCompiler.cxx.o] Error 127
make[1]: Leaving directory '/home/runner/work/lean4/lean4/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_a289a/fast] Error 2
Replicate the <__config_site> header fix from the
target compiler on the host compiler.
I am unsure why this suddenly breaks.
I am unsure what flags are passed to the linker.
Dump 'Scrt1.o' in the obvious location of the 'sysroot/lib',
and check if this succeeds. This is for me to understand
why the linker fails.
I hope I didn't clean up too much...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants