LLVM LoadError: Permission Denied (EACCES)

Hi, everyone,
I am using Julia on a cluster. But I am having error from LLVM. Here is the steps I took:

$./julia
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |  x86_64-redhat-linux

julia> Pkg.add("CuArrays")
...
#Cloning to Packages' Repo
#Installing Packages 
...
INFO: Building CUDAdrv
INFO: Building LLVM
=======================================================================[ ERROR: LLVM ]========================================================================

LoadError: stat: permission denied (EACCES)
while loading  /home/xiaoqihu/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

==============================================================================================================================================================
INFO: Building CUDAnative
WARNING: LLVM.jl has not been configured, and will not work properly.
WARNING: Please run Pkg.build("LLVM") and restart Julia.
====================================================================[ ERROR: CUDAnative ]=====================================================================

LoadError: UndefVarError: libllvm_system not defined
while loading  /home/xiaoqihu/.julia/v0.6/CUDAnative/deps/build.jl, in expression starting on line 153

==============================================================================================================================================================
INFO: Building SpecialFunctions
INFO: Building CuArrays
WARNING: could not find CUDNN, its functionality will be unavailable

=======================================================================[ BUILD ERRORS ]=======================================================================

WARNING: CUDAnative and LLVM had build errors.

 - packages with build errors remain installed in  /home/xiaoqihu/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("CUDAnative", "LLVM")`
 - build a single package by running its `deps/build.jl` script

==============================================================================================================================================================
INFO: Package database updated

julia> exit()

Here is the output for versioninfo():

julia> versioninfo()
Julia Version 0.6.2
Commit d386e40* (2017-12-13 18:08 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake-avx512)

I did ll on the file mentioned in the error:
$ ll ~/.julia/v0.6/LLVM/deps/build.jl
-rw-r--r-- 1 xiaoqihu tug 3309 May 16 15:55 build.jl

So I see that I don’t have write access for the file. Maybe that was the reason for the error. But when I try to change the access right using chmod, nothing changed:
$ chmod +w ~/.julia/v0.6/LLVM/deps/build.jl
$ ll ~/.julia/v0.6/LLVM/deps/build.jl
-rw-r--r-- 1 xiaoqihu tug 3309 May 16 15:55 build.jl

How can I solve this problem?

Thank you!

The backtrace is missing, try running julia ~/.julia/v0.6/LLVM/deps/build.jl directly to see if there’s more information. I suspect an issue like https://github.com/JuliaGPU/CUDAapi.jl/pull/9

I think you are right. Error happened in the same place

$ ./julia ~/.julia/v0.6/LLVM/deps/build.jl
ERROR: LoadError: stat: permission denied (EACCES)
Stacktrace:
 [1] stat(::SubString{String}) at ./stat.jl:69
 [2] isdir at ./stat.jl:279 [inlined]
 [3] discover_llvm(::Array{Any,1}, ::Array{SubString{String},1}) at /home/xiaoqihu/.julia/v0.6/LLVM/deps/discover.jl:75
 [4] discover_llvm() at /home/xiaoqihu/.julia/v0.6/LLVM/deps/discover.jl:107
 [5] main() at /home/xiaoqihu/.julia/v0.6/LLVM/deps/build.jl:16
 [6] include_from_node1(::String) at ./loading.jl:576
 [7] include(::String) at ./sysimg.jl:14
 [8] process_options(::Base.JLOptions) at ./client.jl:305
 [9] _start() at ./client.jl:371
while loading /home/xiaoqihu/.julia/v0.6/LLVM/deps/build.jl, in expression starting on line 104

OK, shouldn’t be too hard to fix. Please file an issue on LLVM.jl. Also note that this codepath has been removed on latest LLVM for Julia 0.7.

Thank you much for all the information. Issue filed on LLVM.