Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UndefRefError after upgrading Matlab #152

Closed
bantin opened this issue Nov 24, 2018 · 8 comments · Fixed by #153
Closed

UndefRefError after upgrading Matlab #152

bantin opened this issue Nov 24, 2018 · 8 comments · Fixed by #153

Comments

@bantin
Copy link

bantin commented Nov 24, 2018

I just upgraded to Matlab 2018b. I changed my MATLAB_HOME environment variable to the new path, and I can confirm that Julia can see the new path, because running get(ENV, "MATLAB_HOME", "") returns "/Applications/MATLAB_R2018b.app" as expected.

However, I can't access any functionality from MATLAB.jl. Simply running @mput with any variable gives the following error.

julia> @mput a
ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] (::getfield(MATLAB, Symbol("##MSession#11#12")))(::String, ::Type, ::Int64) at /Users/Bantin/.julia/packages/MATLAB/SljED/src/engine.jl:26
 [2] Type at /Users/Bantin/.julia/packages/MATLAB/SljED/src/engine.jl:23 [inlined] (repeats 2 times)
 [3] get_default_msession at /Users/Bantin/.julia/packages/MATLAB/SljED/src/engine.jl:88 [inlined]
 [4] put_variable(::Symbol, ::Int64) at /Users/Bantin/.julia/packages/MATLAB/SljED/src/engine.jl:159
 [5] top-level scope at none:0

I'm using Julia 1.0 on Mac OSX Yosemite.

@musm
Copy link
Collaborator

musm commented Nov 26, 2018

which matlab.jl version ?

@musm
Copy link
Collaborator

musm commented Nov 26, 2018

Try first
pkg> up
then test and if that doesn't work, try
pkg> build MATLAB

@bantin
Copy link
Author

bantin commented Nov 26, 2018

Hi @musm,

I'm using matlab.jl v0.7.1.

Running the test gives the following error:

ERROR: LoadError: InitError: MATLAB.jl built with version at exec /Applications/MATLAB_R2014a.app/bin/matlab, but detected new installation at exec /Applications/MATLAB_R2018b.app/bin/matlab.
Run `import Pkg; Pkg.build("MATLAB")` and restart Julia.

However, after following the instructions by building the package and restarting Julia, I still get the same error when I run the test.

@bantin
Copy link
Author

bantin commented Nov 26, 2018

Yes, I did restart Julia but that didn't fix it.

What did fix it was the following: I removed the package using Pkg.rm and also removed all of the associated .jl files. Then I re-added the package using Pkg. Now the tests pass.

I think the issue then is that maybe running Pkg.build and restarting Julia doesn't always resolve the InitError, but this might be a special case because I updated my MATLAB version. Either way, feel free to close the issue if you don't think it needs any action.

@musm
Copy link
Collaborator

musm commented Nov 26, 2018

very strange, updating matlab and running pkg> build MATLAB should have updated the old reference. Which should trigger a precompilation and update everything.

@musm
Copy link
Collaborator

musm commented Nov 26, 2018

Ok I think I see the issue build MATLAB doesn't update the precompile cache.

@Batmanabcdefg
Copy link

@musm

the same issue now ..............

@sadda
Copy link

sadda commented Jan 10, 2021

What solved this issue for me was

pkg> build HDF5

as suggested in #164

@musm musm closed this as completed Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants