4

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.)

sophros
  • 14,672
  • 11
  • 46
  • 75
TomCho
  • 3,204
  • 6
  • 32
  • 83
  • 1
    I guess this depends where you've put your julia installe (I assume this is on Linux?). Clearly to replace your julia installation you need to be in a state where you have write access to the julia installation dir. On my linux machine I simply put julia in my home folder and symlinked, as by the installation instructions. – Michael K. Borregaard May 28 '18 at 11:09
  • @MichaelK.Borregaard That's one option, but I installed mine through the package manager (I'm using Arch Linux), which by default install it in the `/usr/` directory. I was thinking that there should a way to do this without without having to manually install it on my home folder. Could you please point me to the documentation where you saw the symlink thing? I don't remember seeing that in the docs. – TomCho May 29 '18 at 15:22
  • 1
    https://julialang.org/downloads/platform.html#generic-linux-binaries – Michael K. Borregaard May 29 '18 at 17:37

0 Answers0