I figured out how to get it to run against a source build of Julia. That directory name comes from the directory the binary is installed, so the only way to make it work is to put the binary (./test) into julia/usr/bin. Then that relative directory is correct for sys.so.
So there seem to be three issues here: 1) jl_atexit_hook() requires a return argument (this is also true in 0.4, not just 0.5). This is just a documentation issue. 2) It should be possible to allow Julia to find its sys.so in alternative locations. In particular it should be possible to set this location when embedding Julia, e.g. by setting an environment variable, etc. The example in the documentation should say how to do this, since it is not at all obvious. 3) The Ubuntu packages should install libjulia.so and julia.h so that it is possible for users to make use of embedding. I can make a pull request to fix 1. Should I make tickets for the other two issues? Bill. On Tuesday, 8 December 2015 18:44:28 UTC+1, Bill Hart wrote: > > I don't have this file on either of the systems I have Julia installed on, > either Julia-0.4 or the Julia-0.5 nightly. > > I did try to link against a libjulia.so in a source build of Julia-0.4 but > then it complains: > > ERROR: system image file "/home/wbhart/../lib/julia/sys.so" not found > > I imagine it needs some environment variable set to find this file? I > thought maybe JL_SHARE, but setting this didn't seem to help. > > Bill. > > On Tuesday, 8 December 2015 18:33:47 UTC+1, Kristoffer Carlsson wrote: >> >> For source build I link with libjulia.so in julia/usr/lib. >> >> For binary builds I link with /lib/julia/libjulia.so >> >> Here is a little example of my Cmake setup and c++ file: >> https://github.com/KristofferC/exploration/tree/master/embed_julia >> >> On Tuesday, December 8, 2015 at 6:27:37 PM UTC+1, Bill Hart wrote: >>> >>> I tried the example [1] for embedding Julia in C, using the latest >>> Julia-0.5 nightly, but have run into problems. >>> >>> One trivial problem I had was that jl_atexit_hook(); seems to now >>> require a return argument. That was easy to fix. >>> >>> However the C program given at [1] didn't link. It claims to not be able >>> to find libjulia. Yet Julia is working fine on the system. >>> >>> I did a search to see if I could find libjulia and I have >>> /usr/lib/x86_64-linux-gnu/julia/libjulia.so. But linking against this >>> causes undefined symbol errors, and indeed nm seems to indicate that this >>> library contains no symbols (it may be just a leftover from an old version >>> of Julia I had installed or something). >>> >>> Is embedding currently supported with the nightlies? Do I need to >>> install a different Ubuntu package to get libjulia? (I'm using Ubuntu >>> 14.04). >>> >>> On a different, but related note, does anyone know what the current >>> plans are for producing .o files or executables from Julia, rather than >>> using it via the REPL? I know there was at one point some kind of compiler >>> available. Has that been abandoned, or is it likely to resurface again in >>> some form? I realise it's probably technically feasible. I'm really just >>> asking whether it sits in the currently forseeable roadmap or not. >>> >>> Bill. >>> >>> [1] http://docs.julialang.org/en/latest/manual/embedding/ >>> >>
