# Cannot build 0.7 system image in MacOS

**URL:** <https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087>\
**Category:** General Usage\
**Created:** [June 30, 2018, 10:58pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087 "2018-06-30T22:58:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [June 30, 2018, 10:58pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087/1 "2018-06-30T22:58:30Z")

</div>

I built the system image but it failed consistency check when I restart Julia, even though it said “System image successfully built”. MacOS. Anyone had success before and is there any advice? thanks

```julia
$ /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia 
ERROR: System image file failed consistency check: maybe opened the wrong version?

```

Build log:

```julia
julia> build_sysimg(force = true)
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
in #4 at /Applications/Julia-0.7.app/Contents/Resources/julia/share/julia/build_sysimg.jl
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
in #4 at /Applications/Julia-0.7.app/Contents/Resources/julia/share/julia/build_sysimg.jl
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = (::getfield(Main, Symbol("##4#5")){Bool,String})() at build_sysimg.jl:74
└ @ Main build_sysimg.jl:74
INFO: Building basecompiler.o
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = (::getfield(Main, Symbol("##4#5")){Bool,String})() at build_sysimg.jl:75
└ @ Main build_sysimg.jl:75
INFO: /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia -C native --output-ji /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/basecompiler.ji --output-o /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/basecompiler.o compiler/compiler.jl
essentials.jl
some.jl
ctypes.jl
generator.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
pair.jl
traits.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refvalue.jl
indices.jl
array.jl
abstractarray.jl
reduce.jl
bitarray.jl
bitset.jl
abstractdict.jl
abstractset.jl
iterators.jl
namedtuple.jl
docs/core.jl
subarray.jl
ordering.jl
sort.jl
compiler/utilities.jl
compiler/validation.jl
compiler/inferenceresult.jl
compiler/params.jl
compiler/inferencestate.jl
compiler/typeutils.jl
compiler/typelimits.jl
compiler/typelattice.jl
compiler/tfuncs.jl
compiler/abstractinterpretation.jl
compiler/typeinfer.jl
compiler/optimize.jl
compiler/ssair/driver.jl
compiler/ssair/ir.jl
compiler/ssair/domtree.jl
compiler/ssair/slot2ssa.jl
compiler/ssair/queries.jl
compiler/ssair/passes.jl
compiler/ssair/inlining2.jl
compiler/ssair/verify.jl
compiler/ssair/legacy.jl
compiler/bootstrap.jl
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = (::getfield(Main, Symbol("##4#5")){Bool,String})() at build_sysimg.jl:79
└ @ Main build_sysimg.jl:79
INFO: Building sys.o
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = (::getfield(Main, Symbol("##4#5")){Bool,String})() at build_sysimg.jl:80
└ @ Main build_sysimg.jl:80
INFO: /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia -C native --output-ji /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.ji --output-o /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.o -J /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/basecompiler.ji --startup-file=no sysimg.jl
coreio.jl
exports.jl
essentials.jl
ctypes.jl
gcutils.jl
generator.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
pair.jl
traits.jl
range.jl
expr.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refvalue.jl
refpointer.jl
checked.jl
indices.jl
array.jl
abstractarray.jl
subarray.jl
views.jl
reinterpretarray.jl
abstractdict.jl
iterators.jl
namedtuple.jl
hashing.jl
rounding.jl
float.jl
twiceprecision.jl
complex.jl
rational.jl
multinverses.jl
abstractarraymath.jl
arraymath.jl
simdloop.jl
reduce.jl
reshapedarray.jl
bitarray.jl
bitset.jl
some.jl
dict.jl
abstractset.jl
set.jl
char.jl
strings/basic.jl
strings/string.jl
build_h.jl
version_git.jl
osutils.jl
c.jl
io.jl
iostream.jl
iobuffer.jl
intfuncs.jl
strings/strings.jl
strings/substring.jl
strings/search.jl
strings/unicode.jl
strings/util.jl
strings/io.jl
parse.jl
shell.jl
regex.jl
pcre.jl
show.jl
arrayshow.jl
cartesian.jl
multidimensional.jl
permuteddimsarray.jl
broadcast.jl
missing.jl
version.jl
sysinfo.jl
libc.jl
env.jl
libuv.jl
uv_constants.jl
event.jl
task.jl
lock.jl
threads.jl
weakkeydict.jl
logging.jl
stream.jl
filesystem.jl
process.jl
grisu/grisu.jl
methodshow.jl
secretbuffer.jl
floatfuncs.jl
math.jl
reducedim.jl
accumulate.jl
ordering.jl
sort.jl
fastmath.jl
gmp.jl
mpfr.jl
combinatorics.jl
hashing2.jl
irrationals.jl
mathconstants.jl
printf.jl
meta.jl
Enums.jl
channels.jl
deepcopy.jl
download.jl
summarysize.jl
errorshow.jl
stacktraces.jl
initdefs.jl
statistics.jl
threadcall.jl
uuid.jl
loading.jl
util.jl
asyncmap.jl
multimedia.jl
deprecated.jl
docs/basedocs.jl
client.jl
docs/Docs.jl
Base ─────────── 53.955055 seconds
Base64 ───────── 6.997107 seconds
CRC32c ───────── 0.024181 seconds
SHA ──────────── 0.263260 seconds
FileWatching ─── 0.129545 seconds
Unicode ──────── 0.026007 seconds
Mmap ─────────── 0.102972 seconds
Serialization ── 1.617725 seconds
Libdl ────────── 0.050757 seconds
Markdown ─────── 2.071144 seconds
LibGit2 ──────── 9.276232 seconds
Logging ──────── 2.403250 seconds
Sockets ──────── 3.835479 seconds
Printf ───────── 0.088249 seconds
Profile ──────── 0.466091 seconds
Dates ────────── 4.863493 seconds
DelimitedFiles ─ 2.883826 seconds
Random ───────── 1.198052 seconds
UUIDs ────────── 0.018731 seconds
Future ───────── 0.012023 seconds
OldPkg ───────── 5.375042 seconds
LinearAlgebra ── 25.362887 seconds
SparseArrays ─── 8.735044 seconds
SuiteSparse ──── 2.689433 seconds
SharedArrays ─── 9.213928 seconds
Distributed ──── 1.727962 seconds
Pkg ──────────── 46.066499 seconds
Test ─────────── 5.167110 seconds
REPL ─────────── 2.480134 seconds
Stdlibs total ──146.276657 seconds
/Applications/Julia-0.7.app/Contents/Resources/julia/share/julia/base/precompile.jl
Sysimage built. Summary:
Total ─────── 233.649873 seconds 
Base: ─────── 53.955055 seconds 23.0923%
Stdlibs: ──── 146.276657 seconds 62.6051%
Precompile: ─ 33.412676 seconds 14.3003%

WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
in link_sysimg at /Applications/Julia-0.7.app/Contents/Resources/julia/share/julia/build_sysimg.jl
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
in link_sysimg at /Applications/Julia-0.7.app/Contents/Resources/julia/share/julia/build_sysimg.jl
WARNING: Base.Libdl is deprecated, run `using Libdl` instead
 in module Main
in link_sysimg at /Applications/Julia-0.7.app/Contents/Resources/julia/share/julia/build_sysimg.jl
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = link_sysimg(::String, ::String, ::Bool) at build_sysimg.jl:168
└ @ Main build_sysimg.jl:168
INFO: Linking sys.dylib
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = link_sysimg(::String, ::String, ::Bool) at build_sysimg.jl:169
└ @ Main build_sysimg.jl:169
INFO: cc -L/Applications/Julia-0.7.app/Contents/Resources/julia/lib -shared -ljulia -o /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.o
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = link_sysimg(::String, ::String, ::Bool) at build_sysimg.jl:179
└ @ Main build_sysimg.jl:179
INFO: System image successfully built at /Applications/Julia-0.7.app/Contents/Resources/julia/lib/julia/sys.dylib
┌ Warning: `info()` is deprecated, use `@info` instead.
│ caller = (::getfield(Main, Symbol("##4#5")){Bool,String})() at build_sysimg.jl:98
└ @ Main build_sysimg.jl:98
INFO: Julia will automatically load this system image at next startup.

```

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [June 30, 2018, 11:21pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087/2 "2018-06-30T23:21:16Z")

</div>

There is [an issue](https://github.com/JuliaLang/julia/issues/27201) on this, with a fix in progress. But apparently what the developers would like us to do now is

```julia
using PackageCompiler
build_sysimg(...)

```

---

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [June 30, 2018, 11:28pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087/3 "2018-06-30T23:28:08Z")

</div>

Mmm… couldn’t get PackageCompiler to work though:

```julia
julia> using PackageCompiler
[ Info: Precompiling module PackageCompiler
ERROR: LoadError: ArgumentError: Package PackageCompiler does not have Sys in its dependencies:
 - If you have PackageCompiler checked out for development and have
   added Sys as a dependency but haven't updated your primary
   environment's manifest file, try `Pkg.resolve()`.
 - Otherwise you may need to report an issue with PackageCompiler.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:862
 [2] top-level scope at /Users/tomkwong/.julia/packages/PackageCompiler/QqA5/src/PackageCompiler.jl:9
 [3] include at ./boot.jl:317 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1075
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] top-level scope at none:0
 [7] eval at ./boot.jl:319 [inlined]
 [8] eval(::Expr) at ./client.jl:394
 [9] top-level scope at ./none:3 [inlined]
 [10] top-level scope at ./<missing>:0
in expression starting at /Users/tomkwong/.julia/packages/PackageCompiler/QqA5/src/PackageCompiler.jl:7
ERROR: Failed to precompile PackageCompiler to /Users/tomkwong/.julia/compiled/v0.7/PackageCompiler/MMV8.ji.
Stacktrace:
 [1] error at ./error.jl:33 [inlined]
 [2] compilecache(::Base.PkgId) at ./loading.jl:1205
 [3] _require(::Base.PkgId) at ./loading.jl:1007
 [4] require(::Base.PkgId) at ./loading.jl:879
 [5] require(::Module, ::Symbol) at ./loading.jl:874

```

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [June 30, 2018, 11:45pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087/4 "2018-06-30T23:45:49Z")

</div>

That’s nasty, and I don’t know how to fix it. (`Sys` is in `Base`, so that should not happen.)

Meanwhile, what looks to be a fixed version of the old script (from [the PR I alluded to above](https://github.com/JuliaLang/julia/pull/27629)) is  
[here](https://github.com/JuliaLang/julia/raw/5b1ec9c2c8534353cd9e74503f7e748d3b42089d/contrib/build_sysimg.jl)

---

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [July 1, 2018, 12:28am UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087/5 "2018-07-01T00:28:50Z")

</div>

That works, thanks!

P.S. …although the new sys img is making my program 10x slower than 0.6… investigation to be continued…

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 2, 2018, 1:17pm UTC](https://discourse.julialang.org/t/cannot-build-0-7-system-image-in-macos/12087/6 "2018-07-02T13:17:26Z")

</div>

I could load PackageCompiler (master branch) with no problem on 0.7.
