lean-dojo / LeanCopilot

LLMs as Copilots for Theorem Proving in Lean

Home Page:https://leandojo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors caused by breaking changes in `lean4:v4.3.0-rc2`

yangky11 opened this issue · comments

Hi Mac @tydeu,

I just noticed the changes in lean4:v4.3.0-rc2 to the directory structures. They caused a few errors in LeanDojo and LeanInfer, which I'm trying to fix. This line was
https://github.com/lean-dojo/LeanInfer/blob/dc8e2b7f4deb648733cd20f913bca812ea0ed3f0/lakefile.lean#L54
, but I changed it to
https://github.com/lean-dojo/LeanInfer/blob/b2925d5f99b35fb7b1c3ef8ad506916c4fa3fa52/lakefile.lean#L54

However, I got the following error when running lake build in a downstream package depending on lean4:v4.3.0-rc2 + LeanInfer:

error: > LEAN_PATH=./.lake/packages/std/.lake/build/lib:./.lake/packages/Qq/.lake/build/lib:./.lake/packages/aesop/.lake/build/lib:./.lake/packages/Cli/.lake/build/lib:./.lake/packages/proofwidgets/build/lib:./.lake/packages/mathlib/.lake/build/lib:./.lake/packages/LeanInfer/.lake/build/lib:./.lake/build/lib LD_LIBRARY_PATH=/home/kaiyu/local/usr/lib:/home/kaiyu/clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04/lib/x86_64-unknown-linux-gnu:/home/kaiyu/clang+llvm-13.0.1-x86_64-linux-gnu-ubuntu-18.04/lib:/usr/local/cuda/lib64::./.lake/packages/LeanInfer/.lake/build/lib:./.lake/packages/LeanInfer/.lake/build/lib /home/kaiyu/.elan/toolchains/leanprover--lean4---v4.3.0-rc2/bin/lean --load-dynlib=./.lake/packages/LeanInfer/build/lib/libonnxruntime.so --load-dynlib=./.lake/packages/LeanInfer/build/lib/libctranslate2.so ./.lake/packages/LeanInfer/././LeanInfer/Frontend.lean -R ./.lake/packages/LeanInfer/./. -o ./.lake/packages/LeanInfer/.lake/build/lib/LeanInfer/Frontend.olean -i ./.lake/packages/LeanInfer/.lake/build/lib/LeanInfer/Frontend.ilean -c ./.lake/packages/LeanInfer/.lake/build/ir/LeanInfer/Frontend.c --load-dynlib=./.lake/packages/LeanInfer/.lake/build/lib/libleanffi.so
error: stderr:
libc++abi: terminating due to uncaught exception of type lean::exception: error loading library, ./.lake/packages/LeanInfer/build/lib/libonnxruntime.so: cannot open shared object file: No such file or directory
error: external command `/home/kaiyu/.elan/toolchains/leanprover--lean4---v4.3.0-rc2/bin/lean` exited with code 134

Presumably, the error is because s!"-L{__dir__}/build/lib" doesn't exist for lean4:v4.3.0-rc2. Depending on the Lean version, either s!"-L{__dir__}/build/lib" or s!"-L{__dir__}/.lake/build/lib" exists, but not both. Is there a way to make the project work for both lean4:v4.3.0-rc2 and older versions of Lean?

Thanks!

@yangky11

Is there a way to make the project work for both lean4:v4.3.0-rc2 and older versions of Lean? Thanks!

One somewhat hacky way to do this is to condition the paths based on the Lean version definitions (e.g., Lean.version.minor / Lean.version.specialDescr). However, it should probably be noted that Lean is currently still at the point where different versions of Lean are not presumed to be compatible, so adapting to the most recent versions is currently still considered the standard approach.

Also, hopefully, Lake will have better FFI support in the future that would elide the need to hard code the build directory at all in the configuration file.

adapting to the most recent versions is currently still considered the standard approach

That makes sense!

better FFI support in the future that would elide the need to hard code the build directory at all

Looking forward to it. Thanks!