trouble precompiling packages

I’ve been happily using julia 0.6.0 on a linux box for a while. Today I tried to add the HDF5 package in the usual way, Pkg.add("HDF5"). This worked fine, but using HDF5 gave me an error. I thought maybe some dependencies were out of date, so I did a Pkg.udpate() and now I’m totally hosed. I don’t seem to be able to precompile any package, as they all give a “premature end of input” syntax error. For example,

$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-pc-linux-gnu

julia> using Compat
INFO: Precompiling module Compat.
ERROR: syntax: incomplete: premature end of input
ERROR: Failed to precompile Compat to /home/bhawkins/.julia/lib/v0.6/Compat.ji.
Stacktrace:
 [1] compilecache(::String) at ./loading.jl:703
 [2] _require(::Symbol) at ./loading.jl:490
 [3] require(::Symbol) at ./loading.jl:398

I didn’t manage to find anything using Google or the Julia issue tracker. Any idea what the problem might be or how I might debug this problem?

Hm, interesting. Here are a few things you can try:

  • Is there perhaps something wrong with your Compat.jl package? I might try cd-ing to ~/.julia/v0.6/Compat and just running a git status to see what’s up
  • Does using a clean Julia package directory fix the problem? You can create a totally separate Julia environment by just doing export JULIA_PKGDIR=/whatever/ before you run julia.
  • It’s also conceivable that you’ve found a Julia bug (although an issue with your package directory seems more likely). It’s probably worth upgrading to the latest 0.6.2 release anyway, since it contains a bunch of useful fixes even if it doesn’t solve this problem.

Thanks. The steps didn’t directly solve my problem, but changing JULIA_PKGDIR reminded me that I’d renamed the julia executable and replaced it with a script as a workaround for a PyPlot bug. I guess the precompile command line is somehow incompatible. Is there an easy way to see the command line arguments used in the precompile step?

$ cat $(which julia)
#!/bin/bash
# Workaround for https://github.com/JuliaPy/PyPlot.jl/issues/151
if [ -z "$JULIA_PKGDIR" ] ; then
    JULIA_PKGDIR=/u/mah-r9b/bhawkins/julia-packages
fi
LIBZ=$JULIA_PKGDIR/v0.6/Conda/deps/usr/lib/libz.so
BIN="/u/proj6/uav/sw/julia-0.6.0/bin/julia-orig"
LD_PRELOAD=$LIBZ $BIN $@

Edit: I should mention that once I use the actual julia binary then I don’t have any precompile troubles, so I’m back in business.

typo here: should be "$@":

LD_PRELOAD="$LIBZ" exec "$BIN" "$@"

Hm, I suppose to do that you might have to replace julia with a shell script that echos the arguments first. Fortunately, I just found such a script on discourse :stuck_out_tongue_winking_eye:

1 Like

Excellent, thanks!

“Our wisdom comes from our experience, and our experience comes from our foolishness.” --Sacha Guitry

1 Like