# Tips for using PackageCompiler.jl on Windows

**URL:** <https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295>\
**Category:** General Usage\
**Created:** [March 25, 2019, 9:55am UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295 "2019-03-25T09:55:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [March 25, 2019, 9:55am UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/1 "2019-03-25T09:55:08Z")

</div>

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.dll`to `C:\Users\UserName\AppData\Local\Julia-1.1.0\lib\julia\sys.dll`

---

<div class="post-metadata">

**Author:** ![uwechsler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uwechsler/32/5223_2.png) [@uwechsler](https://discourse.julialang.org/u/uwechsler)\
**Post date:** [April 4, 2019, 4:46pm UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/2 "2019-04-04T16:46:33Z")

</div>

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? 😉

---

<div class="post-metadata">

**Author:** ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Post date:** [April 4, 2019, 5:52pm UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/3 "2019-04-04T17:52:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [April 15, 2019, 10:04am UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/4 "2019-04-15T10:04:55Z")

</div>

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!

```julia

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

```

---

<div class="post-metadata">

**Author:** ![FirstnameLastname](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/firstnamelastname/32/6648_2.png) [@FirstnameLastname](https://discourse.julialang.org/u/FirstnameLastname)\
**Post date:** [April 15, 2019, 12:53pm UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/5 "2019-04-15T12:53:29Z")

</div>

Do you encounter this error on Windows?

````julia
┌ 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```
````

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [April 15, 2019, 2:17pm UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/6 "2019-04-15T14:17:21Z")

</div>

Yeah but I think it can be ignored

---

<div class="post-metadata">

**Author:** ![11116](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/11116/32/7775_2.png) [@11116](https://discourse.julialang.org/u/11116)\
**Post date:** [April 17, 2019, 2:43am UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295/7 "2019-04-17T02:43:03Z")

</div>

You can use the blacklist argument:

```julia
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.
