Skip to content

Conversation

@paulcadman
Copy link
Collaborator

This PR:

  1. Updates the lean toolchain to v4.20.1
  2. builds the native objects (raylib, raylean native objects / executable) using the same system toochain. Eliminating the possible link time / runtime errors caused by discrepencies between library (e.g glibc) versions used by the bundle lean toolchain and the system toolchain.

You must now install gmp and libuv to build the raylean executable. On macOS you can run:

brew install gmp
brew install libuv

Details

Previously we used the bundled lean clang toolchain to build native
objects (e.g raylib_bindings.o, libleanffi.a, raylean executable).

This causes problems because we link with raylib.a which is build by the
system toolchain. There can be linking errors caused by the lean
toolchain and the system toolchain linking against different libraries,
e.g glibc.

This changes uses the LEAN_CC feature of lake to build lean native
objects using the system toolchain. So both the lean and the raylib
native objects are built using the same toolchain.

The system toolchain needs to be able to find the system libgmp and
libuv to link the lean executable.

These are now passed using the LIBRARY_PATH variable in lake build. On macOS the justfile constructs the LIBRARY_PATH using brew --prefix.

On linux the system toolchain may already be able to find libgmp and
libuv (when they're installed using a distro package manager for
example). If not then the user must set the library_path variable when
running the justfile.

Previously we used the bundled lean clang toolchain to build native
objects (e.g raylib_bindings.o, libleanffi.a, raylean executable).

This causes problems because we link with raylib.a which is build by the
system toolchain. There can be linking errors caused by the lean
toolchain and the system toolchain linking against different libraries,
e.g glibc.

This changes uses the LEAN_CC feature of lake to build lean native
objects using the system toolchain. So both the lean and the raylib
native objects are built using the same toolchain.

The system toolchain needs to be able to find the system libgmp and
libuv to link the lean executable.

These are now passed using the LIBRARY_PATH variable in `lake build`. On
macOS these can be installed using:

```
brew install gmp
brew install libuv
```

The Just file constructs the LIBRARY_PATH using `brew --prefix`.

On linux the system toolchain may already be able to find libgmp and
libuv (when they're installed using a distro package manager for
example). If not then the user must set the `library_path` variable when
running the justfile.
@paulcadman paulcadman force-pushed the lean-update-v4.20 branch 3 times, most recently from 634b222 to 302e59a Compare June 28, 2025 18:18
@paulcadman paulcadman merged commit 8e0a5a1 into funexists:main Jun 28, 2025
2 checks passed

#### [libgmp](https://gmplib.org) and [libuv](https://libuv.org)

These are requried to link lean executables.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requried -> required

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.

2 participants