PackageCompiler.jl cannot create a sysimage with CUDA

The compilation fails during linking BFloat16s.jl with g++. The full text of a minimal working example is available on GitHub Gist, and a truncated version is presented below:

julia> versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12a (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900K
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 32 virtual cores)

pkg> activate --temp

pkg> add CUDA PackageCompiler
   Resolving package versions...
    Updating `$HOME\AppData\Local\Temp\jl_W5DHw4\Project.toml`
  [052768ef] + CUDA v5.5.2
  [9b87118b] + PackageCompiler v2.1.24
[...]

julia> using PackageCompiler

julia> create_sysimage(["CUDA"], sysimage_path = "CUDA.jl-sysimage.dll")
[...]
$HOME\AppData\Local\Temp\jl_ZA7qvMLupC-o.a(text#0.o): In function `BFloat16':
$HOME\.julia\packages\BFloat16s\u3WQc\src/bfloat16.jl:158: undefined reference to `__truncdfbf2'
$HOME\.julia\packages\BFloat16s\u3WQc\src/bfloat16.jl:158: undefined reference to `__truncdfbf2'
collect2.exe: error: ld returned 1 exit status
ERROR: failed process: Process(setenv(`'$HOME\.julia\artifacts\fdff308295487f361ef6e8dc2d27f5abe8a6eee9\mingw64\bin\g++.exe' -m64 -march=x86-64 -shared '-L$HOME\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\bin' '-L$HOME\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\bin' -o CUDA.jl-sysimage.dll -Wl,--whole-archive '$HOME\AppData\Local\Temp\jl_ZA7qvMLupC-o.a' -Wl,--no-whole-archive -ljulia -ljulia-internal -lopenlibm -Wl,--export-all-symbols`,["WINDIR=C:\\WINDOWS",  "HOMEPATH=$HOME" …  "TEMP=$HOME\\AppData\\Local\\Temp"]), ProcessExited(1)) [1]

Stacktrace:
 [1] pipeline_error
   @ .\process.jl:598 [inlined]
 [2] run(::Cmd; wait::Bool)
   @ Base .\process.jl:513
 [3] run
   @ .\process.jl:510 [inlined]
 [4] run_compiler(cmd::Cmd; cplusplus::Bool)
   @ PackageCompiler $HOME\.julia\packages\PackageCompiler\gMDVC\src\PackageCompiler.jl:200
 [5] run_compiler
   @ $HOME\.julia\packages\PackageCompiler\gMDVC\src\PackageCompiler.jl:196 [inlined]
 [6] create_sysimg_from_object_file(object_files::Vector{String}, sysimage_path::String; version::Nothing, compat_level::String, soname::Nothing)
   @ PackageCompiler $HOME\.julia\packages\PackageCompiler\gMDVC\src\PackageCompiler.jl:725
 [7] create_sysimg_from_object_file
   @ $HOME\.julia\packages\PackageCompiler\gMDVC\src\PackageCompiler.jl:711 [inlined]
 [8] create_sysimage(packages::Vector{…}; sysimage_path::String, project::String, precompile_execution_file::Vector{…}, precompile_statements_file::Vector{…}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::Nothing, julia_init_c_file::Nothing, julia_init_h_file::Nothing, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String, import_into_main::Bool)
   @ PackageCompiler $HOME\.julia\packages\PackageCompiler\gMDVC\src\PackageCompiler.jl:691
 [9] top-level scope
   @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.

I’ve since installed clang through https://releases.llvm.org and using JULIA_CC=clang as an environment variable, however that presents a different set of problems where clang is unable to open a julia.lib file.

Oddly I get same error on windows but not linux

Can you create an issue at GitHub · Where software is built ?

I do have an issue filed on BFloat16s.jl: Creating sysimage fails on Windows · Issue #88 · JuliaMath/BFloat16s.jl · GitHub. Since it’s the same issue and I’m not sure which package needs to be fixed, I wasn’t sure where to file the issue either

1 Like