;;; guix-bioinformatics --- prebuilt Julia ;;; Copyright © 2026 the GeneNetwork team ;;; The official Julia binary, repackaged for Guix. Building Julia from ;;; source is a large, heavily-patched effort (see (gnu packages julia)), ;;; and its version there is pinned to 1.8; this package instead ships a ;;; recent upstream build so the notebook stack can move past Julia 1.8 ;;; without a source bump. ;;; ;;; The tarball is built for a generic glibc system and expects an FHS ;;; /lib64 loader; we patchelf every ELF file to the store's glibc and add ;;; the gcc runtime libraries to the run path. It also bundles its own ;;; libcurl, so Julia's Downloads does not hit the Julia 1.8 + ;;; system-libcurl crash ("curlmultiassign") that the Guix source build ;;; suffers from. ;;; ;;; Status (julia-bump branch): this packages and runs Julia 1.10.9, and ;;; the modern notebook stack (Pluto 1.0, PlutoSliderServer 1.9) runs on ;;; it -- see pluto-notebook in gn/packages/julia.scm. ;;; ;;; A from-source Julia 1.10 was also attempted, as `julia-1.10` in ;;; gn/packages/julia-source.scm (which inherits the 1.8.5 recipe from ;;; (gnu packages julia)). It does not yet build. It gets through LLVM ;;; 15 (built from source), the three deps that 1.8 did not have (the ;;; Julia LLVM fork, JuliaSyntax and ittapi -- seeded into deps/srccache ;;; from origins), and most of julia-base; it then fails compiling Julia's ;;; own src/pipeline.cpp: ;;; ;;; error: use of deleted function ;;; 'llvm::PassManager<...>::PassManager(const llvm::PassManager<...>&)' ;;; ;;; Julia 1.10 copies PassManager, which only works with Julia's patched ;;; LLVM fork, whereas the Guix recipe links Julia against *system* LLVM ;;; (USE_SYSTEM_LLVM, and libLLVM_jll symlinked to the system library). ;;; Finishing the source build therefore needs the recipe reworked to ;;; build and use the fork's LLVM (drop USE_SYSTEM_LLVM and the llvm ;;; input, and rework the shared-objects-paths phase), plus likely more ;;; (e.g. SuiteSparse 7 library names). Upstream Guix is still on Julia ;;; 1.8.5 for the same reason, so there is no newer recipe to borrow. ;;; ;;; julia-bin is the supported way to get Julia 1.10 here; `julia-1.10` ;;; (julia-source.scm) is kept as work-in-progress documentation of how ;;; far a from-source build gets and where it is blocked. (define-module (gn packages julia-bin) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (gnu packages elf) #:use-module (gnu packages gcc) #:use-module (gnu packages libunwind) #:use-module (guix build-system gnu) #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) #:export (julia-bin)) (define-public julia-bin (package (name "julia-bin") ;; 1.9.4 (base32 "0p1jjk7jdn6sb2wdmvx438v66m1mbghww2nacli3x0qq4m60rlh7") also ;; builds but hits a patchelf executable-stack issue on libopenlibm; ;; 1.10.9 is the current working target. (version "1.10.9") (source (origin (method url-fetch) (uri (string-append "https://julialang-s3.julialang.org/bin/linux/x64/" (version-major+minor version) "/julia-" version "-linux-x86_64.tar.gz")) (sha256 (base32 "02dz1hzzg8m1rf4pf650wh5wzyq74jvlqc77jwy6hjsr4i92qbas")))) (build-system gnu-build-system) (arguments (list #:validate-runpath? #f #:strip-binaries? #f #:phases #~(modify-phases %standard-phases (delete 'configure) (delete 'build) (delete 'check) (replace 'install (lambda* (#:key inputs outputs #:allow-other-keys) (use-modules (rnrs bytevectors) (ice-9 binary-ports) (srfi srfi-13)) (define (elf-file? file) (call-with-input-file file (lambda (port) (let ((bv (get-bytevector-n port 4))) (and (bytevector? bv) (= (bytevector-length bv) 4) (= (bytevector-u8-ref bv 0) #x7f) (= (bytevector-u8-ref bv 1) (char->integer #\E)) (= (bytevector-u8-ref bv 2) (char->integer #\L)) (= (bytevector-u8-ref bv 3) (char->integer #\F))))))) (let* ((out (assoc-ref outputs "out")) (glibc (assoc-ref inputs "glibc")) (gcc (assoc-ref inputs "gcc")) (libs (string-append glibc "/lib:" gcc "/lib:" (assoc-ref inputs "libunwind") "/lib:" (assoc-ref inputs "zlib") "/lib")) (interp (string-append glibc "/lib/ld-linux-x86-64.so.2")) (patchelf (string-append (assoc-ref inputs "patchelf") "/bin/patchelf"))) (copy-recursively (getcwd) out) ;; Append the store's glibc and gcc runtime libraries to ;; every ELF file, keeping Julia's own $ORIGIN run paths. (for-each (lambda (file) (when (elf-file? file) (invoke patchelf "--add-rpath" libs file))) (find-files out (lambda (_file stat) (eq? 'regular (stat:type stat))))) ;; Every executable (the launcher and helpers such as the ;; bundled 7z) needs an interpreter. (for-each (lambda (file) (when (and (elf-file? file) (or (string-contains file "/bin/") (string-contains file "/libexec/")) (not (zero? (logand (stat:mode (lstat file)) #o111)))) (invoke patchelf "--set-interpreter" interp file))) (find-files out (lambda (_file stat) (eq? 'regular (stat:type stat))))) #t)))))) (native-inputs (list patchelf)) (inputs (list `(,gcc "lib") glibc libunwind zlib)) (home-page "https://julialang.org/") (synopsis "The Julia programming language (official binary build)") (description "Julia is a high-level, high-performance dynamic programming language for technical computing. This package ships the official prebuilt binary tarball, patched to run against the store's C library. Unlike the Guix source build (still 1.8), the upstream tarball bundles its own libcurl, so Julia's Downloads does not hit the system-libcurl crash seen on 1.8.") (license license:expat)))