PackageCompiler error on Windows - Task cannot be serialized

I know there were older posts about this, but I could not find a solution. Has anyone managed to compile Plots to a system image on windows? I tried on a fresh install of Julia 1.3 (.julia folder deleted and added only the necessary packages). I need to present a Julia solution for a Measurements and Automation Lab in University and want to make it as snappy as possible in order to gain acceptance. I need only to compile a few packages like Plots, CSV and Instruments, but Plots have high priority.

I cannot rely on keeping the Julia session open. I’m quite sure that students will mess things up and restarting will be necessary, so compilation would be the best solution.

fatal: error thrown and no exception handler available.
ErrorException("Task cannot be serialized")
rec_backtrace at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\stackwalk.c:94
record_backtrace at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\task.c:224 [inlined]
jl_throw at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\task.c:461
jl_error at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\rtutils.c:41
jl_write_values at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\staticdata.c:679 [inlined]
jl_save_system_image_to_stream at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\staticdata.c:1334
jl_create_system_image at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\staticdata.c:1401
jl_write_compiler_output at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\precompile.c:76
jl_atexit_hook at /cygdrive/d/buildbot/worker/package_win64/build/src/cygdrive/d/buildbot/worker/package_win64/build/src\init.c:230
unknown function (ip: 0000000000401BCF)
unknown function (ip: 00000000004013DE)
unknown function (ip: 000000000040151A)
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
ERROR: failed process: Process(`'C:\Julia-1.3.0\bin\julia.exe' '--sysimage=C:\Users\IulianCioarca\.julia\packages\PackageCompiler\CJQcs\sysimg\backup\native\sys.dll' --output-o=sys.a --track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --track-allocation=none --sysimage-native-code=yes '--sysimage=C:\Julia-1.3.0\lib\julia\sys.dll' --compiled-modules=yes --optimize=2 'C:\Users\IulianCioarca\.julia\packages\PackageCompiler\CJQcs\sysimg\run_julia_code.jl'`, ProcessExited(1)) [1]

For anyone encountering this, switching to:
https://github.com/KristofferC/PackageCompilerX.jl
solved the issue.

Of course, one needs to follow the installation instructions. On Windows, installing ‘gcc’ with WinRPM.install(“gcc”) and adding the ‘gcc.exe’ folder to the Path was enough to get things going. Other errors about libraries not found can be solved in a similar manner, by adding their respective folders to the Path (ex: libGR.dll).

1 Like

The problem with libGR when precompiling Plots is fixed with ccall: report static compile-time load issues correctly by vtjnash · Pull Request #34062 · JuliaLang/julia · GitHub which will either be in 1.3.1 or 1.4.

2 Likes