Skip to content

Switch from PackageCompiler to JuliaC without trimming#2761

Merged
visr merged 3 commits into
mainfrom
julia-1.12.3
Jan 27, 2026
Merged

Switch from PackageCompiler to JuliaC without trimming#2761
visr merged 3 commits into
mainfrom
julia-1.12.3

Conversation

@visr

@visr visr commented Dec 5, 2025

Copy link
Copy Markdown
Member

Trying #2629 again now that we are some patch releases further along.
EDIT: the switch to Julia v1.12 is now done with #2815, I rebased this to only add the JuliaC switch, which is less urgent.

For JuliaC we use this branch: JuliaLang/JuliaC.jl#47. That should set the desired CPU_TARGET, which was the main reason for reverting the previous attempt.

Status: I can run the TeamCity JuliaC generated binaries locally, so the CPU_TARGET seems to work. The Linux binaries seem to for some models. The libribasim.dll file grew from 0.9 to 1.2 GB.

Update: this now works well on Windows. There is a libribasim.dll.a added to the zip root that we perhaps should remove, but the Windows build went from 1h40m to 1h8m, and testing the binaries from 20m to 17m as well so latency doesn't seem increased. I ran the Windows binaries locally.

The binary wasn't working directly for me on Linux only after fiddling with the load path, we need to fix that, perhaps in main.rs or with a JuliaC rpath option or such. EDIT: see JuliaLang/JuliaC.jl#109

Details, now fixed with rpath=`@bundle`

visser_mn@v-h7rdp002 ~/bin  $ ribasim/bin/ribasim ~/ribasim-nl/trivial/ribasim.toml 
Failed to load libribasim from "/u/visser_mn/bin/ribasim/bin/../lib/libribasim.so"
Error: DlOpen { desc: "libjulia.so.1.12: cannot open shared object file: No such file or directory" }
visser_mn@v-h7rdp002 ~/bin  $ export LD_LIBRARY_PATH=~/bin/ribasim/lib:$LD_LIBRARY_PATH
visser_mn@v-h7rdp002 ~/bin  $ ribasim/bin/ribasim ~/ribasim-nl/trivial/ribasim.toml 
Failed to load libribasim from "/u/visser_mn/bin/ribasim/bin/../lib/libribasim.so"
Error: DlOpen { desc: "libjulia-internal.so.1.12: cannot open shared object file: No such file or directory" }
visser_mn@v-h7rdp002 ~/bin  $ ldd ~/bin/ribasim/bin/ribasim
	linux-vdso.so.1 (0x00007ffe803d2000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f79b3905000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f79b36ed000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f79b34cd000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f79b30f7000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f79b3b09000)
visser_mn@v-h7rdp002 ~/bin  $ ldd ~/bin/ribasim/lib/libribasim.so 
	linux-vdso.so.1 (0x00007ffc99973000)
	libjulia.so.1.12 => /u/visser_mn/bin/ribasim/lib/libjulia.so.1.12 (0x00007fcc064d7000)
	libjulia-internal.so.1.12 => not found
	libc.so.6 => /lib64/libc.so.6 (0x00007fcbc1277000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fcbc1073000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcbc0e53000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fcc062cd000)
visser_mn@v-h7rdp002 ~/bin  $ export LD_LIBRARY_PATH=~/bin/ribasim/lib:~/bin/ribasim/lib/julia:$LD_LIBRARY_PATH
visser_mn@v-h7rdp002 ~/bin  $ ribasim/bin/ribasim ~/ribasim-nl/trivial/ribasim.toml 
┌ Info: Starting a Ribasim simulation at 2026-01-26T23:16:08.652.
│   toml_path = "/u/visser_mn/ribasim-nl/trivial/ribasim.toml"
│   cli.ribasim_version = "2026.1.0-rc1"
│   starttime = 2020-01-01T00:00:00
│   endtime = 2021-01-01T00:00:00
└   threads = 1
┌ Warning: The following experimental features are enabled: concentration
└ @ Ribasim /opt/teamcityagent/work/ecd2b8f9b25b1609/ribasim/core/src/logging.jl:51
[ Info: Computation time: 503 milliseconds
[ Info: The model finished successfully at 2026-01-26T23:16:14.037.

It seems the default of the JuliaC LinkRecipe is the magic string @julia, whereas we need the magic string @bundle.

$ objdump -p libribasim.so | grep -E 'RPATH|RUNPATH'
  RPATH                /u/svc-teamcity-ansible/.julia/juliaup/julia-1.12.4+0.x64.linux.gnu/lib:/u/svc-teamcity-ansible/.julia/juliaup/julia-1.12.4+0.x64.linux.gnu/lib/julia

@visr
visr force-pushed the julia-1.12.3 branch 2 times, most recently from 7673ebb to 537f968 Compare December 5, 2025 13:39
visr added a commit that referenced this pull request Dec 29, 2025
They need to be the same version. And we need the latest for Julia 1.12 support.
Now get juliacall from PyPI, since the latest on conda-forge is v0.9.28.

Taken out of #2761.
visr added a commit that referenced this pull request Dec 29, 2025
They need to be the same version. And we need the latest for Julia 1.12
support. Now get juliacall from PyPI, since the latest on conda-forge is
v0.9.28.

Taken out of #2761.
@visr
visr force-pushed the julia-1.12.3 branch 3 times, most recently from 1340869 to 174964e Compare December 29, 2025 19:58
visr added a commit that referenced this pull request Jan 20, 2026
This is #2761 but staying on
PackageCompiler, not moving to JuliaC yet. It seems most of the issues
are related to that part, so better hold off on that and let it mature
so we can at least work on the latest Julia.
@visr visr changed the title Use Julia 1.12, Pkg workspaces and JuliaC sans trimming, take 2 Switch from PackageCompiler to JuliaC without trimming Jan 20, 2026
@visr
visr marked this pull request as ready for review January 27, 2026 11:42
@visr
visr merged commit dd472f5 into main Jan 27, 2026
22 checks passed
@visr
visr deleted the julia-1.12.3 branch January 27, 2026 12:52
@evetion

evetion commented Jan 27, 2026

Copy link
Copy Markdown
Member

Nice! This is pretty quick to build locally and it's the first time I could just run the executable without first moving dylibs around.

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