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

Pkg.test() fails #14

Open
LuzieH opened this issue Nov 29, 2022 · 4 comments
Open

Pkg.test() fails #14

LuzieH opened this issue Nov 29, 2022 · 4 comments

Comments

@LuzieH
Copy link

LuzieH commented Nov 29, 2022

Hello,

I cannot get Mex to run.
In the beginning I had a problem that Mex could not build, but after adding the Mex path to

ENV["MATLABPATH"]="/home/user/.julia/packages/Mex/5WarT/mexjulia"

manually the Pkg.build() ran through.
Unfortunately, Pkg.test() throws the following error

pkg> test Mex
     Testing Mex
      Status `/tmp/jl_zvEiaW/Project.toml`
  [10e44e05] MATLAB v0.8.3
  [5e29dd5e] Mex v0.1.0
  [8dfed614] Test `@stdlib/Test`
      Status `/tmp/jl_zvEiaW/Manifest.toml`
  [10e44e05] MATLAB v0.8.3
  [5e29dd5e] Mex v0.1.0
  [189a3867] Reexport v1.2.2
  [56f22d72] Artifacts `@stdlib/Artifacts`
  [2a0f44e3] Base64 `@stdlib/Base64`
  [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
  [8f399da3] Libdl `@stdlib/Libdl`
  [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
  [56ddb016] Logging `@stdlib/Logging`
  [d6f4376e] Markdown `@stdlib/Markdown`
  [9a3f8284] Random `@stdlib/Random`
  [ea8e919c] SHA v0.7.0 `@stdlib/SHA`
  [9e88b42a] Serialization `@stdlib/Serialization`
  [2f01184e] SparseArrays `@stdlib/SparseArrays`
  [8dfed614] Test `@stdlib/Test`
  [e66e0078] CompilerSupportLibraries_jll v0.5.2+0 `@stdlib/CompilerSupportLibraries_jll`
  [4536629a] OpenBLAS_jll v0.3.20+0 `@stdlib/OpenBLAS_jll`
  [8e850b90] libblastrampoline_jll v5.1.1+0 `@stdlib/libblastrampoline_jll`
Precompiling project...
  2 dependencies successfully precompiled in 2 seconds. 4 already precompiled.
  2 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions
     Testing Running tests...
Error using mexjulia
Unhandled Julia exception: ErrorException

Error in jl.init (line 145)
            mexjulia(true, 'using Mex')

Error in jl.check_init (line 112)
                jl.init()

Error in jl.mex (line 21)
            jl.check_init();

Error in jl.eval (line 30)
            [varargout{1:nargout}] = jl.mex('Mex.jl_eval', expr);
 
Error using save
Variable 'matlab_jl_2' not found.
 
jl.eval: Error During Test at /home/htc/bzfhelfm/.julia/packages/Mex/5WarT/test/runtests.jl:7
  Got exception outside of a @test
  MATLAB.MEngineError("failed to get variable matlab_jl_2 from MATLAB session")
  Stacktrace:
    [1] get_mvariable(session::MSession, name::Symbol)
      @ MATLAB ~/.julia/packages/MATLAB/SVjnA/src/engine.jl:164
    [2] get_mvariable
      @ ~/.julia/packages/MATLAB/SVjnA/src/engine.jl:168 [inlined]
    [3] get_variable(name::Symbol)
      @ MATLAB ~/.julia/packages/MATLAB/SVjnA/src/engine.jl:170
    [4] macro expansion
      @ ~/.julia/packages/MATLAB/SVjnA/src/matstr.jl:162 [inlined]
    [5] macro expansion
      @ ~/.julia/packages/Mex/5WarT/test/runtests.jl:9 [inlined]
    [6] macro expansion
      @ /data/numerik/people/bzfsikor/julia/julia-1.8.3/share/julia/stdlib/v1.8/Test/src/Test.jl:1360 [inlined]
    [7] top-level scope
      @ ~/.julia/packages/Mex/5WarT/test/runtests.jl:9
    [8] include(fname::String)
      @ Base.MainInclude ./client.jl:476
    [9] top-level scope
      @ none:6
   [10] eval
      @ ./boot.jl:368 [inlined]
   [11] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:276
   [12] _start()
      @ Base ./client.jl:522
Test Summary: | Error  Total  Time
jl.eval       |     1      1  7.4s
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /home/htc/bzfhelfm/.julia/packages/Mex/5WarT/test/runtests.jl:5
ERROR: Package Mex errored during testing

Do you have any ideas on how to proceed?

Thanks,
Luzie

@taylormcd
Copy link
Collaborator

What MATLAB release are you using? One of this packages dependencies, MATLAB.jl doesn't work with 2022a and 2022b.

I have some automated tests that passed a year ago but fail now with the newer versions of MATLAB.

@taylormcd
Copy link
Collaborator

taylormcd commented Nov 30, 2022

The latest versions of MATLAB (2022a and 2022b) and Julia (v1.8) don't appear to work with this package.

The automatic tests currently work with MATLAB 2021b and Julia 1.6. Perhaps try that combination? Or you could try using https://github.com/jondeuce/MATDaemon.jl

I should note that while calling into Julia works pretty well, calling back into MATLAB (which automatically occurs when Julia catches an error) seems to inevitably lead to a segfault when using this package, although it doesn't happen immediately. I was never really able to find out the reason why when I was working actively on this package.

@LuzieH
Copy link
Author

LuzieH commented Nov 30, 2022

Thanks for the quick reply @taylormcd. I am using Matlab 2019b. MATLAB.jl runs smoothly, its only Mex where the tests fail, so I believe the problem lies there.
I want to use Matlab's optimization function fmincon, and I was trying to use Fmincon.jl (https://github.com/byuflowlab/Fmincon.jl) to port from Julia to Matlab, for that I need Mex.

@taylormcd
Copy link
Collaborator

taylormcd commented Nov 30, 2022

I can confirm that the master branch (i.e. dev Mex) works on Linux with MATLAB 2021b and Julia 1.8.

I also tested to make sure Fmincon.jl still works, though I did make a small edit.

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

No branches or pull requests

2 participants