Julia CG 1: Trying some CG with Julia

<–more–!>

Precompilation problem on Ubuntu

On Ubuntu 18.04, when I am trying to run the script, I encounter the following error:

(base) alan@AlanShawn-SU-Ubuntu:~/LearnJulia/julia_cg/1$ julia main.jl
ERROR: LoadError: LoadError: InitError: could not load library "/home/alan/.julia/artifacts/3cd20f6135e742ca5c9828e2965ae5b858721ad0/lib/libexslt.so"
/usr/lib/x86_64-linux-gnu/libxslt.so.1: version `LIBXML2_1.1.30' not found (required by /home/alan/.julia/artifacts/3cd20f6135e742ca5c9828e2965ae5b858721ad0/lib/libexslt.so)
Stacktrace:
 [1] #dlopen#3(::Bool, ::typeof(Libdl.dlopen), ::String, ::UInt32) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Libdl/src/Libdl.jl:109
 [2] dlopen at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] __init__() at /home/alan/.julia/packages/XSLT_jll/aqo3w/src/wrappers/x86_64-linux-gnu.jl:58
 [4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:692
 [5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:776
 [6] _require(::Base.PkgId) at ./loading.jl:1001
 [7] require(::Base.PkgId) at ./loading.jl:922
 [8] require(::Module, ::Symbol) at ./loading.jl:917
 [9] include at ./boot.jl:328 [inlined]
 [10] include_relative(::Module, ::String) at ./loading.jl:1105
 [11] include at ./Base.jl:31 [inlined]
 [12] include(::String) at /home/alan/.julia/packages/Xorg_libxcb_jll/XhlmY/src/Xorg_libxcb_jll.jl:1
 [13] top-level scope at /home/alan/.julia/packages/Xorg_libxcb_jll/XhlmY/src/Xorg_libxcb_jll.jl:50
 [14] include at ./boot.jl:328 [inlined]
 [15] include_relative(::Module, ::String) at ./loading.jl:1105
 [16] include(::Module, ::String) at ./Base.jl:31
 [17] top-level scope at none:2
 [18] eval at ./boot.jl:330 [inlined]
 [19] eval(::Expr) at ./client.jl:425
 [20] top-level scope at ./none:3
during initialization of module XSLT_jll
in expression starting at /home/alan/.julia/packages/Xorg_libxcb_jll/XhlmY/src/wrappers/x86_64-linux-gnu.jl:4
in expression starting at /home/alan/.julia/packages/Xorg_libxcb_jll/XhlmY/src/Xorg_libxcb_jll.jl:43
ERROR: LoadError: LoadError: Failed to precompile Xorg_libxcb_jll [c7cfdc94-dc32-55de-ac96-5a1b8d977c5b] to /home/alan/.julia/compiled/v1.3/Xorg_libxcb_jll/n4mZf_Ah6TS.ji.

The key message is libxslt.so.1: version `LIBXML2_1.1.30' not found, which means libxslt version 1.1.30 is missing. The source of this version can be found at http://xmlsoft.org/sources/. We can build this version and install its libraries in a specific folder. The usage of configure and Makefile is documented in the INSTALL file:

When installing from a distribution package like a tar.gz:
==========================================================

expand the package

run ./configure possibly indicating the desired installation prefix:

    ./configure --prefix=/usr

then run

    make

to build the project and

    make install

After installing, the lib folder should contain the following files:

(base) alan@AlanShawn-SU-Ubuntu:~/LearnJulia/julia_cg/libxslt/lib$ ls
libexslt.a   libexslt.so    libexslt.so.0.8.18  libxslt.la       libxslt.so    libxslt.so.1.1.30
libexslt.la  libexslt.so.0  libxslt.a           libxslt-plugins  libxslt.so.1

Now, set the correct LD_LIBRARY_PATH environment variable and run Julia.

(base) alan@AlanShawn-SU-Ubuntu:~/LearnJulia/julia_cg/1$ export LD_LIBRARY_PATH=~/LearnJulia/julia_cg/libxslt/lib
(base) alan@AlanShawn-SU-Ubuntu:~/LearnJulia/julia_cg/1$ julia main.jl

These are all pre-configured in run.sh, provided that the xslt libraries are stored in /libxslt/lib.