I get this error when trying to compile a fairly long code. I succeeded previously with Julia 1.5, having to manually edit out of some deps.jl file some hardcoded library paths. It wasn’t easy but it worked. Now, with most libraries using the artifacts system, that is much alleviated, but I get the following error and I can’t find the cause:
ERROR: @ccallable was already defined for this method name
Stacktrace:
[1] _ccallable(rt::Type, sigt::Type)
@ Base .\c.jl:498
[2] top-level scope
@ c.jl:529
ERROR: LoadError: failed process: Process(`'C:\Users\usr\AppData\Local\Programs\Julia-1.6.1\bin\julia.exe' --color=yes --startup-file=no '--cpu-target=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' '--sysimage=C:\Users\usr\AppData\Local\Temp\jl_oUKlQj\tmp_sys.so' '--project=C:\Users\usr\Desktop\DKT\CodeR - v1.5 - dev\compilable_code' '--output-o=C:\Users\usr\AppData\Local\Temp\jl_V3iHdZTDNY.o' -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "C:\\Users\\usr\\AppData\\Local\\Programs\\Julia-1.6.1\\share\\julia\\stdlib\\v1.6"
Base.init_load_path()
if isdefined(Base, :init_active_project)
Base.init_active_project()
end
Base.init_depot_path()
import compilable_code
# 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\\usr\\AppData\\Local\\Temp\\jl_6krAUC3B01"
]
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
Base.@ccallable function julia_main()::Cint
try
compilable_code.julia_main()
catch
Core.print("julia_main() threw an unhandled exception")
return 1
end
end
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::Nothing, isapp::Bool)
@ PackageCompiler C:\Users\usr\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:306
[5] create_sysimage(packages::Symbol; sysimage_path::String, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::String, isapp::Bool)
@ PackageCompiler C:\Users\usr\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:442
[6] (::PackageCompiler.var"#9#10"{Vector{String}, Vector{String}, Bool, Bool, String, String, String, String, String})()
@ PackageCompiler C:\Users\usr\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:672
[7] cd(f::PackageCompiler.var"#9#10"{Vector{String}, Vector{String}, Bool, Bool, String, String, String, String, String}, dir::String)
@ Base.Filesystem .\file.jl:95
[8] create_app(package_dir::String, app_dir::String; app_name::Nothing, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, audit::Bool, force::Bool, c_driver_program::String, cpu_target::String)
@ PackageCompiler C:\Users\usr\.julia\packages\PackageCompiler\3BsME\src\PackageCompiler.jl:661
[9] top-level scope
@ C:\Users\usr\Desktop\DKT\CodeR - v1.5 - dev\make.jl:5
in expression starting at C:\Users\usr\Desktop\DKT\CodeR - v1.5 - dev\make.jl:5module compilable_code
include(joinpath(pwd(),"..\\..\\LabReactor\\LabReactor.jl"))
include(joinpath(pwd(),"..\\..\\Reactor\\Reactor_Release.jl"))
using .LabReactor
using .Reactor
using NLopt
using LSODA
using DelimitedFiles
#using Random
#Random.__init__()
#run_estimation(3)
#model_transient()
#estimate_transient(2)
#estimate_fresh_profile(2)
#println("\n\nPRECOMPILATION SUCCESFUL\n\n")
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
println("compilable_code Reactor Model\n\n")
run_estimation(200)
#=
TaskFile = joinpath(pwd(),"IO\\Task.dat")
task = readdlm(TaskFile)
if task[1] == "Kinetics"
run_estimation(200)
elseif task[1] == "Reactor" && task[2] == "Modelling"
model_transient()
elseif task[1] == "Reactor" && task[4] == "Deactivation"
estimate_transient(50)
elseif task[1] == "Reactor" && task[4] == "Heat"
estimate_fresh_profile(200)
end
=#
return 0
end
end