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

juliac fails to compile executable: LoadError: ArgumentError: Package REPL not found in current path #194

Closed
nicolamos opened this issue Mar 1, 2019 · 3 comments · Fixed by #304

Comments

@nicolamos
Copy link

I am trying to compile a script to an executable. I tried running juliac.jl with the command

julia -- ~/.julia/packages/PackageCompiler/oT98U/juliac.jl -vRe ./test.jl

where test.jl is simply

println("TEST")

It fails with error: LoadError: ArgumentError: Package REPL not found in current path.
It seems that LOAD_PATH is not set when compiling the generated script, although it contains the paths I added in my startup.jl file.

This may be related to #47 .

The complete log:

ERROR: LoadError: ArgumentError: Package REPL not found in current path:
- Run `import Pkg; Pkg.add("REPL")` to install the REPL package.

in expression starting at ~/.julia/packages/PackageCompiler/oT98U/sysimg/run_julia_code.jl:6
ERROR: LoadError: failed process: Process(`/Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia --optimize=3 -g0 --output-o=test.a --track-allocation=none --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --compile=yes --track-allocation=none --sysimage-native-code=yes --sysimage=/Applications/Julia-1.1.app/Contents/Resources/julia/lib/julia/sys.dylib --compiled-modules=yes --optimize=2 ~/.julia/packages/PackageCompiler/oT98U/sysimg/run_julia_code.jl`, ProcessExited(1)) [1]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
 [2] pipeline_error at ./process.jl:785 [inlined]
 [3] #run#515(::Bool, ::Function, ::Cmd) at ./process.jl:726
 [4] run at ./process.jl:724 [inlined]
 [5] #run_julia#1 at ~/.julia/packages/PackageCompiler/oT98U/src/compiler_flags.jl:225 [inlined]
 [6] #run_julia at ./none:0 [inlined]
 [7] (::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,String,String,Nothing,Nothing,Nothing}}},String})() at ~/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:262
 [8] cd(::getfield(PackageCompiler, Symbol("##13#14")){Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,String,String,Nothing,Nothing,Nothing}}},String}, ::String) at ./file.jl:96
 [9] #build_object#12(::Base.Iterators.Pairs{Symbol,Any,NTuple{14,Symbol},NamedTuple{(:sysimage, :startup_file, :handle_signals, :sysimage_native_code, :compiled_modules, :depwarn, :warn_overwrite, :compile, :cpu_target, :optimize, :debug_level, :inline, :check_bounds, :math_mode),Tuple{Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,String,String,Nothing,Nothing,Nothing}}}, ::Function, ::String, ::String, ::String, ::Bool) at ~/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:261
 [10] #build_object at ./none:0 [inlined]
 [11] build_object(::String, ::String, ::String, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::String, ::String, ::Nothing, ::Nothing, ::Nothing) at ~/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:240
 [12] #static_julia#5(::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Array{String,1}, ::typeof(static_julia), ::String) at ~/.julia/packages/PackageCompiler/oT98U/src/static_julia.jl:161
 [13] (::getfield(PackageCompiler, Symbol("#kw##static_julia")))(::NamedTuple{(:verbose, :executable, :Release, :cc_flags),Tuple{Bool,Bool,Bool,Array{String,1}}}, ::typeof(static_julia), ::String) at ./none:0
 [14] julia_main(::Array{String,1}) at ~/.julia/packages/PackageCompiler/oT98U/juliac.jl:178
 [15] top-level scope at ~/.julia/packages/PackageCompiler/oT98U/juliac.jl:184
 [16] include at ./boot.jl:326 [inlined]
 [17] include_relative(::Module, ::String) at ./loading.jl:1038
 [18] include(::Module, ::String) at ./sysimg.jl:29
 [19] exec_options(::Base.JLOptions) at ./client.jl:267
 [20] _start() at ./client.jl:436
in expression starting at ~/.julia/packages/PackageCompiler/oT98U/juliac.jl:183
Julia program file:
  "~/.../test.jl"
C program file:
  "~/.julia/packages/PackageCompiler/oT98U/examples/program.c"
Build directory:
  "~/.../builddir"
Build static library "test.a":
  atexit_hook_copy = copy(Base.atexit_hooks) # make backup
# clean state so that any package we use can carelessly call atexit
empty!(Base.atexit_hooks)
Base.__init__()
Sys.__init__() #fix https://github.com/JuliaLang/julia/issues/30479
using REPL
Base.REPL_MODULE_REF[] = REPL
M = Module()
# Include into anonymous module to not polute namespace
@eval(M, (Base.include($M, "~/.../test.jl")))
Base._atexit() # run all exit hooks we registered during precompile
empty!(Base.atexit_hooks) # don't serialize the exit hooks we run + added
# atexit_hook_copy should be empty, but who knows what base will do in the future
append!(Base.atexit_hooks, atexit_hook_copy)
@nicolamos nicolamos changed the title juliac.jl fails to compile executable: LoadError: ArgumentError: Package REPL not found in current path juliac fails to compile executable: LoadError: ArgumentError: Package REPL not found in current path Mar 1, 2019
@nicolamos
Copy link
Author

I managed to successfully compile the script by setting JULIA_LOAD_PATH to /Applications/Julia-1.1.app/Contents/Resources/julia/lib/julia. I think, though, that this should not be necessary.

I then added a test plot with Plots and GR. The compilation is fine, but I need to set DYLD_LIBRARY_PATH for the script to be able to find libGR.so or copy/sym-link it into the executable directory. I think this should be mentioned, or maybe I missed something?

@arnavs
Copy link

arnavs commented Aug 28, 2019

@myrddin89 To what did you set the DYLD_LIBRARY_PATH? Having the same issue.

@nicolamos
Copy link
Author

@myrddin89 To what did you set the DYLD_LIBRARY_PATH? Having the same issue.

I am seeing this comment only now… I am so so sorry…

I did not look into it in a long time, but I think, if I remember correctly, that DYLD_LIBRARY_PATH should be set to the directory where libGR.so lives; or more appropriately, one should set the @rpath in the executable. I do not know if there have been any improvements in this direction. Maybe I will look into it.

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