byuflowlab / Mex.jl

Embedding Julia in the MATLAB process.
MIT License
34 stars 8 forks source link

DLLs load improperly under 2021b in Windows 10/11 #21

Open bolognam opened 4 months ago

bolognam commented 4 months ago

I believe the following DLL files in the <install directory>\bin\win64\ directory of MATLAB have issues in locked-down Windows (i.e. without administrator privileges): libgit2.dll libssh2.dll

This causes julia to fail with stacktraces similar to the following:

fatal: error thrown and no exception handler available.
InitError(mod=:LibCURL_jll, error=ErrorException("could not load library "libcurl-4.dll"
The specified procedure could not be found. "))
ijl_errorf at /home/user/julia/src\rtutils.c:77
ijl_load_dynamic_library at /home/user/julia/src\dlload.c:388
#dlopen#3 at .\libdl.jl:117
dlopen at .\libdl.jl:116 [inlined]
dlopen at .\libdl.jl:116 [inlined]
__init__ at C:\cygwin64\home\user\julia\usr\share\julia\stdlib\v1.10\LibCURL_jll\src\LibCURL_jll.jl:30
jfptr___init___96794 at C:\Users\User\AppData\Local\Programs\Julia-1.10.4\lib\julia\sys.dll (unknown line)
_jl_invoke at /home/user/julia/src\gf.c:2876 [inlined]
ijl_apply_generic at /home/user/julia/src\gf.c:3077
jl_apply at /home/user/julia/src\julia.h:1982 [inlined]
jl_module_run_initializer at /home/user/julia/src\toplevel.c:76
_finish_julia_init at /home/user/julia/src\init.c:901
ijl_init_with_image at /home/user/julia/src\jlapi.c:70 [inlined]
ijl_init_with_image at /home/user/julia/src\jlapi.c:59
mexFunction at C:\Users\User\.julia\dev\Mex.jl\mexjulia\mexjulia.mexw64 (unknown line)
### Stacktrace truncated

By renaming these files and re-running the build step, Julia is able to use Mex.jl as expected.

Renaming these DLL files requires administrator privileges, so this is not a viable solution for locked-down Windows users (i.e. without administrator privileges).

I believe Julia would need a patch to fix this issue.