This improved things a bit, though there are some further issues:
* both __init__ and our test code need to load this file, but the current
directory is different in each case, so I can't give a relative path for
deps/deps.jl itself, which puts us back right where we were.
(I've resolved this temporarily by loading the file in multiple places
inside and outside of __init__ with a fairly complex set of directory
changes. I had to do the same with loading the libraries themselves.)
* I was unable to make "/home/wbhart/.julia/v0.4/Nemo/local/lib/libpari"
work in the ccall (when called within __init__). It needs
"/home/wbhart/.julia/v0.4/Nemo/local/lib/libpari.so"
* The library we actually need to initialise within __init__ (the library
libpari) is being particularly stubborn. I'm able to call the pari_init
function from Nemo.jl from outside of __init__ if I don't precompile. But
if I precompile, this has to go inside __init__ for some reason. But then I
get this:
ERROR: LoadError: InitError: error compiling __init__: could not load
library "/home/wbhart/.julia/v0.4/Nemo/local/lib/libpari.so"
libgmp.so.16: cannot open shared object file: No such file or directory
I have checked the file libpari.so really exists. Certainly libgmp.so.16
exists, and we also put the rpath in the pari library itself (it requires
libgmp) and checked with ldd that it resolves libgmp.so.16.
wbhart@arithmeticon:~/.julia/v0.4/Nemo/local/lib$ ldd libpari.so
linux-vdso.so.1 => (0x00007fffc0950000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd7489b0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd749690000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd7486a8000)
libgmp.so.16 =>
/home/wbhart/.julia/v0.4/Nemo/local/lib/libgmp.so.16 (0x00007fd748430000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd748228000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007fd748008000)
wbhart@arithmeticon:~/.julia/v0.4/Nemo/local/lib$ ls -l libgmp.so.16
lrwxrwxrwx 1 wbhart wbhart 16 Sep 18 13:21 libgmp.so.16 ->
libgmp.so.16.0.0
So in summary, I can call the pari_init function in libpari from outside
__init__ no problems. But from within it I have all sorts of trouble.
Any ideas?
Bill.
On Friday, 18 September 2015 14:01:48 UTC+2, Steven G. Johnson wrote:
>
> The typical thing is to determine your library path at Pkg.build time, in
> a script in YourPkg/deps/build.jl, and write to a const mylibrary="..." in
> YourPkg/deps/deps.jl which is included by your package.
>