NickelEval.jl

Julia FFI bindings for Nickel configuration language
Log | Files | Refs | README | LICENSE

commit ab9e20e277a75d135fdaaaca618256e4d924c1dd
parent 5fb0d2ad08c4966605ff5fd36ff84421de3399bd
Author: Erik Loualiche <[email protected]>
Date:   Tue, 17 Mar 2026 23:15:31 -0500

Prioritize local deps/ over artifact and add HPC build docs (v0.5.2)

Local deps/ builds now take priority over pre-built artifacts, fixing
the case where a cluster-built .so is ignored because the artifact
(with incompatible glibc) exists. Also adds HPC/Slurm build-from-source
instructions to README.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

Diffstat:
MProject.toml | 2+-
MREADME.md | 21++++++++++++++++++++-
MTODO.md | 2+-
Msrc/ffi.jl | 15++++++++-------
4 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/Project.toml b/Project.toml @@ -1,7 +1,7 @@ name = "NickelEval" uuid = "a1b2c3d4-e5f6-7890-abcd-ef1234567890" authors = ["NickelJL Contributors"] -version = "0.5.1" +version = "0.5.2" [deps] Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" diff --git a/README.md b/README.md @@ -193,7 +193,7 @@ Import paths are resolved relative to the file's directory. ### Building FFI -The FFI library requires Rust. To build: +Pre-built binaries are downloaded automatically as Julia artifacts on supported platforms. If `check_ffi_available()` returns `false`, you can build from source (requires Rust): ```bash cd rust/nickel-jl @@ -202,6 +202,25 @@ cp target/release/libnickel_jl.dylib ../../deps/ # macOS # or libnickel_jl.so on Linux, nickel_jl.dll on Windows ``` +### FFI on HPC / Slurm Clusters + +The pre-built Linux binary may fail on clusters with an older glibc (e.g., RHEL 8 / CentOS 8). To build from source in the installed package directory: + +```bash +# Install Rust if needed +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +source ~/.cargo/env + +# Build in the installed package +cd $(julia -e 'using NickelEval; print(pkgdir(NickelEval))') +cd rust/nickel-jl +cargo build --release +mkdir -p ../../deps +cp target/release/libnickel_jl.so ../../deps/ +``` + +Restart Julia after building. The FFI functions (`nickel_eval_native`, `nickel_eval_ffi`, etc.) do not require the Nickel CLI — only the subprocess functions do. + ## API Reference ### Evaluation Functions diff --git a/TODO.md b/TODO.md @@ -1,6 +1,6 @@ # NickelEval.jl - Status & TODOs -## Current Version: v0.5.1 +## Current Version: v0.5.2 ## Completed Features diff --git a/src/ffi.jl b/src/ffi.jl @@ -24,8 +24,15 @@ else "libnickel_jl.so" end -# Find library path: try artifact first, then local deps/ +# Find library path: try local deps/ first (custom builds, HPC clusters with old glibc), +# then fall back to pre-built artifact function _find_library_path() + # Try local deps/ folder first (custom builds override artifacts) + local_path = joinpath(@__DIR__, "..", "deps", LIB_NAME) + if isfile(local_path) + return local_path + end + # Try artifact (Julia auto-selects platform based on arch/os in Artifacts.toml) try # @artifact_str triggers lazy download if needed @@ -38,12 +45,6 @@ function _find_library_path() # Artifact not available (platform not supported or download failed) end - # Fall back to local deps/ folder (for development) - local_path = joinpath(@__DIR__, "..", "deps", LIB_NAME) - if isfile(local_path) - return local_path - end - return nothing end