JuliaPy / JuliaPy/PyCall.jl

Error compiling PyCall with PackageCompiler - Julia 1.5

Open
#850 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/tkf/PyCall.jl/tree/aot/aot), and still get the same error.

Any pointers are appreciated.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.