comonicon / Comonicon.jl

Your best CLI generator in JuliaLang
https://comonicon.org
MIT License
282 stars 25 forks source link

PackageCompiler fails to build standalone app because it attempts to bundle mingw-w64 [BUG] #270

Open andres-alban opened 7 months ago

andres-alban commented 7 months ago

Describe the bug When trying to compile a standalone app, PackageCompiler runs into an error trying to load mingw-w64. When I compile the project with PackageCompiler directly, it works fine and does not load mingw-w64. I can install and build a sysimg without any errors.

Version of the package: Comonicon v1.0.6 PackageCompiler v2.1.17 Julia version 1.6.7

To Reproduce MWE of the app

module cmd_test
using Comonicon

@cast function test()
    greet()
    return 0
end

greet() = print("Hello World!")

@main

end # module

deps/build.jl

using cmd_test
cmd_test.comonicon_install()

Comonicon.toml

name = "cmd_test"

[application]
incremental=false
filter_stdlibs=false

[sysimg]

Expected behavior When compiling with PackageCompiler, I get the following output:

julia> create_app(".", "app", force=true)
PackageCompiler: bundled libraries:
  ├── Base:
  │    ├── libatomic-1.dll - 280.401 KiB
  │    ├── libdSFMT.dll - 117.661 KiB
  │    ├── libgcc_s_seh-1.dll - 652.186 KiB
  │    ├── libgfortran-5.dll - 12.932 MiB
  │    ├── libgmp-10.dll - 1.070 MiB
  │    ├── libgmp.dll - 1.070 MiB
  │    ├── libgmpxx-4.dll - 321.332 KiB
  │    ├── libgmpxx.dll - 321.332 KiB
  │    ├── libgomp-1.dll - 1.679 MiB
  │    ├── libjulia-internal.dll - 73.051 MiB
  │    ├── libmpfr-6.dll - 2.331 MiB
  │    ├── libmpfr.dll - 2.331 MiB
  │    ├── libopenlibm.dll - 372.239 KiB
  │    ├── libpcre2-16-0.dll - 688.407 KiB
  │    ├── libpcre2-16.dll - 688.407 KiB
  │    ├── libpcre2-32-0.dll - 660.752 KiB
  │    ├── libpcre2-32.dll - 660.752 KiB
  │    ├── libpcre2-8-0.dll - 750.391 KiB
  │    ├── libpcre2-8.dll - 750.391 KiB
  │    ├── libpcre2-posix-3.dll - 111.937 KiB
  │    ├── libquadmath-0.dll - 1.388 MiB
  │    ├── libssp-0.dll - 163.159 KiB
  │    ├── libstdc++-6.dll - 26.844 MiB
  │    ├── libuv-2.dll - 940.152 KiB
  │    ├── libwinpthread-1.dll - 374.147 KiB
  │    ├── libz.dll - 217.223 KiB
  │    ├── libjulia.dll - 244.156 KiB
  ├── Stdlibs:
  │   ├── nghttp2_jll
  │   │   ├── libnghttp2-14.dll - 786.855 KiB
  │   ├── MbedTLS_jll
  │   │   ├── libmbedcrypto.dll - 639.168 KiB
  │   │   ├── libmbedtls.dll - 364.459 KiB
  │   │   ├── libmbedx509.dll - 258.202 KiB
  │   ├── LibCURL_jll
  │   │   ├── libcurl-4.dll - 714.178 KiB
  │   ├── LibSSH2_jll
  │   │   ├── libssh2.dll - 352.214 KiB
  Total library file size: 133.858 MiB
✔ [00m:46s] PackageCompiler: creating compiler .ji image (incremental=false)
⠇ [02m:06s] PackageCompiler: compiling fresh sysimage (incremental=false)
Precompiling project...
  12 dependencies successfully precompiled in 12 seconds
✔ [00m:39s] PackageCompiler: compiling nonincremental system image

When I compile with Comonicon, Package compiler attempts to bundle additional artifacts and fails:

PS ~\cmd_test> julia --project .\deps\build.jl app
┌ Info: application options: 
│   options.application = Comonicon.Configs.Application("build", Comonicon.Configs.Asset[], false, false, true, "generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)", Comonicon.Configs.Precompile(String[], String[]), "~\\.julia\\packages\\PackageCompiler\\nT5sD\\src\\embedding_wrapper.c", ["zsh"])
└   build_dir = "~\\cmd_test\\build\\cmd_test"
PackageCompiler: bundled libraries:
  ├── Base:
  │    ├── libatomic-1.dll - 280.401 KiB
  │    ├── libdSFMT.dll - 117.661 KiB
  │    ├── libgcc_s_seh-1.dll - 652.186 KiB
  │    ├── libgfortran-5.dll - 12.932 MiB
  │    ├── libgmp-10.dll - 1.070 MiB
  │    ├── libgmp.dll - 1.070 MiB
  │    ├── libgmpxx-4.dll - 321.332 KiB
  │    ├── libgmpxx.dll - 321.332 KiB
  │    ├── libgomp-1.dll - 1.679 MiB
  │    ├── libjulia-internal.dll - 73.051 MiB
  │    ├── libmpfr-6.dll - 2.331 MiB
  │    ├── libmpfr.dll - 2.331 MiB
  │    ├── libopenlibm.dll - 372.239 KiB
  │    ├── libpcre2-16-0.dll - 688.407 KiB
  │    ├── libpcre2-16.dll - 688.407 KiB
  │    ├── libpcre2-32-0.dll - 660.752 KiB
  │    ├── libpcre2-32.dll - 660.752 KiB
  │    ├── libpcre2-8-0.dll - 750.391 KiB
  │    ├── libpcre2-8.dll - 750.391 KiB
  │    ├── libpcre2-posix-3.dll - 111.937 KiB
  │    ├── libquadmath-0.dll - 1.388 MiB
  │    ├── libssp-0.dll - 163.159 KiB
  │    ├── libstdc++-6.dll - 26.844 MiB
  │    ├── libuv-2.dll - 940.152 KiB
  │    ├── libwinpthread-1.dll - 374.147 KiB
  │    ├── libz.dll - 217.223 KiB
  │    ├── libjulia.dll - 244.156 KiB
  ├── Stdlibs:
  │   ├── nghttp2_jll
  │   │   ├── libnghttp2-14.dll - 786.855 KiB
  │   ├── MbedTLS_jll
  │   │   ├── libmbedcrypto.dll - 639.168 KiB
  │   │   ├── libmbedtls.dll - 364.459 KiB
  │   │   ├── libmbedx509.dll - 258.202 KiB
  │   ├── LibCURL_jll
  │   │   ├── libcurl-4.dll - 714.178 KiB
  │   ├── LibSSH2_jll
  │   │   ├── libssh2.dll - 352.214 KiB
  Total library file size: 133.858 MiB
PackageCompiler: bundled artifacts:
  └── PackageCompiler
      └── mingw-w64 - 436.383 MiB
ERROR: LoadError: IOError: open("~\\cmd_test\\build\\cmd_test\\share\\julia\\artifacts\\fdff308295487f361ef6e8dc2d27f5abe8a6eee9\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\include\\c++\\ext\\pb_ds\\detail\\bin_search_tree_\\constructors_destructor_fn_imps.hpp", 769, 33206): no such file or directory (ENOENT)