Skip to content

Conversation

musm
Copy link
Collaborator

@musm musm commented Feb 6, 2022

close #194

@yakir12 Any chance you want to test this out?

@yakir12
Copy link

yakir12 commented Feb 6, 2022

Hmmm, I did this and it errored on the build:

julia> ENV["MATLAB_ROOT"] = ""
""

(@v1.7) pkg> activate --temp
  Activating new project at `/tmp/jl_xeGpQQ`

(jl_xeGpQQ) pkg> add MATLAB#linxu
    Updating git-repo `https://github.com/JuliaInterop/MATLAB.jl.git`
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
    Updating `/tmp/jl_xeGpQQ/Project.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
    Updating `/tmp/jl_xeGpQQ/Manifest.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
  [56f22d72] + Artifacts
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [4536629a] + OpenBLAS_jll
  [8e850b90] + libblastrampoline_jll
    Building MATLAB  `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/a4d75c3a73b5ccb4e4c29130859ee32a8ec19636/build.log`
ERROR: Error building `MATLAB`: 
ERROR: LoadError: could not load library "bin/glnxa64/libmx"
bin/glnxa64/libmx.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen (repeats 2 times)
   @ ./libdl.jl:117 [inlined]
 [2] dlpath(libname::String)
   @ Base.Libc.Libdl ./libdl.jl:240
 [3] top-level scope
   @ ~/.julia/packages/MATLAB/XzriZ/deps/build.jl:79
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [5] top-level scope
   @ none:5
in expression starting at /home/yakir/.julia/packages/MATLAB/XzriZ/deps/build.jl:76

@musm
Copy link
Collaborator Author

musm commented Feb 6, 2022

Try again if possible.

That's because

julia> ENV["MATLAB_ROOT"] = ""

sets it to an empty string. I've updated the PR to ignore this.

@yakir12
Copy link

yakir12 commented Feb 7, 2022

(@v1.7) pkg> activate --temp
  Activating new project at `/tmp/jl_JqChH1`

julia> ENV["MATLAB_ROOT"] = ""
""
(jl_JqChH1) pkg> add MATLAB#linxu

    Updating git-repo `https://github.com/JuliaInterop/MATLAB.jl.git`
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
    Updating `/tmp/jl_JqChH1/Project.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
    Updating `/tmp/jl_JqChH1/Manifest.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
  [56f22d72] + Artifacts
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [e66e0078] + CompilerSupportLibraries_jll
  [4536629a] + OpenBLAS_jll
  [8e850b90] + libblastrampoline_jll
    Building MATLAB  `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/7566e213f88e2a8c23a9fb70d384e62bdddfd412/build.log`
ERROR: Error building `MATLAB`: 
[ Info: Detected MATLAB root folder at "/usr/local"
[ Info: Detected MATLAB executable at "/usr/local/bin/matlab"
ERROR: LoadError: could not load library "/usr/local/bin/glnxa64/libmx"
/usr/local/bin/glnxa64/libmx.so: cannot open shared object file: No such file or directory

@musm
Copy link
Collaborator Author

musm commented Feb 7, 2022

Hmm that's really strange, I've specified it to search in /usr/local/MATLAB/... out of curiosity are you sure you pulled in the latest commits on this PR?

Ensure both MATLAB_HOME and MATLAB_ROOT are unset

julia> ENV["MATLAB_ROOT"] = nothing
julia> ENV["MATLAB_HOME"] = nothing

@musm
Copy link
Collaborator Author

musm commented Feb 8, 2022

any luck with that?

@yakir12
Copy link

yakir12 commented Feb 11, 2022

As you can see, I'm on the latest linxu branch of MATLAB, and set both env variables to nothing and it errored. But it looks like it's just using nothing as the root directory of matlab (some what ironic):

julia> ENV["MATLAB_HOME"] = nothing

julia> ENV["MATLAB_ROOT"] = nothing

(@v1.7) pkg> activate --temp
  Activating new project at `/tmp/jl_Ayik6W`
(jl_Ayik6W) pkg> dev MATLAB
   Resolving package versions...
    Updating `/tmp/jl_Ayik6W/Project.toml`
  [10e44e05] + MATLAB v0.8.2 `~/.julia/dev/MATLAB`
    Updating `/tmp/jl_Ayik6W/Manifest.toml`
  [10e44e05] + MATLAB v0.8.2 `~/.julia/dev/MATLAB`
  [56f22d72] + Artifacts
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [e66e0078] + CompilerSupportLibraries_jll
  [4536629a] + OpenBLAS_jll
  [8e850b90] + libblastrampoline_jll

(jl_Ayik6W) pkg> st
      Status `/tmp/jl_Ayik6W/Project.toml`
  [10e44e05] MATLAB v0.8.2 `~/.julia/dev/MATLAB`

(jl_Ayik6W) pkg> build MATLAB
    Building MATLAB  `~/.julia/dev/MATLAB/deps/build.log`
ERROR: Error building `MATLAB`: 
ERROR: LoadError: could not load library "nothing/bin/glnxa64/libmx"
nothing/bin/glnxa64/libmx.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen (repeats 2 times)
   @ ./libdl.jl:117 [inlined]
 [2] dlpath(libname::String)
   @ Base.Libc.Libdl ./libdl.jl:240
 [3] top-level scope
   @ ~/.julia/dev/MATLAB/deps/build.jl:79
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [5] top-level scope
   @ none:5
in expression starting at /home/yakir/.julia/dev/MATLAB/deps/build.jl:76

shell> cd .julia/dev/MATLAB/
/home/yakir/.julia/dev/MATLAB

shell> git status
On branch linxu
Your branch is up to date with 'origin/linxu'.

nothing to commit, working tree clean

@musm
Copy link
Collaborator Author

musm commented Feb 11, 2022

Very, very strange. Thanks for checking. I do not see how that could happen, since we check

    if isnothing(matlab_root) || isempty(matlab_root)
        matlab_exe = Sys.which("matlab")
        if !isnothing(matlab_exe)

@yakir12
Copy link

yakir12 commented Feb 16, 2022

I'm not sure what else I can try over here... Here is a careful attempt with 1.7.2. Let me know if you can think of anything else I should check or try,,,

yakir@luna:~$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.2 (2022-02-06)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

julia> ENV["MATLAB_HOME"] = nothing

julia> ENV["MATLAB_ROOT"] = nothing

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [6e4b80f9] BenchmarkTools v1.2.2
  [5789e2e9] FileIO v1.13.0
  [82e4d734] ImageIO v0.6.1
  [14b8a8f1] PkgTemplates v0.7.26
  [295af30f] Revise v3.3.1

(@v1.7) pkg> activate --temp
  Activating new project at `/tmp/jl_cl6bMG`

(jl_cl6bMG) pkg> add MATLAB#linxu
    Updating git-repo `https://github.com/JuliaInterop/MATLAB.jl.git`
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
    Updating `/tmp/jl_cl6bMG/Project.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
    Updating `/tmp/jl_cl6bMG/Manifest.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
  [56f22d72] + Artifacts
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [e66e0078] + CompilerSupportLibraries_jll
  [4536629a] + OpenBLAS_jll
  [8e850b90] + libblastrampoline_jll
Precompiling project...
  ✗ MATLAB
  3 dependencies successfully precompiled in 1 seconds
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package
(jl_cl6bMG) pkg> precompile
Precompiling project...
  ✗ MATLAB
  0 dependencies successfully precompiled in 1 seconds (3 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

MATLAB [10e44e05-a98a-55b3-a45b-ba969058deb6]

Failed to precompile MATLAB [10e44e05-a98a-55b3-a45b-ba969058deb6] to /home/yakir/.julia/compiled/v1.7/MATLAB/jl_kKaQWg.
ERROR: LoadError: MATLAB is not properly installed. Please run Pkg.build("MATLAB") and restart Julia.
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/MATLAB/TMHAJ/src/MATLAB.jl:40
 [2] top-level scope (repeats 2 times)
   @ none:1
in expression starting at /home/yakir/.julia/packages/MATLAB/TMHAJ/src/MATLAB.jl:1

(jl_cl6bMG) pkg> build MATLAB
    Building MATLAB  `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/7566e213f88e2a8c23a9fb70d384e62bdddfd412/build.log`
ERROR: Error building `MATLAB`: 
ERROR: LoadError: could not load library "nothing/bin/glnxa64/libmx"
nothing/bin/glnxa64/libmx.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen (repeats 2 times)
   @ ./libdl.jl:117 [inlined]
 [2] dlpath(libname::String)
   @ Base.Libc.Libdl ./libdl.jl:240
 [3] top-level scope
   @ ~/.julia/packages/MATLAB/TMHAJ/deps/build.jl:79
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [5] top-level scope
   @ none:5
in expression starting at /home/yakir/.julia/packages/MATLAB/TMHAJ/deps/build.jl:76

@musm
Copy link
Collaborator Author

musm commented Feb 16, 2022

Could you unset the variables MATLAB_HOME MATLAB_ROOT before starting julia ?

@musm
Copy link
Collaborator Author

musm commented Feb 16, 2022

ENV["MATLAB_HOME"] = nothing actually sets the key to "nothing" ....

@musm
Copy link
Collaborator Author

musm commented Feb 16, 2022

delete!(ENV, "MATLAB_HOME")
delete!(ENV, "MATLAB_ROOT")

would be the correct commands within Julia, if the variables are already set.

@yakir12
Copy link

yakir12 commented Feb 16, 2022

I tried deleting (cool!) but it didn't work:

(@v1.7) pkg> activate --temp
  Activating new project at `/tmp/jl_zZpWtw`

julia> delete!(ENV, "MATLAB_HOME");

julia> delete!(ENV, "MATLAB_ROOT");

(jl_zZpWtw) pkg> add MATLAB#linxu
    Updating git-repo `https://github.com/JuliaInterop/MATLAB.jl.git`
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
    Updating `/tmp/jl_zZpWtw/Manifest.toml`
  [10e44e05] + MATLAB v0.8.2 `https://github.com/JuliaInterop/MATLAB.jl.git#linxu`
  [56f22d72] + Artifacts
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [e66e0078] + CompilerSupportLibraries_jll
  [4536629a] + OpenBLAS_jll
  [8e850b90] + libblastrampoline_jll
Precompiling project...
  ✗ MATLAB
  0 dependencies successfully precompiled in 1 seconds (3 already precompiled)
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

(jl_zZpWtw) pkg> build MATLAB
    Building MATLAB  `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/7566e213f88e2a8c23a9fb70d384e62bdddfd412/build.log`
ERROR: Error building `MATLAB`: 
[ Info: Detected MATLAB root folder at "/usr/local"
[ Info: Detected MATLAB executable at "/usr/local/bin/matlab"
ERROR: LoadError: could not load library "/usr/local/bin/glnxa64/libmx"
/usr/local/bin/glnxa64/libmx.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen (repeats 2 times)
   @ ./libdl.jl:117 [inlined]
 [2] dlpath(libname::String)
   @ Base.Libc.Libdl ./libdl.jl:240
 [3] top-level scope
   @ ~/.julia/packages/MATLAB/TMHAJ/deps/build.jl:79
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [5] top-level scope
   @ none:5
in expression starting at /home/yakir/.julia/packages/MATLAB/TMHAJ/deps/build.jl:76

@musm
Copy link
Collaborator Author

musm commented Feb 16, 2022

That's progress, I think the last commit probably fixed it.

It's using the location /usr/local/matlab since that's what Sys.which is spitting out, but that's not the root matlab location, since it's symlinked i.e. if you check

islink(Sys.which("matlab"))

that should be true

@musm
Copy link
Collaborator Author

musm commented Feb 17, 2022

any chance you could try again? I think I finally fixed it.

@yakir12
Copy link

yakir12 commented Feb 17, 2022

Sorry for the slow response: Yes! It all works now!!!

🥳

@musm
Copy link
Collaborator Author

musm commented Feb 17, 2022

Great thanks for your help in fixing this. It's certainly a lot harder without a matlab license to check these things...

@musm musm merged commit c732f7d into master Feb 17, 2022
@musm musm deleted the linxu branch February 18, 2022 15:24
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 this pull request may close these issues.

libmx error when building
2 participants