Debugging AoT compile errors

#1

Hi folks,

I’m running into some odd errors compiling code to binary (via PackageCompiler) with Julia 1.1. Same code worked fine on 0.6 and works when running normally (not compiling to binary) on 1.1. The errors are rather cryptic (‘ptrtoint not supported for non-integral pointers’). I don’t see any hints as to where this is in the code (not even sure if it’s coming from my code) and since it takes a couple of minutes before it fails, finding an MWE is difficult. Are there any tips for how to get more meaningful error messages/logs from the compilation process? Thanks,

Dara

/build/julia-1.1.0//bin/julia /build/julia-1.1.0//pkg/packages//PackageCompiler/osIMW/juliac.jl -vae --math-mode fast -O3 --depwarn no --inline yes -d /tmp/build_application_bin_1550250559_zzy /src/application_main.jl
Julia program file:
  "/src/application_main.jl"
C program file:
  "/build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/examples/program.c"
Build directory:
  "/tmp/build_application_bin_1550250559_zzy"
Build static library "application_main.a":
  `/build/julia-1.1.0/bin/julia -Cnative -J/build/julia-1.1.0/lib/julia/sys.so -g1 --startup-file=no --compiled-modules=no --depwarn=no -O3 --inline=yes --math-mode=fast --code-coverage=none --output-o application_main.a -e 'Base.__init__(); Sys.__init__() # initialize \`Base\` and \`Sys\` modules
pushfirst!(Base.DEPOT_PATH, "cache_ji_v1.1.0") # save precompiled modules locally
include("/src/application_main.jl") # include Julia program file
'`
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
LLVM ERROR: Broken function found, compilation aborted!
ERROR: LoadError: failed process: Process(`/build/julia-1.1.0/bin/julia -Cnative -J/build/julia-1.1.0/lib/julia/sys.so -g1 --startup-file=no --compiled-modules=no --depwarn=no -O3 --inline=yes --math-mode=fast --code-coverage=none --output-o application_main.a -e 'Base.__init__(); Sys.__init__() # initialize \`Base\` and \`Sys\` modules
pushfirst!(Base.DEPOT_PATH, "cache_ji_v1.1.0") # save precompiled modules locally
include("/src/application_main.jl") # include Julia program file
'`, ProcessExited(1)) [1]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
 [2] pipeline_error at ./process.jl:785 [inlined]
 [3] #run#515(::Bool, ::Function, ::Cmd) at ./process.jl:726
 [4] run(::Cmd) at ./process.jl:724
 [5] (::getfield(PackageCompiler, Symbol("##12#13")))() at /build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/src/static_julia.jl:277
 [6] cd(::getfield(PackageCompiler, Symbol("##12#13")), ::String) at ./file.jl:96
 [7] build_object(::String, ::String, ::String, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::String, ::Nothing, ::Nothing, ::Nothing, ::Int64, ::Nothing, ::String, ::Nothing, ::String) at /build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/src/static_julia.jl:276
 [8] #static_julia#5(::Nothing, ::Bool, ::Bool, ::String, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::String, ::Nothing, ::Nothing, ::Nothing, ::Int64, ::Nothing, ::String, ::Nothing, ::String, ::Nothing, ::Array{String,1}, ::typeof(static_julia), ::String) at /build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/src/static_julia.jl:174
 [9] (::getfield(PackageCompiler, Symbol("#kw##static_julia")))(::NamedTuple{(:builddir, :depwarn, :optimize, :inline, :autodeps, :verbose, :executable, :cc_flags, :math_mode),Tuple{String,String,Int64,String,Bool,Bool,Bool,Array{String,1},String}}, ::typeof(static_julia), ::String) at ./none:0
 [10] julia_main(::Array{String,1}) at /build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/juliac.jl:178
 [11] top-level scope at /build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/juliac.jl:184
 [12] include at ./boot.jl:326 [inlined]
 [13] include_relative(::Module, ::String) at ./loading.jl:1038
 [14] include(::Module, ::String) at ./sysimg.jl:29
 [15] exec_options(::Base.JLOptions) at ./client.jl:267
 [16] _start() at ./client.jl:436
in expression starting at /build/julia-1.1.0/pkg/packages/PackageCompiler/osIMW/juliac.jl:183
0 Likes

#2

Through further testing, it looks like this is a regression introduced by one or another optimization in Julia 1.1. With 1.0.3 and -O3 it works, and with 1.1 and -O1 it works, but with 1.1 and -O2 or -O3 it fails as seen above.

0 Likes