MKL.jl build problems on windows

Hi all! I am trying to build MKL on Windows. Setting:

ENV["USE_BLAS64"] = true;
] add MKL;

results in:

    Building MKL ā†’ `C:\Users\LocalAdmin\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\52c39a2b156743873c3919cd8ce83ac6075cc45f\build.log`
ERROR: Error building `MKL`, showing the last 100 of log:
# cd(() -> (name = "c_simple"; @artifact_str(name)), dirname(artifacts_toml))
artifacts = Artifacts.load_artifacts_toml(artifacts_toml)
platforms = [Artifacts.unpack_platform(e, "c_simple", artifacts_toml) for e in artifacts["c_simple"]]
best_platform = select_platform(Dict(p => triplet(p) for p in platforms))
dlopen("libjulia", RTLD_LAZY | RTLD_DEEPBIND)

'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ .\process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base .\process.jl:440
  [3] run
    @ .\process.jl:438 [inlined]
  [4] (::Main.anonymous.var"#1#5"{Set{String}, String})(prec_path::String)
    @ Main.anonymous C:\Users\LOCALA~1\AppData\Local\Temp\jl_MQYu42USKu:212
  [5] mktempdir(fn::Main.anonymous.var"#1#5"{Set{String}, String}, parent::String; prefix::String)
    @ Base.Filesystem .\file.jl:729
  [6] mktempdir (repeats 2 times)
    @ .\file.jl:727 [inlined]
  [7] generate_precompile_statements()
    @ Main.anonymous C:\Users\LOCALA~1\AppData\Local\Temp\jl_MQYu42USKu:195
  [8] top-level scope
    @ C:\Users\LOCALA~1\AppData\Local\Temp\jl_MQYu42USKu:339
  [9] eval(m::Module, e::Any)
    @ Core .\boot.jl:360
 [10] top-level scope
    @ C:\Users\LOCALA~1\AppData\Local\Temp\jl_MQYu42USKu:6
 [11] include(fname::String)
    @ Base.MainInclude .\client.jl:444
 [12] top-level scope
    @ none:33
in expression starting at C:\Users\LOCALA~1\AppData\Local\Temp\jl_MQYu42USKu:3
[ Info: Splicing in code to load MKL in C:\Users\LocalAdmin\AppData\Local\Programs\Julia-1.6.0\bin\..\share\julia\base\sysimg.jl
[ Info: getting precompile script from: https://raw.githubusercontent.com/JuliaLang/julia/release-1.6/contrib/generate_precompile.jl
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...
ERROR: LoadError: failed process: Process(`'C:\Users\LocalAdmin\AppData\Local\Programs\Julia-1.6.0\bin\julia.exe' --color=yes --startup-file=no --cpu-target=native '--sysimage=C:\Users\LOCALA~1\AppData\Local\Temp\jl_nqUMQB\sys.ji' '--project=C:\Users\LOCALA~1\AppData\Local\Temp\jl_NoHMFd' '--output-o=C:\Users\LOCALA~1\AppData\Local\Temp\jl_IYrt6kS7bW.o' -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "C:\\Users\\LocalAdmin\\AppData\\Local\\Programs\\Julia-1.6.0\\share\\julia\\stdlib\\v1.6"
Base.init_load_path()
if isdefined(Base, :init_active_project)
    Base.init_active_project()
end
Base.init_depot_path()
# This @eval prevents symbols from being put into Main
@eval Module() begin
    PrecompileStagingArea = Module()
    for (_pkgid, _mod) in Base.loaded_modules
        if !(_pkgid.name in ("Main", "Core", "Base"))
            eval(PrecompileStagingArea, :(const $(Symbol(_mod)) = $_mod))
        end
    end
    precompile_files = String[
        "C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_biBr3Jz6n1"
    ]
    for file in precompile_files, statement in eachline(file)
        # println(statement)
        # The compiler has problem caching signatures with \`Vararg{?, N}\`. Replacing
        # N with a large number seems to work around it.
        statement = replace(statement, r"Vararg{(.*?), N} where N" => s"Vararg{\1, 100}")
        try
            Base.include_string(PrecompileStagingArea, statement)
        catch
            # See julia issue #28808
            @debug "failed to execute $statement"
        end
    end
end # module
include("C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_MQYu42USKu")
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ .\process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base .\process.jl:440
  [3] run
    @ .\process.jl:438 [inlined]
  [4] create_sysimg_object_file(object_file::String, packages::Vector{String}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::String, isapp::Bool)
    @ PackageCompiler ~\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:306
  [5] create_sysimage(packages::Vector{Symbol}; sysimage_path::Nothing, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::String, base_sysimage::Nothing, isapp::Bool)
    @ PackageCompiler ~\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:442
  [6] top-level scope
    @ ~\.julia\packages\MKL\3H9w2\src\install.jl:128
  [7] eval
    @ .\boot.jl:360 [inlined]
  [8] change_blas_library(libblas::String)
    @ Main ~\.julia\packages\MKL\3H9w2\src\install.jl:126
  [9] enable_mkl_startup()
    @ Main ~\.julia\packages\MKL\3H9w2\src\install.jl:103
 [10] top-level scope
    @ ~\.julia\packages\MKL\3H9w2\deps\build.jl:13
 [11] include(fname::String)
    @ Base.MainInclude .\client.jl:444
 [12] top-level scope
    @ none:5
in expression starting at C:\Users\LocalAdmin\.julia\packages\MKL\3H9w2\deps\build.jl:13

Full log at C:\Users\LocalAdmin\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\52c39a2b156743873c3919cd8ce83ac6075cc45f\build.log

The log says:

ERROR: ArgumentError: Package Artifacts not found in current path:
- Run `import Pkg; Pkg.add("Artifacts")` to install the Artifacts package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:871
e[91me[1mERROR: e[22me[39mLoadError: failed process: Process(`e[4m'C:\Users\LocalAdmin\AppData\Local\Programs\Julia-1.6.0\bin\julia.exe'e[24m e[4m-O0e[24m e[4m--sysimagee[24m e[4m'C:\Users\LOCALA~1\AppData\Local\Temp\jl_nqUMQB\sys.ji'e[24m e[4m--startup-file=noe[24m e[4m-Cnativee[24m e[4m-ee[24m e[4m'pushfirst!(DEPOT_PATH, "C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_N1Tque");e[24m
e[4mBase.PRECOMPILE_TRACE_COMPILE[] = "C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_aJwiFhOPIu";e[24m
e[4mBase.compilecache(Base.PkgId("__PackagePrecompilationStatementModule"), "C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_N1Tque\\__PackagePrecompilationStatementModule\\src\\__PackagePrecompilationStatementModule.jl")e[24m
e[4m# NOTE: these were moved to the end of Base.jl. TODO: move back here.e[24m
e[4m# # Used by Revise & its dependenciese[24m
e[4m# while true  # force inferencee[24m
e[4m# delete!(push!(Set{Module}(), Base), Main)e[24m
e[4m# m = first(methods(+))e[24m
e[4m# delete!(push!(Set{Method}(), m), m)e[24m
e[4m# empty!(Set())e[24m
e[4m# push!(push!(Set{Union{GlobalRef,Symbol}}(), :two), GlobalRef(Base, :two))e[24m
e[4m# (setindex!(Dict{String,Base.PkgId}(), Base.PkgId(Base), "file.jl"))["file.jl"]e[24m
e[4m# (setindex!(Dict{Symbol,Vector{Int}}(), [1], :two))[:two]e[24m
e[4m# (setindex!(Dict{Base.PkgId,String}(), "file.jl", Base.PkgId(Base)))[Base.PkgId(Base)]e[24m
e[4m# (setindex!(Dict{Union{GlobalRef,Symbol}, Vector{Int}}(), [1], :two))[:two]e[24m
e[4m# (setindex!(IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}(), missing, Int))[Int]e[24m
e[4m# Dict{Symbol, Union{Nothing, Bool, Symbol}}(:one => false)[:one]e[24m
e[4m# Dict(Base => [:(1+1)])[Base]e[24m
e[4m# Dict(:one => [1])[:one]e[24m
e[4m# Dict("abc" => Set())["abc"]e[24m
e[4m# pushfirst!([], sum)e[24m
e[4m# get(Base.pkgorigins, Base.PkgId(Base), nothing)e[24m
e[4m# sort!([1,2,3])e[24m
e[4m# unique!([1,2,3])e[24m
e[4m# cumsum([1,2,3])e[24m
e[4m# append!(Int[], BitSet())e[24m
e[4m# isempty(BitSet())e[24m
e[4m# delete!(BitSet([1,2]), 3)e[24m
e[4m# deleteat!(Int32[1,2,3], [1,3])e[24m
e[4m# deleteat!(Any[1,2,3], [1,3])e[24m
e[4m# Core.svec(1, 2) == Core.svec(3, 4)e[24m
e[4m# # copy(Core.Compiler.retrieve_code_info(Core.Compiler.specialize_method(which(+, (Int, Int)), [Int, Int], Core.svec())))e[24m
e[4m# any(t->t[1].line > 1, [(LineNumberNode(2,:none),:(1+1))])e[24m
e[4m# break   # end force inferencee[24m
e[4m# ende[24m
e[4musing Artifacts, Base.BinaryPlatforms, Libdle[24m
e[4martifacts_toml = abspath(joinpath(Sys.STDLIB, "Artifacts", "test", "Artifacts.toml"))e[24m
e[4m# cd(() -> (name = "c_simple"; @artifact_str(name)), dirname(artifacts_toml))e[24m
e[4martifacts = Artifacts.load_artifacts_toml(artifacts_toml)e[24m
e[4mplatforms = [Artifacts.unpack_platform(e, "c_simple", artifacts_toml) for e in artifacts["c_simple"]]e[24m
e[4mbest_platform = select_platform(Dict(p => triplet(p) for p in platforms))e[24m
e[4mdlopen("libjulia", RTLD_LAZY | RTLD_DEEPBIND)e[24m

e[4m'e[24m`, ProcessExited(1)) [1]

Stacktrace:
  [1] e[0me[1mpipeline_errore[22m
e[90m    @ e[39me[90m.\e[39me[90;4mprocess.jl:525e[0me[90m [inlined]e[39m
  [2] e[0me[1mrune[22me[0me[1m(e[22m::e[0mCmd; e[90mwaite[39m::e[0mBoole[0me[1m)e[22m
e[90m    @ e[39me[90mBasee[39m e[90m.\e[39me[90;4mprocess.jl:440e[0m
  [3] e[0me[1mrune[22m
e[90m    @ e[39me[90m.\e[39me[90;4mprocess.jl:438e[0me[90m [inlined]e[39m
  [4] e[0me[1m(::Main.anonymous.var"#1#5"{Set{String}, String})e[22me[0me[1m(e[22me[90mprec_pathe[39m::e[0mStringe[0me[1m)e[22m
e[90m    @ e[39me[35mMain.anonymouse[39m e[90mC:\Users\LOCALA~1\AppData\Local\Temp\e[39me[90;4mjl_MQYu42USKu:212e[0m
  [5] e[0me[1mmktempdire[22me[0me[1m(e[22me[90mfne[39m::e[0mMain.anonymous.var"#1#5"e[90m{Set{String}, String}e[39m, e[90mparente[39m::e[0mString; e[90mprefixe[39m::e[0mStringe[0me[1m)e[22m
e[90m    @ e[39me[90mBase.Filesysteme[39m e[90m.\e[39me[90;4mfile.jl:729e[0m
  [6] e[0me[1mmktempdire[22me[90m (repeats 2 times)e[39m
e[90m    @ e[39me[90m.\e[39me[90;4mfile.jl:727e[0me[90m [inlined]e[39m
  [7] e[0me[1mgenerate_precompile_statementse[22me[0me[1m(e[22me[0me[1m)e[22m
e[90m    @ e[39me[35mMain.anonymouse[39m e[90mC:\Users\LOCALA~1\AppData\Local\Temp\e[39me[90;4mjl_MQYu42USKu:195e[0m
  [8] top-level scope
e[90m    @ e[39me[90mC:\Users\LOCALA~1\AppData\Local\Temp\e[39me[90;4mjl_MQYu42USKu:339e[0m
  [9] e[0me[1mevale[22me[0me[1m(e[22me[90mme[39m::e[0mModule, e[90mee[39m::e[0mAnye[0me[1m)e[22m
e[90m    @ e[39me[90mCoree[39m e[90m.\e[39me[90;4mboot.jl:360e[0m
 [10] top-level scope
e[90m    @ e[39me[90mC:\Users\LOCALA~1\AppData\Local\Temp\e[39me[90;4mjl_MQYu42USKu:6e[0m
 [11] e[0me[1mincludee[22me[0me[1m(e[22me[90mfnamee[39m::e[0mStringe[0me[1m)e[22m
e[90m    @ e[39me[90mBase.MainIncludee[39m e[90m.\e[39me[90;4mclient.jl:444e[0m
 [12] top-level scope
e[90m    @ e[39me[90;4mnone:33e[0m
in expression starting at C:\Users\LOCALA~1\AppData\Local\Temp\jl_MQYu42USKu:3
[ Info: Splicing in code to load MKL in C:\Users\LocalAdmin\AppData\Local\Programs\Julia-1.6.0\bin\..\share\julia\base\sysimg.jl
[ Info: getting precompile script from: https://raw.githubusercontent.com/JuliaLang/julia/release-1.6/contrib/generate_precompile.jl
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...
ERROR: LoadError: failed process: Process(`'C:\Users\LocalAdmin\AppData\Local\Programs\Julia-1.6.0\bin\julia.exe' --color=yes --startup-file=no --cpu-target=native '--sysimage=C:\Users\LOCALA~1\AppData\Local\Temp\jl_nqUMQB\sys.ji' '--project=C:\Users\LOCALA~1\AppData\Local\Temp\jl_NoHMFd' '--output-o=C:\Users\LOCALA~1\AppData\Local\Temp\jl_IYrt6kS7bW.o' -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "C:\\Users\\LocalAdmin\\AppData\\Local\\Programs\\Julia-1.6.0\\share\\julia\\stdlib\\v1.6"
Base.init_load_path()
if isdefined(Base, :init_active_project)
    Base.init_active_project()
end
Base.init_depot_path()
# This @eval prevents symbols from being put into Main
@eval Module() begin
    PrecompileStagingArea = Module()
    for (_pkgid, _mod) in Base.loaded_modules
        if !(_pkgid.name in ("Main", "Core", "Base"))
            eval(PrecompileStagingArea, :(const $(Symbol(_mod)) = $_mod))
        end
    end
    precompile_files = String[
        "C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_biBr3Jz6n1"
    ]
    for file in precompile_files, statement in eachline(file)
        # println(statement)
        # The compiler has problem caching signatures with \`Vararg{?, N}\`. Replacing
        # N with a large number seems to work around it.
        statement = replace(statement, r"Vararg{(.*?), N} where N" => s"Vararg{\1, 100}")
        try
            Base.include_string(PrecompileStagingArea, statement)
        catch
            # See julia issue #28808
            @debug "failed to execute $statement"
        end
    end
end # module
include("C:\\Users\\LOCALA~1\\AppData\\Local\\Temp\\jl_MQYu42USKu")
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ .\process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base .\process.jl:440
  [3] run
    @ .\process.jl:438 [inlined]
  [4] create_sysimg_object_file(object_file::String, packages::Vector{String}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::String, isapp::Bool)
    @ PackageCompiler ~\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:306
  [5] create_sysimage(packages::Vector{Symbol}; sysimage_path::Nothing, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::String, base_sysimage::Nothing, isapp::Bool)
    @ PackageCompiler ~\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:442
  [6] top-level scope
    @ ~\.julia\packages\MKL\3H9w2\src\install.jl:128
  [7] eval
    @ .\boot.jl:360 [inlined]
  [8] change_blas_library(libblas::String)
    @ Main ~\.julia\packages\MKL\3H9w2\src\install.jl:126
  [9] enable_mkl_startup()
    @ Main ~\.julia\packages\MKL\3H9w2\src\install.jl:103
 [10] top-level scope
    @ ~\.julia\packages\MKL\3H9w2\deps\build.jl:13
 [11] include(fname::String)
    @ Base.MainInclude .\client.jl:444
 [12] top-level scope
    @ none:5
in expression starting at C:\Users\LocalAdmin\.julia\packages\MKL\3H9w2\deps\build.jl:13

The Artifact package is already installed, so I am wondering what the problem is in order to try to solve it.

On Ubuntu LTS I am having the same issue when building MKL - the Artifacts dependency not being found properly.

1 Like

What Julia Version do you use?
Iā€™m having similar issues for 1.6.0 on both Windows and Linux.

1 Like

Julia 1.6. Many others have this problem apparently, check Building MKL.jl fails in v1.6.0 Ā· Issue #60 Ā· JuliaLinearAlgebra/MKL.jl Ā· GitHub