Skip to content

Conversation

@visr
Copy link

@visr visr commented Oct 14, 2025

Trying to fix #33.

I was hoping it was just a matter of changing the defaults, but it seems to cause segfaults for me running testset "Programmatic binary (trim)" locally on Windows.

I wonder if it could be related to JuliaLang/julia#58952 (comment).

@topolarity
Copy link
Member

topolarity commented Nov 29, 2025

could be related to JuliaLang/julia#58952 (comment).

That problem is now fixed on nightly / master and will be backported in the next 1.12 release

May be worth testing again to see if your issue is gone

Trying to fix JuliaLang#33.

I was hoping it was just a matter of changing the defaults, but it seems to cause segfaults for me running testset "Programmatic binary (trim)" locally on Windows.
@visr visr force-pushed the default_cpu_target branch from c124d97 to ece781c Compare November 29, 2025 18:33
@visr
Copy link
Author

visr commented Nov 29, 2025

I can't really tell, on Julia nightly both main and this PR fail in the same way.

◑ Compiling...fatal: error thrown and no exception handler available.
UndefVarError(var=:exit, world=0x0000000000002c67, scope=Base.Compiler)
ijl_undefined_var_error at C:/workdir/src\rtutils.c:167
compile_and_emit_native at .\../usr/share/julia/Compiler/src\precompile.jl:421
jfptr_compile_and_emit_native_90630 at C:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:2284 [inlined]
jl_create_native_impl at C:/workdir/src\aotcompile.cpp:747
ijl_create_system_image at C:/workdir/src\staticdata.c:3385
ijl_write_compiler_output at C:/workdir/src\precompile.c:140
ijl_atexit_hook at C:/workdir/src\init.c:279
jl_repl_entrypoint at C:/workdir/src\jlapi.c:1139
mainCRTStartup at C:/workdir/cli\loader_exe.c:58
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
Full test output

❯ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.14.0-DEV.1320 (2025-11-29)
 _/ |\__'_|_|_|\__'_|  |  Commit 1067db80b9 (0 days old master)
|__/                   |

(JuliaC) pkg> test
┌ Warning: The project dependencies or compat requirements have changed since the manifest was last resolved.
│ It is recommended to `pkg> resolve` or consider `pkg> update` if necessary.
└ @ Pkg.API C:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\share\julia\stdlib\v1.14\Pkg\src\API.jl:1294
     Testing JuliaC
      Status `C:\ProgramData\DevDrives\cache\Temp\jl_GZHkJI\Project.toml`
  [acedd4c2] JuliaC v0.2.2 `C:\ProgramData\DevDrives\.julia\dev\JuliaC`
  [d8793406] ObjectFile v0.5.0
  [9b87118b] PackageCompiler v2.2.3
  [05181044] RelocatableFolders v1.0.1
  [53d494c1] StructIO v0.3.1
  [f2cf89d6] Patchelf_jll v0.18.0+0
  [4af54fe1] LazyArtifacts v1.11.0
  [8f399da3] Libdl v1.11.0
  [a63ad114] Mmap v1.11.0
  [44cfe95a] Pkg v1.14.0
  [8dfed614] Test v1.11.0
      Status `C:\ProgramData\DevDrives\cache\Temp\jl_GZHkJI\Manifest.toml`
  [c27321d9] Glob v1.3.1
  [692b3bcd] JLLWrappers v1.7.1
  [acedd4c2] JuliaC v0.2.2 `C:\ProgramData\DevDrives\.julia\dev\JuliaC`
  [d8793406] ObjectFile v0.5.0
  [9b87118b] PackageCompiler v2.2.3
  [21216c6a] Preferences v1.5.0
  [189a3867] Reexport v1.2.2
  [05181044] RelocatableFolders v1.0.1
  [6c6a2e73] Scratch v1.3.0
  [53d494c1] StructIO v0.3.1
  [f2cf89d6] Patchelf_jll v0.18.0+0
  [0dad84c5] ArgTools v1.1.2
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [f43a241f] Downloads v1.7.0
  [7b1f6079] FileWatching v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [ac6e5ff7] JuliaSyntaxHighlighting v1.13.0
  [4af54fe1] LazyArtifacts v1.11.0
  [b27032c2] LibCURL v1.0.0
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [a63ad114] Mmap v1.11.0
  [ca575930] NetworkOptions v1.3.0
  [44cfe95a] Pkg v1.14.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v1.0.0
  [9e88b42a] Serialization v1.11.0
  [f489334b] StyledStrings v1.13.0
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test v1.11.0
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.3.0+1
  [deac9b47] LibCURL_jll v8.17.0+0
  [e37daf67] LibGit2_jll v1.9.1+0
  [29816b5a] LibSSH2_jll v1.11.3+1
  [14a3606d] MozillaCACerts_jll v2025.11.4
  [458c3c95] OpenSSL_jll v3.5.4+0
  [efcefdf7] PCRE2_jll v10.47.0+0
  [83775a58] Zlib_jll v1.3.1+2
  [3161d3a3] Zstd_jll v1.5.7+1
  [8e850ede] nghttp2_jll v1.68.0+1
  [3f19e933] p7zip_jll v17.7.0+0
     Testing Running tests...
Running: setenv(`'C:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\bin\julia.exe' -C generic '-JC:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\lib\julia\sys.dll' --depwarn=yes -g1 --color=yes --startup-file=no '--project=C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\lib_project' -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'`,[...])
Precompilation took 0.846779 s
Running: setenv(`'C:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\bin\julia.exe' -C 'generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' '-JC:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\lib\julia\sys.dll' --depwarn=yes -g1 --color=yes --startup-file=no --startup-file=no --history-file=no '--project=C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\lib_project' --output-o 'C:\PROGRA~3\DEVDRI~1\cache\Temp\jl_Kyjv0y\image.o.a' --output-incremental=no --strip-ir --strip-metadata --experimental --trim=safe 'C:\ProgramData\DevDrives\.julia\dev\JuliaC\src\scripts\juliac-buildscript.jl' --scripts-dir 'C:\ProgramData\DevDrives\.julia\dev\JuliaC\src\scripts' --source 'C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\lib_project\src\libtest.jl' --output-lib --compile-ccallable`,[...])
◓ Compiling...Verifier error #1: unresolved call from statement Base._str_sizehint(φ ()::Any)::Int64
Stacktrace:
  [1] print_to_string(::String, ::Vararg{Any})
    @ Base strings\io.jl:138
  [2] string(::String, ::Int64)
    @ Base strings\io.jl:184 [inlined]
  [3] prevind(s::String, i::Int64, n::Int64)
    @ Base strings\basic.jl:506
  [4] prevind(s::String, i::Int64)
    @ Base strings\basic.jl:503 [inlined]
  [5] prevind(s::String, i::UInt64)
    @ Base strings\basic.jl:502 [inlined]
  [6] match(re::Regex, str::String, idx::Int64, add_opts::UInt32)
    @ Base regex.jl:441
  [7] match(re::Regex, str::String, idx::Int64)
    @ Base regex.jl:432 [inlined]
  [8] match(r::Regex, s::String)
    @ Base regex.jl:477 [inlined]
  [9] _splitdir_nodrive(a::String, b::String)
    @ Base.Filesystem path.jl:157
 [10] splitdir(path::String)
    @ Base.Filesystem path.jl:151 [inlined]
 [11] dirname(path::String)
    @ Base.Filesystem path.jl:183 [inlined]
 [12] __init__()
    @ libblastrampoline_jll .\libblastrampoline_jll\src\libblastrampoline_jll.jl:58

Verifier error #2: unresolved call from statement Base.print(%new()::IOBuffer, φ ()::Any)::Any
Stacktrace:
  [1] print_to_string(::String, ::Vararg{Any})
    @ Base strings\io.jl:143
  [2] string(::String, ::Int64)
    @ Base strings\io.jl:184 [inlined]
  [3] prevind(s::String, i::Int64, n::Int64)
    @ Base strings\basic.jl:506
  [4] prevind(s::String, i::Int64)
    @ Base strings\basic.jl:503 [inlined]
  [5] prevind(s::String, i::UInt64)
    @ Base strings\basic.jl:502 [inlined]
  [6] match(re::Regex, str::String, idx::Int64, add_opts::UInt32)
    @ Base regex.jl:441
  [7] match(re::Regex, str::String, idx::Int64)
    @ Base regex.jl:432 [inlined]
  [8] match(r::Regex, s::String)
    @ Base regex.jl:477 [inlined]
  [9] _splitdir_nodrive(a::String, b::String)
    @ Base.Filesystem path.jl:157
 [10] splitdir(path::String)
    @ Base.Filesystem path.jl:151 [inlined]
 [11] dirname(path::String)
    @ Base.Filesystem path.jl:183 [inlined]
 [12] __init__()
    @ libblastrampoline_jll .\libblastrampoline_jll\src\libblastrampoline_jll.jl:58

Verifier error #3: unresolved call from statement Base.IOContext(%new()::IOBuffer, Base.stderr::IO)::IOContext{IOBuffer}
Stacktrace:
 [1] wait_forever()
   @ Base task.jl:1173

Verifier error #4: unresolved call from statement Base.write(Base.stderr::IO, Base.IOContext(%new()::IOBuffer, Base.stderr::IO)::IOContext{IOBuffer})::Any
Stacktrace:
 [1] wait_forever()
   @ Base task.jl:1176

Verifier error #5: unresolved call from statement Core.kwcall(%new()::@NamedTuple{backtrace::Bool}, Base.showerror, io::IOContext{IOBuffer}, Base.getfield(Base.memoryrefget(Base.memoryrefnew(Base.getfield(Base.getfield(stack::Base.ExceptionStack, :stack)::Vector{NamedTuple{(:exception, :backtrace)}}, :ref)::MemoryRef{NamedTuple{(:exception, :backtrace)}}, φ ()::Int64, false::Bool)::MemoryRef{NamedTuple{(:exception, :backtrace)}}, :not_atomic, false::Bool)::NamedTuple{(:exception, :backtrace)}, 1)::Any, Base.getfield(Base.memoryrefget(Base.memoryrefnew(Base.getfield(Base.getfield(stack::Base.ExceptionStack, :stack)::Vector{NamedTuple{(:exception, :backtrace)}}, :ref)::MemoryRef{NamedTuple{(:exception, :backtrace)}}, φ ()::Int64, false::Bool)::MemoryRef{NamedTuple{(:exception, :backtrace)}}, :not_atomic, false::Bool)::NamedTuple{(:exception, :backtrace)}, 2)::Any)::Any
Stacktrace:
 [1] show_exception_stack(io::IOContext{IOBuffer}, stack::Base.ExceptionStack)
   @ Base errorshow.jl:1114
 [2] display_error(io::IOContext{IOBuffer}, stack::Base.ExceptionStack)
   @ Base client.jl:110
 [3] wait_forever()
   @ Base task.jl:1175

Verifier error #6: unresolved call from statement (f::Function)(%new()::IOContext{IOBuffer}, Core.getfield(args::Tuple{String}, 1)::String)::Any
Stacktrace:
 [1] with_output_color(f::Function, color::Symbol, io::IOContext{IOBuffer}, args::String; bold::Bool, italic::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool)
   @ Base util.jl:78
 [2] printstyled(io::IOContext{IOBuffer}, msg::String; bold::Bool, italic::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool, color::Symbol)
   @ Base util.jl:141 [inlined]
 [3] display_error(io::IOContext{IOBuffer}, stack::Base.ExceptionStack)
   @ Base client.jl:109
 [4] wait_forever()
   @ Base task.jl:1175

Verifier error #7: unresolved call from statement Base.print(io::IOBuffer, φ ()::Any)::Any
Stacktrace:
 [1] print(::IOBuffer, ::String, ::SubString{String}, ::Vararg{Any})
   @ Base strings\io.jl:46
 [2] with_output_color(f::Function, color::Symbol, io::IOContext{IOBuffer}, args::String; bold::Bool, italic::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool)
   @ Base util.jl:110
 [3] printstyled(io::IOContext{IOBuffer}, msg::String; bold::Bool, italic::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool, color::Symbol)
   @ Base util.jl:141 [inlined]
 [4] display_error(io::IOContext{IOBuffer}, stack::Base.ExceptionStack)
   @ Base client.jl:109
 [5] wait_forever()
   @ Base task.jl:1175

Verifier error #8: unresolved call from statement (f::Function)(%new()::IOContext{IOBuffer}, Core.getfield(args::Tuple{String}, 1)::String)::Any
Stacktrace:
 [1] with_output_color(f::Function, color::Int64, io::IOContext{IOBuffer}, args::String; bold::Bool, italic::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool)
   @ Base util.jl:78
 [2] printstyled(io::IOContext{IOBuffer}, msg::String; bold::Bool, italic::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool, color::Int64)
   @ Base util.jl:141 [inlined]
 [3] display_error(io::IOContext{IOBuffer}, stack::Base.ExceptionStack)
   @ Base client.jl:109
 [4] wait_forever()
   @ Base task.jl:1175

Verifier error #9: unresolved call from statement Base._str_sizehint(φ ()::Any)::Int64
Stacktrace:
  [1] print_to_string(::String, ::Vararg{Any})
    @ Base strings\io.jl:138
  [2] string(::String, ::Int64)
    @ Base strings\io.jl:184 [inlined]
  [3] prevind(s::String, i::Int64, n::Int64)
    @ Base strings\basic.jl:506
  [4] prevind(s::String, i::Int64)
    @ Base strings\basic.jl:503 [inlined]
  [5] prevind(s::String, i::UInt64)
    @ Base strings\basic.jl:502 [inlined]
  [6] match(re::Regex, str::String, idx::Int64, add_opts::UInt32)
    @ Base regex.jl:441
  [7] match(re::Regex, str::String, idx::Int64)
    @ Base regex.jl:432 [inlined]
  [8] match(r::Regex, s::String)
    @ Base regex.jl:477 [inlined]
  [9] _splitdir_nodrive(a::String, b::String)
    @ Base.Filesystem path.jl:157
 [10] splitdir(path::String)
    @ Base.Filesystem path.jl:151 [inlined]
 [11] dirname(path::String)
    @ Base.Filesystem path.jl:183 [inlined]
 [12] __init__()
    @ libblastrampoline_jll .\libblastrampoline_jll\src\libblastrampoline_jll.jl:58

Verifier error #10: unresolved call from statement Base.print(%new()::IOBuffer, φ ()::Any)::Any
Stacktrace:
  [1] print_to_string(::String, ::Vararg{Any})
    @ Base strings\io.jl:143
  [2] string(::String, ::Int64)
    @ Base strings\io.jl:184 [inlined]
  [3] prevind(s::String, i::Int64, n::Int64)
    @ Base strings\basic.jl:506
  [4] prevind(s::String, i::Int64)
    @ Base strings\basic.jl:503 [inlined]
  [5] prevind(s::String, i::UInt64)
    @ Base strings\basic.jl:502 [inlined]
  [6] match(re::Regex, str::String, idx::Int64, add_opts::UInt32)
    @ Base regex.jl:441
  [7] match(re::Regex, str::String, idx::Int64)
    @ Base regex.jl:432 [inlined]
  [8] match(r::Regex, s::String)
    @ Base regex.jl:477 [inlined]
  [9] _splitdir_nodrive(a::String, b::String)
    @ Base.Filesystem path.jl:157
 [10] splitdir(path::String)
    @ Base.Filesystem path.jl:151 [inlined]
 [11] dirname(path::String)
    @ Base.Filesystem path.jl:183 [inlined]
 [12] __init__()
    @ libblastrampoline_jll .\libblastrampoline_jll\src\libblastrampoline_jll.jl:58

Trim verify finished with 10 errors, 0 warnings.
◑ Compiling...fatal: error thrown and no exception handler available.
UndefVarError(var=:exit, world=0x0000000000002c67, scope=Base.Compiler)
ijl_undefined_var_error at C:/workdir/src\rtutils.c:167
compile_and_emit_native at .\../usr/share/julia/Compiler/src\precompile.jl:421
jfptr_compile_and_emit_native_90630 at C:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\lib\julia\sys.dll (unknown line)
jl_apply at C:/workdir/src\julia.h:2284 [inlined]
jl_create_native_impl at C:/workdir/src\aotcompile.cpp:747
ijl_create_system_image at C:/workdir/src\staticdata.c:3385
ijl_write_compiler_output at C:/workdir/src\precompile.c:140
ijl_atexit_hook at C:/workdir/src\init.c:279
jl_repl_entrypoint at C:/workdir/src\jlapi.c:1139
mainCRTStartup at C:/workdir/cli\loader_exe.c:58
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
✓ Compiling...

Library flows (trim): Error During Test at C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\programatic.jl:1
  Got exception outside of a @test
  Failed to compile C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\lib_project\src\libtest.jl
  Stacktrace:
    [1] error
      @ .\error.jl:44
    [2] compile_products(recipe::ImageRecipe)
      @ JuliaC C:\ProgramData\DevDrives\.julia\dev\JuliaC\src\compiling.jl:117
    [3] top-level scope
      @ C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\programatic.jl:3
    [4] macro expansion
      @ C:\ProgramData\DevDrives\.julia\juliaup\julia-nightly\share\julia\stdlib\v1.14\Test\src\Test.jl:1961 [inlined]
    [5] macro expansion
      @ C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\programatic.jl:11 [inlined]
    [6] include(mapexpr::Function, mod::Module, _path::String)
      @ Base .\Base.jl:310
    [7] top-level scope
      @ C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\runtests.jl:13
    [8] include(mapexpr::Function, mod::Module, _path::String)
      @ Base .\Base.jl:310
    [9] top-level scope
      @ none:6
   [10] eval(m::Module, e::Any)
      @ Core .\boot.jl:489
   [11] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:310
   [12] _start()
      @ Base .\client.jl:577
Test Summary:        | Error  Total  Time
Library flows (trim) |     1      1  3.9s
RNG of the outermost testset: Random.Xoshiro(0xc00dd0ef2d5c131d, 0x9f7edaba9906661a, 0x36d77653687e2e1d, 0xdb6b508d7341ddf8, 0xb0aee49e29b33dc4)
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\programatic.jl:1
in expression starting at C:\ProgramData\DevDrives\.julia\dev\JuliaC\test\runtests.jl:13
ERROR: Package JuliaC errored during testing

@visr
Copy link
Author

visr commented Dec 2, 2025

I tried 1.13.0-alpha2 and got the same error as on nightly above.

However 1.12-nightly, (the future 1.12.3), which includes your fix,, passes all tests on this branch for me, so that seems promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use PackageCompiler's CPU target by default, not native

2 participants