Zulip Chat Archive
Stream: lean4
Topic: local development on apple silicon
Matthew Ballard (Aug 10 2023 at 14:19):
Right now I am relying GitHub CI to test things which is not ideal. My initial experiments with building Lean locally on my M1 machine have been mixed. For example, a few number of tests from a clone of the master on leanprover/lean4
fail. Is this to be expected?
Does anyone have any experience with local development on apple silicon? Thanks.
Eric Rodriguez (Aug 10 2023 at 14:24):
which ones? Can try to see if I can replicate. I just build with lake build <file I care about>
and let CI deal with the tests and stuff later
Matthew Ballard (Aug 10 2023 at 14:28):
https://leanprover.github.io/lean4/doc/make/index.html
Matthew Ballard (Aug 10 2023 at 14:28):
https://leanprover.github.io/lean4/doc/dev/testing.html
Matthew Ballard (Aug 10 2023 at 14:29):
I think I have working builds from make but the tests seem off
Eric Rodriguez (Aug 10 2023 at 14:30):
oh I see this is about Lean4 itself, as opposed to mathlib . I will run this stuff and see if I get any issues
Eric Rodriguez (Aug 10 2023 at 15:01):
I get a bunch of "no such file" after leanshared
:
[100%] Built target leanshared
[ ] Building /Users/ericr/repos/lean4/build/release/stage1/bin/lean
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: /Users/ericr/repos/lean4/build/release/stage1/temp/Leanc.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/Family.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/StoreInsts.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/Opaque.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/DRBMap.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/MainM.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/Binder.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../../build/release/stage1/lib/temp/Lake/Util/Proc.depend: No such file or directory
and so on
Eric Rodriguez (Aug 10 2023 at 15:01):
happens twice, actually, this one was earlier:
[ ] Building Init.lean
[ ] Building ../build/release/stage1/lib/temp/Init/Control.c
[ ] Building ../build/release/stage1/lib/temp/Init.c
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Lean/Compiler.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Lean/Class.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Lean/ParserCompiler/Attribute.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Lean/DeclarationRange.depend: No such file or directory
and so on
Eric Rodriguez (Aug 10 2023 at 15:02):
think it started at 2% but I didn't spot it:
[ 2%] Building CXX object library/compiler/CMakeFiles/compiler.dir/init_module.cpp.o
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/Data.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/Core.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/Hints.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/Conv.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/ShareCommon.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/NotationExtra.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/SimpLemmas.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/Util.depend: No such file or directory
/Users/ericr/repos/lean4/build/release/stage1/bin/../share/lean/lean.mk:110: ../build/release/stage1/lib/temp/Init/Control.depend: No such file or directory
Eric Rodriguez (Aug 10 2023 at 15:05):
and I get 73 failed tests:
Tests failed
Matthew Ballard (Aug 10 2023 at 15:06):
That failed test list looks similar
Matthew Ballard (Aug 10 2023 at 15:06):
I think I get those others too. They whip by fast
Henrik Böving (Aug 10 2023 at 17:33):
Can you run one of the comp tests using the test-single.sh script and show us the output?
Matthew Ballard (Aug 10 2023 at 17:44):
I ran the script itself but should I point it at something?
Matthew Ballard (Aug 10 2023 at 18:03):
Ok I figured out what I should
ld64.lld: warning: directory not found for option -L/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib
Matthew Ballard (Aug 10 2023 at 18:06):
I already had a SnakeLinter.lean.c
in there. Deleting it and re-running produces SnakeLinter.so
and SnakeLinter.produced.out
Matthew Ballard (Aug 10 2023 at 18:08):
For a compiler test
running C program...
rm: ./str.lean.out: No such file or directory
ld64.lld: warning: directory not found for option -L/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib
../common.sh: line 42: 25062 Abort trap: 6 LEAN_BACKTRACE=0 "$@" 2>&1
25063 Done | perl -pe 's/(\?(\w|_\w+))\.[0-9]+/\1/g' > "$f.produced.out"
Unexpected return code 134 executing './str.lean.out'; expected 0. Output:
dyld[25062]: Library not loaded: @rpath/libc++.1.dylib
Referenced from: <4C4C4451-5555-3144-A1CF-E3D6AFA1FC9A> /Users/matt/GitHub/lean4/tests/compiler/str.lean.out
Reason: no LC_RPATH's found
so it looks like rpath
is not resolving correctly again
Matthew Ballard (Aug 10 2023 at 18:08):
And I've already forgotten what Sebastian did lol
Sebastian Ullrich (Aug 10 2023 at 18:10):
That's fine, so have I
Matthew Ballard (Aug 10 2023 at 18:11):
https://github.com/leanprover/lean4/pull/2356/commits/23631eb57d0742195c627f2b08d8ebb76031a3a4
Matthew Ballard (Aug 10 2023 at 18:11):
install_name_tool -id /usr/lib/$lib stage1/lib/libc/$lib
Matthew Ballard (Aug 10 2023 at 18:11):
For the prepare-llvm.macos.sh
Sebastian Ullrich (Aug 10 2023 at 18:19):
I'm starting to think this is a general LLVM bug/Sonoma incompatibility and I simply worked around it for the release job
Matthew Ballard (Aug 10 2023 at 18:20):
@Eric Rodriguez what version of MacOS are you on?
Eric Rodriguez (Aug 10 2023 at 18:22):
13.4.1 (c) (22F770820d)
Matthew Ballard (Aug 10 2023 at 18:22):
14.0 Beta (23A5301h) for me
Matthew Ballard (Aug 10 2023 at 18:22):
So it's not just Sonoma
Sebastian Ullrich (Aug 10 2023 at 18:24):
@Eric Rodriguez And you get the same test output?
Eric Rodriguez (Aug 10 2023 at 18:25):
what exact script should I run?
Matthew Ballard (Aug 10 2023 at 18:25):
I ran ./test_single.sh str.lean
from ./tests/compiler
Eric Rodriguez (Aug 10 2023 at 18:28):
as in cd tests/compiler
? I didn't get any good output, for some reason my elan
default lean
is triggering there, and sadly that's some lean3
Matthew Ballard (Aug 10 2023 at 18:31):
I've commandeered my wife's laptop
Matthew Ballard (Aug 10 2023 at 18:35):
That seems to work, MacOS 13.4.1 (c) also
Matthew Ballard (Aug 10 2023 at 18:48):
I even nuked .elan
and did it from a fresh copy of the repo
Eric Rodriguez (Aug 10 2023 at 18:51):
does this mean my elan is borked and I should reinstall it?
Matthew Ballard (Aug 10 2023 at 18:53):
Not sure. What is the worst that can happen?
Matthew Ballard (Aug 10 2023 at 18:53):
I am swallowed in ld64.lld
warnings about having too new versions of things (lesser issue)
Scott Morrison (Aug 11 2023 at 02:25):
I get these warning too, but for now am on rather old hardware/OS version so haven't been complaining about it hoping it magically goes away soon. :-)
Matthew Ballard (Sep 28 2023 at 12:42):
Sebastian Ullrich said:
I'm starting to think this is a general LLVM bug/Sonoma incompatibility and I simply worked around it for the release job
This still seems to be present in the released version.
Scott Morrison (Oct 02 2023 at 11:26):
These linker warnings will disappear after lean4#2598 is merged, so probably v4.3.0-rc1.
Matthew Ballard (Oct 02 2023 at 12:02):
I can’t build Lean on Sonoma.
Sebastian Ullrich (Oct 02 2023 at 12:22):
I thought you were able to get up to the test suite?
Julian Berman (Oct 02 2023 at 12:33):
(It definitely builds here on Sonoma. Though I have never tried to run the test suite.)
Matthew Ballard (Oct 02 2023 at 12:50):
It looked like it built but using the toolchain with an override was wonky. The same tests fail.
Good to know this might be user error! Retrying again on a clean clone.
Matthew Ballard (Oct 02 2023 at 13:09):
Building the first 1300 files in mathlib with the toolchain is ok. I will test out the infoview once I has some things from mathlib to poke at.
Here are my
failed tests
Matthew Ballard (Oct 02 2023 at 13:18):
Sample from the LastTest.log
rm: ./unreachable.lean.out: No such file or directory
ld: library 'c++' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Failed to compile C file unreachable.lean.c
Matthew Ballard (Oct 02 2023 at 13:47):
Reran with lean4#2598 in master to the same effect
Schrodinger ZHU Yifan (Oct 03 2023 at 02:33):
Allow me to mention: https://github.blog/changelog/2023-10-02-github-actions-apple-silicon-m1-macos-runners-are-now-available-in-public-beta/ GitHub Actions: Apple silicon (M1) macOS runners are now available in public beta!
Last updated: Dec 20 2023 at 11:08 UTC