Package Compiler doesn't download required artifact

I am trying to precompile LanguageServer using PackageCompiler by typing this into REPL

using PackageCompiler; create_sysimage([:LanguageServer,:SymbolServer], sysimage_path="./julials.dll", precompile_statements_file="./tracecompilelsp.jl")

It seems to compile until i got this error

ERROR: IOError: could not spawn setenv(`'C:\Users\mhaikala\.julia\artifacts\fdff308295487f361ef6e8dc2d27f5abe8a6eee9\mingw64\bin\g++.exe' -m64 -march=x86-64 -shared '-LC:\Users\mhaikala\AppData\Local\Programs\Julia-1.8.5\bin' '-LC:\Users\mhaikala\AppData\Local\Programs\Julia-1.8.5\bin' -o ./julials.dll -Wl,--whole-archive 'C:\Users\mhaikala\AppData\Local\Temp\jl_F0VQnYBO3g.o' -Wl,--no-whole-archive -ljulia -ljulia-internal -lopenlibm -Wl,--export-all-symbols`,["PATH=...long-list-of-my-path-variable"]: no such file or directory (ENOENT)

So i look into ~/.julia/artifacts/fdff308295487f361ef6e8dc2d27f5abe8a6eee9/mingw64 and found out there is only ‘opt’ folder but no ‘bin’ folder. I have reinstalled PackageCompiler and tried again but no success.

My julia config is this

Julia Version 1.8.5
Commit 17cfb8e65e (2023-01-08 06:45 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores

Pkg.status()

Status `C:\Users\mhaikala\.julia\environments\nvim-lspconfig\Project.toml`
  [2b0e0bc5] LanguageServer v4.3.1
  [9b87118b] PackageCompiler v2.1.5
  [b3cc710f] StaticLint v8.1.0
  [cf896787] SymbolServer v7.2.1

output from ls

➜  ls

    Directory: C:\Users\mhaikala\.julia\artifacts\fdff308295487f361ef6e8dc2d27f5abe8a6eee9\mingw64

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          18/02/2023    12:38                opt

I get a similar error running your code, but not when I remove the option precompile_statements_file="./tracecompilelsp.jl". Are you sure that PackageCompiler can find that file on your system? And if so, what are its contents?

Running create_sysimage([:LanguageServer,:SymbolServer], sysimage_path="./julials.dll") eventually results in the error:

ld: warning: could not create compact unwind for _julia_YY.244_63412: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _julia_YY.load_coreYY.23_76333: stack subq instruction is too different from dwarf stack size

If you’re on Windows, you may need to enable long paths: Maximum Path Length Limitation - Win32 apps | Microsoft Learn

2 Likes

Thanks, @dilumaluthge! That was my issue.

Are you sure that PackageCompiler can find that file on your system? And if so, what are its contents?

It contains what should be compiled for the sysimage. It contains a lot precompile statements
like some of these

precompile(Tuple{Type{Base.Multimedia.TextDisplay}, Base.PipeEndpoint})
precompile(Tuple{Type{REPL.Terminals.TTYTerminal}, String, Base.PipeEndpoint, Base.PipeEndpoint, Base.PipeEndpoint})
precompile(Tuple{typeof(Base.something), Nothing, Base.PipeEndpoint})
precompile(Tuple{typeof(Pkg.API.instantiate)})
precompile(Tuple{typeof(Base.deepcopy_internal), Any, Base.IdDict{Any, Any}})
precompile(Tuple{typeof(Core.Compiler.eltype), Type{Array{UInt64, 1}}})
precompile(Tuple{typeof(Base.deepcopy_internal), Tuple{UInt64}, Base.IdDict{Any, Any}})

to generate it I followed direction from this post

I’m sure PackageCompiler can found it. I have tried making a symbolic link for
~/.julia/artifacts/fdff308295487f361ef6e8dc2d27f5abe8a6eee9/mingw64/bin to point at my msys2 installation that has g++ and it manages to build the image. But when i use it Julia can’t load it.

I had the same issue. I just removed the incomplete artifact directory, removed and added PackageCompiler in Pkg. Then it downloaded the complete artifact when I was compling the next time.