Error trying to build system image on Windows

I’m trying to build a Julia system image on Windows 10.
(following http://docs.julialang.org/en/stable/devdocs/sysimg/#building-the-julia-system-image)

First I installed gcc:

Pkg.add("WinRPM")
using WinRPM
WinRPM.install("gcc")

Then I ran build_sysimg:

include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "build_sysimg.jl"))
build_sysimg(force=true)

This is the (summarised) output, ending with error:

INFO: Building inference.o
...

INFO: Building sys.o
...

INFO: Linking sys.dll
c:/users/greg/.julia/v0.5/winrpm/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: c
annot find -lpthread
collect2.exe: error: ld returned 1 exit status
ERROR: failed process: Process(`'C:\Users\Greg\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe' '-LC:\Temp\Julia-0.5.1-m3\bin' -shared
 -ljulia -lssp -o 'C:\Temp\Julia-0.5.1-m3\bin\..\lib\julia\sys.dll' 'C:\Temp\Julia-0.5.1-m3\bin\..\lib\julia\sys.o'`, ProcessExited(1)) [1]
 in link_sysimg(::String, ::String, ::Bool) at C:\Temp\Julia-0.5.1-m3\share\julia\build_sysimg.jl:163
 in (::##2#3{Bool,String})() at C:\Temp\Julia-0.5.1-m3\share\julia\build_sysimg.jl:84
 in cd(::##2#3{Bool,String}, ::String) at .\file.jl:48
 in #build_sysimg#1(::Bool, ::Bool, ::Function, ::Void, ::String, ::Void) at C:\Temp\Julia-0.5.1-m3\share\julia\build_sysimg.jl:48
 in (::#kw##build_sysimg)(::Array{Any,1}, ::#build_sysimg, ::Void, ::String, ::Void) at .\<missing>:0 (repeats 2 times)
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
 in macro expansion at .\REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68

How can I diagnose the problem?

1 Like

The build_sysimg script might need some slight tweaking to the link command that it runs to account for changes in the gcc packaging from WinRPM. Try WinRPM.install("winpthreads-devel", yes=true) and see if that helps.

2 Likes

It works!

INFO: Linking sys.dll
INFO: System image successfully built at C:\Temp\Julia-0.5.1-m4\bin\..\lib\julia\sys.dll
INFO: Julia will automatically load this system image at next startup

Thank you very much!

Can I safely ignore these warnings after INFO: Building sys.o:

WARNING: Method definition (::Type{#T<:Any})(Any) in module Inference at coreimg.jl:39 overwritten in module Base at sysimg.jl:53.
...

WARNING: Method definition searchsortedfirst(AbstractArray{T<:Any, 1}, Any) in module Sort at sort.jl:185 overwritten at sort.jl:188.
WARNING: Method definition searchsortedlast(AbstractArray{T<:Any, 1}, Any) in module Sort at sort.jl:185 overwritten at sort.jl:188.
WARNING: Method definition searchsorted(AbstractArray{T<:Any, 1}, Any) in module Sort at sort.jl:185 overwritten at sort.jl:188.
1 Like

I think yes, they are always there. My experience over the last six months.

@tkelman today, I tested it on native windows 7 and windows8.1 (VirtualBox). I got error

C:\Users\M\Desktop\Julia-0.5.0\share\julia\base\precompile.jl
INFO: Linking sys.dll
ERROR: failed process: Process(`'C:\Users\M\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe' '-LC:\Users
\M\Desktop\Julia-0.5.0\bin' -shared -ljulia -lssp -o 'C:\Users\M\Desktop\Julia-0.5.0\bin\..\lib\julia\sys.dll' 'C:\Users\M\Desktop
\Julia-0.5.0\bin\..\lib\julia\sys.o'`, ProcessExited(1)) [1]
 in run at .\process.jl:592 [inlined]
 in link_sysimg(::String, ::String, ::Bool) at C:\Users\M\Desktop\Julia-0.5.0\share\julia\build_sysimg.jl:163
 in (::##2#3{Bool,String})() at C:\Users\M\Desktop\Julia-0.5.0\share\julia\build_sysimg.jl:84
 in cd(::##2#3{Bool,String}, ::String) at .\file.jl:48
 in #build_sysimg#1(::Bool, ::Bool, ::Function, ::Void, ::String, ::Void) at C:\Users\M\Desktop\Julia-0.5.0\share\julia\build_sysi
mg.jl:48
 in (::#kw##build_sysimg)(::Array{Any,1}, ::#build_sysimg, ::Void, ::String, ::Void) at .\<missing>:0 (repeats 2 times)
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
 in macro expansion at .\REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68

It’s not working :frowning: Maybe, what are the requirements for pc?

What happens if you run
C:\Users\M\.julia\v0.5\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin\gcc.exe -LC:\Users\M\Desktop\Julia-0.5.0\bin -shared -ljulia -lssp -o C:\Users\M\Desktop\Julia-0.5.0\bin\..\lib\julia\sys.dll C:\Users\M\Desktop\Julia-0.5.0\bin\..\lib\julia\sys.o
from a command prompt? This may not work any more with Julia 0.5.0 and the latest WinRPM packages, 0.5.1 might work better.

1 Like