PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

Error compiling PyCall with PackageCompiler - Julia 1.5

Open alsaibie opened this issue 5 years ago • 1 comments

Hi,

Apologies if this is not the place to post, but tried to search around for an answer with no luck.

While trying to compile PyCall (SymPy at first) using PackageCompiler, both through VSCode-Extension and directly by calling create_sysimage, I get the following error: FATAL ERROR: Symbol "ccall_PyImport_ImportModule_71184" not found.

> create_sysimage([:PyCall], sysimage_path="sys_plots.so")

create_sysimage([:PyCall],  sysimage_path="sys_plots.so")
[ Info: PackageCompiler: creating system image object file, this might take a while...
FATAL ERROR: Symbol "ccall_PyImport_ImportModule_71184"not found
signal (22): SIGABRT
in expression starting at none:0
crt_sig_handler at /cygdrive/d/buildbot/worker/package_win64/build/src\signals-win.c:92
raise at C:\WINDOWS\System32\msvcrt.dll (unknown line)
abort at C:\WINDOWS\System32\msvcrt.dll (unknown line)
addModule at /cygdrive/d/buildbot/worker/package_win64/build/src\jitlayers.cpp:640
..
..
..
ERROR: failed process: Process(`'C:\dev_sw\Julia\1.5.1\bin\julia.exe' --color=yes --startup-file=no --cpu-target=native '--sysimage=C:\dev_sw\Julia\1.5.1\lib\julia\sys.dll' '--project=c:\dev_sw\JuliaPlay\PrecompileTests\SymPy' '--output-o=C:\Users\alsai\AppData\Local\Temp\jl_r9U8z7vQXT.o' 
-e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
Base.init_load_path()
Base.init_depot_path()
import PyCall
# 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_statements = String[]
        append!(precompile_statements, readlines("C:\\Users\\alsai\\AppData\\Local\\Temp\\jl_6xuufnlOOc"))

    for statement in sort(precompile_statements)
        # 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{☺, 100}")
        try
            Base.include_string(PrecompileStagingArea, statement)
        catch
            # See julia issue #28808
            @debug "failed to execute $statement"
        end
    end
end # module
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(3)) [3]

Stacktrace:
 [1] pipeline_error at .\process.jl:525 [inlined]
 [2] run(::Cmd; wait::Bool) at .\process.jl:440
 [3] run at .\process.jl:438 [inlined]
 [4] create_sysimg_object_file(::String, ::Array{String,1}; project::String, base_sysimage::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, cpu_target::String, script::Nothing, isapp::Bool) at C:\Users\alsai\.julia\packages\PackageCompiler\Beagl\src\PackageCompiler.jl:295
 [5] create_sysimage(::Array{Symbol,1}; sysimage_path::String, project::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::Nothing, isapp::Bool) at C:\Users\alsai\.julia\packages\PackageCompiler\Beagl\src\PackageCompiler.jl:426
 [6] top-level scope at REPL[2]:1

Tried the compilation test suggested here, and still get the same error.

Any pointers are appreciated.

alsaibie avatar Oct 16 '20 12:10 alsaibie

Same error here on Windows 10 x64, Julia 1.5.2:

PackageCompiler.create_sysimage(:PyCall, sysimage_path = "JuliaSysimage.so")
[ Info: PackageCompiler: creating system image object file, this might take a while...
FATAL ERROR: Symbol "ccall_PyImport_ImportModule_29435"not found
signal (22): SIGABRT
in expression starting at none:0
crt_sig_handler at /cygdrive/d/buildbot/worker/package_win64/build/src\signals-win.c:92
raise at C:\WINDOWS\System32\msvcrt.dll (unknown line)
abort at C:\WINDOWS\System32\msvcrt.dll (unknown line)
addModule at /cygdrive/d/buildbot/worker/package_win64/build/src\jitlayers.cpp:640
jl_add_to_ee at /cygdrive/d/buildbot/worker/package_win64/build/src\jitlayers.cpp:893
jl_add_to_ee at /cygdrive/d/buildbot/worker/package_win64/build/src\jitlayers.cpp:901 [inlined]
_jl_compile_codeinst at /cygdrive/d/buildbot/worker/package_win64/build/src\jitlayers.cpp:102
jl_generate_fptr at /cygdrive/d/buildbot/worker/package_win64/build/src\jitlayers.cpp:302
jl_compile_method_internal at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:1964
jl_compile_method_internal at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:1931 [inlined]
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2224 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2398
#s91#158 at .\namedtuple.jl:312 [inlined]
#s91#158 at .\none:0
GeneratedFunctionStub at .\boot.jl:527
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1690 [inlined]
jl_call_staged at /cygdrive/d/buildbot/worker/package_win64/build/src\method.c:376
jl_code_for_staged at /cygdrive/d/buildbot/worker/package_win64/build/src\method.c:423
get_staged at .\compiler\utilities.jl:94
retrieve_code_info at .\compiler\utilities.jl:105 [inlined]
InferenceState at .\compiler\inferencestate.jl:118
abstract_call_method_with_const_args at .\compiler\abstractinterpretation.jl:261
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:134
abstract_call_known at .\compiler\abstractinterpretation.jl:904
abstract_call at .\compiler\abstractinterpretation.jl:926
abstract_call at .\compiler\abstractinterpretation.jl:911
abstract_eval at .\compiler\abstractinterpretation.jl:1005
typeinf_local at .\compiler\abstractinterpretation.jl:1270
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1326
typeinf at .\compiler\typeinfer.jl:12
typeinf_edge at .\compiler\typeinfer.jl:484
abstract_call_method at .\compiler\abstractinterpretation.jl:419
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:111
abstract_call_known at .\compiler\abstractinterpretation.jl:904
abstract_call at .\compiler\abstractinterpretation.jl:926
abstract_call at .\compiler\abstractinterpretation.jl:911
abstract_eval at .\compiler\abstractinterpretation.jl:1005
typeinf_local at .\compiler\abstractinterpretation.jl:1270
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1326
typeinf at .\compiler\typeinfer.jl:12
typeinf_edge at .\compiler\typeinfer.jl:484
abstract_call_method at .\compiler\abstractinterpretation.jl:419
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:111
abstract_call_known at .\compiler\abstractinterpretation.jl:904
abstract_call at .\compiler\abstractinterpretation.jl:926
abstract_call at .\compiler\abstractinterpretation.jl:911
abstract_eval at .\compiler\abstractinterpretation.jl:1005
typeinf_local at .\compiler\abstractinterpretation.jl:1270
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1326
typeinf at .\compiler\typeinfer.jl:12
typeinf_edge at .\compiler\typeinfer.jl:484
abstract_call_method at .\compiler\abstractinterpretation.jl:419
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:111
abstract_call_known at .\compiler\abstractinterpretation.jl:904
abstract_call at .\compiler\abstractinterpretation.jl:926
abstract_call at .\compiler\abstractinterpretation.jl:911
abstract_eval at .\compiler\abstractinterpretation.jl:1005
typeinf_local at .\compiler\abstractinterpretation.jl:1270
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1326
typeinf at .\compiler\typeinfer.jl:12
typeinf_edge at .\compiler\typeinfer.jl:484
abstract_call_method at .\compiler\abstractinterpretation.jl:419
abstract_call_gf_by_type at .\compiler\abstractinterpretation.jl:111
abstract_call_known at .\compiler\abstractinterpretation.jl:904
abstract_call at .\compiler\abstractinterpretation.jl:926
abstract_call at .\compiler\abstractinterpretation.jl:911
abstract_eval at .\compiler\abstractinterpretation.jl:1005
typeinf_local at .\compiler\abstractinterpretation.jl:1270
typeinf_nocycle at .\compiler\abstractinterpretation.jl:1326
typeinf at .\compiler\typeinfer.jl:12
typeinf_ext at .\compiler\typeinfer.jl:570
typeinf_ext at .\compiler\typeinfer.jl:601
unknown function (ip: 000000001BD7EA45)
_jl_invoke at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2214 [inlined]
jl_apply_generic at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:2398 [inlined]
jl_apply at /cygdrive/d/buildbot/worker/package_win64/build/src\julia.h:1690 [inlined]
jl_type_infer at /cygdrive/d/buildbot/worker/package_win64/build/src\gf.c:296
jl_create_native at /cygdrive/d/buildbot/worker/package_win64/build/src\aotcompile.cpp:309
jl_precompile at /cygdrive/d/buildbot/worker/package_win64/build/src\precompile.c:408
jl_write_compiler_output at /cygdrive/d/buildbot/worker/package_win64/build/src\precompile.c:33
jl_atexit_hook at /cygdrive/d/buildbot/worker/package_win64/build/src\init.c:218
wmain at /cygdrive/d/buildbot/worker/package_win64/build/ui\repl.c:228
__tmainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-7.0.0-1/crt\crtexe.c:334
mainCRTStartup at /usr/src/debug/mingw64-x86_64-runtime-7.0.0-1/crt\crtexe.c:223
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Allocations: 24091441 (Pool: 24082211; Big: 9230); GC: 22
ERROR: failed process: Process(`'C:\Users\touste\Desktop\Julia 1.5.2\bin\julia.exe' --color=yes --startup-file=no --cpu-target=native '--sysimage=C:\Users\touste\Desktop\Julia 1.5.2\lib\julia\sys.dll' --project=. '--output-o=C:\Users\touste\AppData\Local\Temp\jl_1E2UBz6sLQ.o' -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
Base.init_load_path()
Base.init_depot_path()
import PyCall
# 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_statements = String[]
       append!(precompile_statements, readlines("C:\\Users\\touste\\AppData\\Local\\Temp\\jl_0QQSGvSCsu"))

   for statement in sort(precompile_statements)
       # 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
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(3)) [3]

Stacktrace:
[1] pipeline_error at .\process.jl:525 [inlined]
[2] run(::Cmd; wait::Bool) at .\process.jl:440
[3] run at .\process.jl:438 [inlined]
[4] create_sysimg_object_file(::String, ::Array{String,1}; project::String, base_sysimage::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, cpu_target::String, script::Nothing, isapp::Bool) at C:\Users\touste\.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:295
[5] create_sysimage(::Symbol; sysimage_path::String, project::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::Nothing, isapp::Bool) at C:\Users\touste\.julia\packages\PackageCompiler\AerNj\src\PackageCompiler.jl:426
[6] top-level scope at REPL[5]:1

touste avatar Oct 28 '20 21:10 touste