On Wednesday, August 17, 2016 at 12:01:31 PM UTC-4, Jan Hlavacek wrote:
>
> I am working on a system that has a number of packages installed system 
> wide in /usr/local/share/julia/site/.  The problem is, when trying to load 
> a package, Julia tries to recompile it, and cannot do so since 
> /usr/local/share/julia/site/lib/v0.4/ 
> is not writable. 
>

Just make sure your system-wide cache-file location is added at the *end* 
of Base.LOAD_CACHE_PATH, not the beginning, and any cache files that need 
to be recompiled will be put into the user's .julia directory, not in the 
read-only system-wide location.   See 
https://github.com/JuliaLang/julia/pull/14369 (which is in Julia 0.4.3 or 
later)
 

> I would not expect the recompile, since the cached ji files should have 
> the same version as the installed jl files, so as far as I can tell, no 
> recompilation should be necessary.  I am trying to figure out if there is 
> any version mismatch, or if there is any other reason for the recompile.  
> Also, is there any way to find out the version of an installed package and 
> the version of the cache?
>

 The cache files are recompiled whenever 
<https://github.com/JuliaLang/julia/blob/cbed9af6d89ea5d51f6a1b51040032f918fb6249/base/loading.jl#L543-L572>
:

1) the Julia version changes
2) the module path changes
3) the timestamp on a source file (that was used to create the cache file) 
changes
4) a dependency module changes (i.e. a dependency was recompiled)

I'm guessing that you are bumping into condition (2).  Instead of compiling 
the modules in your home .julia directory and then copying them into 
/usr/local, what I would suggest would be:

a) remove the module and cache from your .julia directory
b) install the module sources into /usr/local/share/julia/site/v0.4
c) (in sudo julia) add /usr/local/share/julia/site/lib/v0.4 to the 
*beginning* of Base.LOAD_CACHE_PATH and import the module (this will 
recompile the cache file directly into /usr/local)
d) have the users (in their .juliarc) add /usr/local/share/julia/site/lib/v0.4 
to the *end* of their Base.LOAD_CACHE_PATH

Reply via email to