Skip to content

Conversation

@KristofferC
Copy link
Member

This is an alternative to #60139 where instead of trying to put the stdlibs into the first sysimage (which requires running their top-level code in the output-o process which doesn't run inits), we do like PackageCompiler and build a new sysimage on top of the "base" one where we can load already precompiled stdlibs. This allows us to put e.g. REPL into the sysimage which does not work the "normal" method.

❯ ./julia -e '@time using REPL; @time using Pkg'                                 
  0.002100 seconds (499 allocations: 35.359 KiB)
  0.000432 seconds (373 allocations: 30.516 KiB)

The makefile stuff is completely AI generated.

cc @pankgeorg

@KristofferC KristofferC added the DO NOT MERGE Do not merge this PR! label Nov 18, 2025
JULIA_DEPOT_PATH=$$(call cygpath_w,$$(build_prefix)/share/julia) \
JULIA_NUM_THREADS=1 \
$$(call spawn, $4) $3 -C "$$(JULIA_CPU_TARGET)" $$(HEAPLIM) --output-o $$(call cygpath_w,$$@).tmp $$(JULIA_SYSIMG_BUILD_FLAGS) \
--startup-file=no --warn-overwrite=yes --depwarn=error --sysimage $$(call cygpath_w,$$<) sysimg_stdlibs.jl; then \
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this missing generate_precompile.jl?

Seems that it never runs on this code path

Copy link
Member Author

@KristofferC KristofferC Nov 19, 2025

Choose a reason for hiding this comment

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

That's already run on the base image, and we build on top of that so why would we want to run that again?

Copy link
Member

@topolarity topolarity Nov 21, 2025

Choose a reason for hiding this comment

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

Isn't this using build_sysbase_$1, which is not the final base sysimage? I thought that would be $$(build_private_libdir)/sys$1.$(SHLIB_EXT)

Copy link
Member Author

@KristofferC KristofferC Nov 21, 2025

Choose a reason for hiding this comment

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

Oh, hm, I actually wasn't aware there were two such sysimages being created. So yes, I think you are right.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you know the reason for not running generate_precompile.jl directly in the "base" sysimage?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit finicky, e.g.

Stdlibs total  ────────────────  5.223498 seconds
Collecting and executing precompile statements
└ Collect (Basic: Assertion failed: ((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE || stream->type == UV_TTY) && "uv_write (unix) does not yet support other types of streams"), function uv__check_before_write, file src/unix/stream.c, line 1297.

[4079] signal 6: Abort trap: 6
in expression starting at /Users/kc/julia/contrib/generate_precompile.jl:10
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 5369068 (Pool: 5368927; Big: 141); GC: 8
/bin/sh: line 1:  4079 Abort trap: 6     

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE Do not merge this PR!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants