Tips for using PackageCompiler.jl on Windows

To compile packages using PackageCompiler.jl I found the following steps to be helpful

  1. Update PakcageCompiler to latest using ]dev https://github.com/JuliaLang/PackageCompiler.jl.git
  2. If you have compiled packages before then take care to restore to initial state by copying the sys.dll from C:\Users\UserName\.julia\dev\PackageCompiler\sysimg\backup to C:\Users\UserName\AppData\Local\Julia-1.1.0\lib\julia. You may need to shut down Julia to achieve this. If you had run Jupyter lab, you need to restart the computer
  3. using Pkg; pkg"up"; using PackageCompiler compile_incremental(:Pkg1, :Pkg2, force = false)
  4. Once done, copy from C:\Users\UserName\.julia\dev\PackageCompiler\sysimg\sys.dllto C:\Users\UserName\AppData\Local\Julia-1.1.0\lib\julia\sys.dll
8 Likes

Do you have by chance any experience and or tips for the use of build_executable() to generate a single stand-alone executable file on Windows? :wink:

I’m not a Windows expert but I have dabbled with PackageCompiler on Windows and have had some success with build_executable. I would recommend looking at the example in the PackageCompiler repository examples folder. That helped me a lot. See if you can build that c program using PackageCompiler’s build_executable function.

The other thing to remember is that the executable will be standalone in the sense that you can run it without a working julia installation but you’ll still need all the julia dlls. Run build_executable with copy_julialibs = true to see which dlls you’ll need. If you want to run your executable on a machine without julia installed, you’ll have to copy all those dlls to the new machine as well as the exe file itself.

3 Likes

Here is my script to compile a Data Science super image on Windows. Unforutnately, CuArrays and DecisionTree don’t work yet. But the image covers most of my data science needs for now!


using PackageCompiler
@time compile_incremental(
    :Plots #ok
    , :GR #ok
    , :DataFrames #ok
    , :DataFramesMeta #ok
    , :StatsBase #start 10:05pm #ok
    , :Query    #start 10:22pm #ok    # 1021
    , :GLM  # start 7:45pm #ok 1153
    , :Clustering  # start 8:44pm  #ok 1268
    , :TableReader # start 9:09pm # 1370
    , :Flux # start 9:38pm # 1686
    , :Lazy  # start 10:07pm # 1751
    , :Feather # start 8:01pm
    #, :CuArrays # start 7:16pm #failed
    #, :DecisionTree #start 8:10pm # failed
    , force = false
)
using RCall
R"""
beepr::beep()
"""
2+2
1 Like

Do you encounter this error on Windows?

┌ Warning: QuartzImageIO.jl can only be used on Apple macOS. Suggested usage is
│     @static if Sys.isapple()
│         using QuartzImageIO
│         # QuartzImageIO specific code goes here
│     end
â”” @ QuartzImageIO C:\Users\xxx\.julia\packages\QuartzImageIO\9DhKg\src\QuartzImageIO.jl:723```

Yeah but I think it can be ignored

You can use the blacklist argument:

compile_incremental(
        packages::Symbol...;
        force = false, reuse = false, verbose = true,
        debug = false, cc_flags = nothing
        debug = false, cc_flags = nothing,
        blacklist::Vector = []
    )

put the :QuartzImageIO in the blacklist can avoid this warning message.

3 Likes