# trouble precompiling packages

**URL:** <https://discourse.julialang.org/t/trouble-precompiling-packages/9875>\
**Category:** General Usage\
**Created:** [March 22, 2018, 1:37am UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875 "2018-03-22T01:37:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhawkins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhawkins/32/3778_2.png) [@bhawkins](https://discourse.julialang.org/u/bhawkins)\
**Post date:** [March 22, 2018, 1:37am UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875/1 "2018-03-22T01:37:29Z")

</div>

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,

```nohighlight
$ 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?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 22, 2018, 2:37am UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875/2 "2018-03-22T02:37:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bhawkins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhawkins/32/3778_2.png) [@bhawkins](https://discourse.julialang.org/u/bhawkins)\
**Post date:** [March 22, 2018, 4:08am UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875/3 "2018-03-22T04:08:43Z")

</div>

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](https://github.com/JuliaPy/PyPlot.jl/issues/151). 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?

```bash
$ 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.

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [March 23, 2018, 7:06pm UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875/4 "2018-03-23T19:06:24Z")

</div>

> [@bhawkins](#):
>
> ```julia
> LD_PRELOAD=$LIBZ $BIN $@
> 
> ```

typo here: should be `"$@"`:

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

```

> [@bhawkins](#):
>
> Is there an easy way to see the command line arguments used in the precompile step?

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 😜

---

<div class="post-metadata">

**Author:** ![bhawkins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhawkins/32/3778_2.png) [@bhawkins](https://discourse.julialang.org/u/bhawkins)\
**Post date:** [March 23, 2018, 8:02pm UTC](https://discourse.julialang.org/t/trouble-precompiling-packages/9875/5 "2018-03-23T20:02:23Z")

</div>

Excellent, thanks!

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