Mexjulia on Ubuntu



Is there anybody around who could help to debug the following error:

ufechner@TUD277255:~/00Software/mexjulia$ matlab
fatal: error thrown and no exception handler available.
Base.InitError(mod=:Sys, error=ErrorException("could not load symbol "jl_array_cconvert_cstring":
/usr/local/MATLAB/R2016b/bin/glnxa64/MATLAB: undefined symbol: jl_array_cconvert_cstring"))
rec_backtrace at /home/ufechner/julia/src/stackwalk.c:84
record_backtrace at /home/ufechner/julia/src/task.c:232
jl_throw at /home/ufechner/julia/src/task.c:550
jl_errorf at /home/ufechner/julia/src/builtins.c:78
jl_dlerror at /home/ufechner/julia/src/dlload.c:69 [inlined]
jl_dlsym at /home/ufechner/julia/src/dlload.c:24

More details see:

Beeing able to write Julia code that can be called from Matlab would help me a lot in cooperating with colleagues from the University.



According to matlab does not use RTLD_GLOBAL.


I do not really understand, how your answer relates to my question. I am not using RTLD_GLOBAL. I want to rephrase my question:

  • I am trying to call Julia from Matlab on Ubuntu;
  • this crashes Matlab with the error message “undefined symbol: jl_array_cconvert_cstring”;
  • as far as I understand, it works fine on Mac and Windows.
    What I do NOT understand:
  • why should the version of the C++ standard library that is linked to Matlab/ Julia should create any problem? If a pure C function interface is used, this should not matter.
    Does anybody understand, what could be the reason for this problem?
    Any comments welcome.


And neither is matlab, which is the issue, since julia cannot use dlsym to find the symbol.

C++ stdlib is irrelevant.


Why is this not a problem on Windows/ Mac then?


Dynamic loading is highly platform dependent. RTLD_LOCAL may not exist or MATLAB may not be using it for whatever reason


This sounds more like Voodoo than like science. There must be a clean way to embed Julia into other languages.


Not sure what you are talking about. You need to make sure libjulia is dlopen’d with RTLD_GLOBAL since otherwise you’ll get the error you see. This is not a julia issue at all but a MATLAB issue. You need to figure out how to embed something into MATLAB cleanly.


Perhaps try this suggestion in the thread linked earlier?

It means to make this call: dlopen("[...]/libjulia", RTLD_GLOBAL) from the mexfile before doing anything else with libjulia.

Accurate, sadly: much of “keeping the lights on” in modern computer systems ends up as a fight against build systems and concepts like “symbol coalescing” and “side-by-side assemblies” and “duplicate typeinfo”.

Not related to Julia (or even MATLAB, except acutely). We live in a fallen (digital) world, yet we struggle on.