juliamatlab / mexjulia

embedding Julia in the MATLAB process.
MIT License
52 stars 14 forks source link

Add rpath to jlcall (Mac OS X) #10

Closed omus closed 8 years ago

omus commented 8 years ago

On Mac OS X (10.11.2) I could sucessfully compile jlcall but not run it due to the following error:

Invalid MEX-file '/.../jlcall/m/jlcall.mexmaci64':
dlopen(/.../jlcall/m/jlcall.mexmaci64, 1): Library not loaded: @rpath/libjulia.dylib
  Referenced from: /.../jlcall/m/jlcall.mexmaci64
  Reason: image not found

Error in Jl/get_mex_handle (line 58)
      jlcall('', Jl.julia_home, Jl.julia_image);

The solution of compiling with -rpath in #7 doesn't work under OS X and even setting the environment variables DYLD_LIBRARY_PATH and/or LD_RUN_PATH also doesn't appear to work. The solution I have provided is what is used by homebrew-julia so it should work on other OS X versions.

twadleigh commented 8 years ago

Thanks for the contributions. Can we say that jlcall is basically functional on OS X now?

omus commented 8 years ago

I would say so.