Problem building CUDAnative

Hi there. I’m trying to setup Julia to use CuArrays. I have Julia 1.0.4 and the cuda toolkit 10.1, on Pop!_OS. I’m doing (on the REPL)

ENV["LD_LIBRARY_PATH"] = "/usr/lib/cuda/lib64"
ENV["CUDA_PATH"] = "/usr/lib/cuda"
using Pkg;"CuArrays")

which gives me

Building CUDAdrv ───→ ~/.julia/packages/CUDAdrv/WVU1H/deps/build.log
Building LLVM ──────→ ~/.julia/packages/LLVM/ViliQ/deps/build.log
Building CUDAnative → ~/.julia/packages/CUDAnative/nItlk/deps/build.log
┌ Error: Error building CUDAnative:
│ Available CUDA toolchain does not provide libcudadevrt.

│ This is not a fatal error, but GPU functionality will be unavailable.
│ If you expected this to work, please open a thread on
└ @ Pkg.Operations >/buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1096
Building Conda ─────→ ~/.julia/packages/Conda/kLXeC/deps/build.log
Building FFTW ──────→ ~/.julia/packages/FFTW/p7sLQ/deps/build.log
Building CuArrays ──→ ~/.julia/packages/CuArrays/eFBar/deps/build.log
┌ Error: Error building CuArrays:
│ Could not find library ‘cublas’ (it should be part of the CUDA toolkit)
└ @ Pkg.Operations >/buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1096

The environment variables are correct, as far as I can tell. What should I do to get it to build?

Sorry, missed this post. Do you actually have libcudadevrt and libcublas somewhere on your system? You need to install the CUDA toolkit, which provides both. You also shouldn’t need to set those environment variables, as CUDAapi should pick everything up (if it doesn’t, run with JULIA_DEBUG=CUDAapi and file a bug).

The problem was that I had installed Julia via snap (on Ubuntu 18.04) and for some reason it installed the 32 bit version (my system is 64 bit). This was very frustrating, it took a lot of effort to understand the problem (had to dig into the source code of the library that finds CUDA related stuff and randomly test its functions, and tried several other things before realizing the real problem). I would suggest posting a warning about this issue on the installation page.