Skip to content

Unresolved calls when compiling with juliac and --trim #319

@Yuan-Ru-Lin

Description

@Yuan-Ru-Lin

The code snippet below (from #308) can't be compiled by juliac with --trim anymore

using FFTW

Base.@ccallable function main()::Cint
    v = fft([0; 1; 2; 1])
    for elem in v
        println(Core.stdout, elem)
    end
    return 0
end
julialauncher +1.12 --project=. --startup-file=no $CFSUSER/.juliaup/juliaup/julia-1.12.0-rc1+0.x64.linux.gnu/share/julia/juliac/juliac.jl --output-exe a.out --compile-ccallable --experimental --trim script2.jl
Verifier error #1: unresolved call from statement FFTW.unsafe_destroy_plan(φ ()::FFTW.FFTWPlan)::Any
Stacktrace:
 [1] foreach(f::typeof(FFTW.unsafe_destroy_plan), itr::Vector{FFTW.FFTWPlan})
   @ Base abstractarray.jl:3188 [inlined]
 [2] destroy_deferred()
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/fft.jl:339
 [3] (FFTW.cFFTWPlan{ComplexF64, -1, false, 1})(X::Vector{ComplexF64}, Y::FFTW.FakeArray{ComplexF64, 1}, region::UnitRange{Int64}, flags::UInt32, timelimit::Float64)
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/FFTW.jl:74
 [4] plan_fft(X::Vector{ComplexF64}, region::UnitRange{Int64}; flags::UInt32, timelimit::Float64, num_threads::Nothing)
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/fft.jl:787 [inlined]
 [5] plan_fft(X::Vector{ComplexF64}, region::UnitRange{Int64})
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/fft.jl:777 [inlined]
 [6] fft(x::Vector{ComplexF64}, region::UnitRange{Int64})
   @ AbstractFFTs /pscratch/sd/y/yuanru/.julia/packages/AbstractFFTs/4iQz5/src/definitions.jl:67 [inlined]
 [7] fft(x::Vector{Int64}, region::UnitRange{Int64})
   @ AbstractFFTs /pscratch/sd/y/yuanru/.julia/packages/AbstractFFTs/4iQz5/src/definitions.jl:214
 [8] fft(x::Vector{Int64})
   @ AbstractFFTs /pscratch/sd/y/yuanru/.julia/packages/AbstractFFTs/4iQz5/src/definitions.jl:66 [inlined]
 [9] main()
   @ Main /global/u2/y/yuanru/trimtest/script2.jl:4

Verifier error #2: unresolved call from statement FFTW.unsafe_destroy_plan(φ ()::FFTW.FFTWPlan)::Any
Stacktrace:
 [1] foreach(f::typeof(FFTW.unsafe_destroy_plan), itr::Vector{FFTW.FFTWPlan})
   @ Base abstractarray.jl:3188 [inlined]
 [2] destroy_deferred()
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/fft.jl:339
 [3] (FFTW.cFFTWPlan{ComplexF64, -1, false, 1})(X::Vector{ComplexF64}, Y::FFTW.FakeArray{ComplexF64, 1}, region::UnitRange{Int64}, flags::UInt32, timelimit::Float64)
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/FFTW.jl:74
 [4] plan_fft(X::Vector{ComplexF64}, region::UnitRange{Int64}; flags::UInt32, timelimit::Float64, num_threads::Nothing)
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/fft.jl:787 [inlined]
 [5] plan_fft(X::Vector{ComplexF64}, region::UnitRange{Int64})
   @ FFTW /pscratch/sd/y/yuanru/.julia/packages/FFTW/r6EbH/src/fft.jl:777 [inlined]
 [6] fft(x::Vector{ComplexF64}, region::UnitRange{Int64})
   @ AbstractFFTs /pscratch/sd/y/yuanru/.julia/packages/AbstractFFTs/4iQz5/src/definitions.jl:67 [inlined]
 [7] fft(x::Vector{Int64}, region::UnitRange{Int64})
   @ AbstractFFTs /pscratch/sd/y/yuanru/.julia/packages/AbstractFFTs/4iQz5/src/definitions.jl:214
 [8] fft(x::Vector{Int64})
   @ AbstractFFTs /pscratch/sd/y/yuanru/.julia/packages/AbstractFFTs/4iQz5/src/definitions.jl:66 [inlined]
 [9] main()
   @ Main /global/u2/y/yuanru/trimtest/script2.jl:4

Trim verify finished with 2 errors, 0 warnings.

Failed to compile script2.jl

Here's result of versioninfo()

Julia Version 1.12.0-rc1
Commit 228edd6610b (2025-07-12 20:11 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 256 × AMD EPYC 7713 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 256 virtual cores)
Environment:
  JULIA_PROJECT = @work
  JULIA_DEPOT_PATH = /pscratch/sd/y/yuanru/.julia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions