Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Packagecompiler.jl to build an application ? #148

Closed
CaiCandong opened this issue Jul 26, 2022 · 2 comments
Closed

How to use Packagecompiler.jl to build an application ? #148

CaiCandong opened this issue Jul 26, 2022 · 2 comments

Comments

@CaiCandong
Copy link

I tried to use packagecompiler.jl to build a GUI Application using gui.jl code

function julia_main()::Cint
    # do something based on ARGS?
    include("gui.jl")
    return 0 # if things finished successfully
end 

When I executed the packaged exe, I encountered an error:

C:\Users\root\Desktop\MyApp\MyAppCompiled\bin>GUI.exe
C++ exception while wrapping module QML: StlWrapper was not instantiated
fatal: error thrown and no exception handler available.
InitError(mod=:QML, error=ErrorException("StlWrapper was not instantiated"))
jl_error at /cygdrive/c/buildbot/worker/package_win64/build/src\rtutils.c:41
register_julia_module at C:\Users\root\Desktop\MyApp\MyAppCompiled\share\julia\artifacts\3a85b9221302007ea676072f41ef1728ee0a3147\bin\libcxxwrap_julia.dll (unknown line)
register_julia_module at C:\Users\root\.julia\packages\CxxWrap\ptbgM\src\CxxWrap.jl:406 [inlined]
initialize_julia_module at C:\Users\root\.julia\packages\CxxWrap\ptbgM\src\CxxWrap.jl:414
__init__ at C:\Users\root\.julia\packages\QML\QJmAc\src\QML.jl:87
jfptr___init___35081.clone_1 at C:\Users\root\Desktop\MyApp\MyAppCompiled\lib\julia\sys.dll (unknown line)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1788 [inlined]
jl_module_run_initializer at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:73
_finish_julia_init at /cygdrive/c/buildbot/worker/package_win64/build/src\init.c:796
jl_init_with_image at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:74 [inlined]
jl_init_with_image at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:63 [inlined]
jl_init at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:90
.text at C:\Users\root\Desktop\MyApp\MyAppCompiled\bin\GUI.exe (unknown line)
__tmainCRTStartup at C:\Users\root\Desktop\MyApp\MyAppCompiled\bin\GUI.exe (unknown line)
.l_start at C:\Users\root\Desktop\MyApp\MyAppCompiled\bin\GUI.exe (unknown line)
BaseThreadInitThunk at C:\WINDOWS\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
@pptav0
Copy link

pptav0 commented Aug 7, 2022

I confirm same issue on MacOs ARM, using grid.jl example, testing with multiprocessing as part of a simple test for further application.

precompile_file

using Distributed;
addprocs(1; exeflags="--project");

@everywhere using MyApp
MyApp.julia_main()

julia_main().

module MyApp
using Distributed

include("./examples/grid.jl")

function julia_main()::Cint
    t = @spawnat 2 main() # main() hast the grid routine
    wait(t)
    return 0
end

end 
julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, westmere)

Output after compilation

C++ exception while wrapping module QML: StlWrapper was not instantiated
fatal: error thrown and no exception handler available.
InitError(mod=:QML, error=ErrorException("StlWrapper was not instantiated"))
jl_error at /Users/user/Codes/MyAppCompiled/lib/julia/libjulia-internal.1.7.dylib (unknown line)
register_julia_module at /Users/user/Codes/MyAppCompiled/share/julia/artifacts/5c402f326a5818eb342a02f9f28cb1dd81cc1a4c/lib/libcxxwrap_julia.0.9.2.dylib (unknown line)
initialize_julia_module at /Users/user/Codes/MyAppCompiled/lib/julia/sys.dylib (unknown line)
__init__ at /Users/user/Codes/MyAppCompiled/lib/julia/sys.dylib (unknown line)
jfptr___init___37601 at /Users/user/Codes/MyAppCompiled/lib/julia/sys.dylib (unknown line)
jl_apply_generic at /Users/user/Codes/MyAppCompiled/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_module_run_initializer at /Users/user/Codes/MyAppCompiled/lib/julia/libjulia-internal.1.7.dylib (unknown line)
_finish_julia_init at /Users/user/Codes/MyAppCompiled/lib/julia/libjulia-internal.1.7.dylib (unknown line)
julia_init at /Users/user/Codes/MyAppCompiled/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_init at /Users/user/Codes/MyAppCompiled/lib/julia/libjulia-internal.1.7.dylib (unknown line)
main at /Users/user/Codes/MyAppCompiled/bin/MyApp (unknown line)

@JanisErdmanis
Copy link

This looks to be a duplicate issue of #164. The PackageCompiler again works with QML 0.9, where the underlying issue seems to have been a bug in the old CxxWrap. I suggest that the issue be closed.

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

No branches or pull requests

4 participants