I have installed Julia a while ago and I realized that it used by default a pre-compiled binary. After reading about it, I realized that I could compile it natively using the PackageCompiler
module. Indeed, upon loading the module, I get this message:
julia> using PackageCompiler
WARNING: Your Julia system image is not compiled natively for this CPU architecture.
Please run `PackageCompiler.force_native_image!()` for optimal Julia performance
So I proceed with using PackageCompiler.force_native_image!()
. However, this gives me this error after some compiling:
julia> PackageCompiler.force_native_image!()
INFO: Copying system image: /home/user/.julia/v0.6/PackageCompiler/sysimg/backup/native/sys.o to /usr/lib/julia/sys.o
ERROR: open: permission denied (EACCES)
Stacktrace:
[1] uv_error at ./libuv.jl:68 [inlined]
[2] open(::String, ::UInt16, ::UInt16) at ./filesystem.jl:81
[3] sendfile(::String, ::String) at ./file.jl:523
[4] #cp#10(::Bool, ::Bool, ::Function, ::String, ::String) at ./file.jl:227
[5] (::Base.Filesystem.#kw##cp)(::Array{Any,1}, ::Base.Filesystem.#cp, ::String, ::String) at ./<missing>:0
[6] copy_system_image(::String, ::String, ::Bool) at /home/user/.julia/v0.6/PackageCompiler/src/PackageCompiler.jl:49
[7] force_native_image!() at /home/user/.julia/v0.6/PackageCompiler/src/api.jl:116
[8] macro expansion at ./REPL.jl:97 [inlined]
[9] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
So basically it's trying to copy something to a root-access-only directory: /usr/lib/
.
Coming from Python, I never had issues like that, and when I did it meant I was doing something wrong. So I'm weary of running Julia with sudo
and doing the same steps (which I think will solve this issue but possibly create other permission issues down the road).
My question is: what is the right way to do this? Is the right way really running Julia as root?! (The docs weren't helpful at all with this.)