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

Could NOT find Matlab #131

Open
reynoo opened this issue Mar 9, 2022 · 8 comments
Open

Could NOT find Matlab #131

reynoo opened this issue Mar 9, 2022 · 8 comments

Comments

@reynoo
Copy link

reynoo commented Mar 9, 2022

Hi,
I am working on a Matlab.m file that my colleague has been working on that. In some part of the code he is using gptoolbox and clean_mesh function. When I run the code I have an error with clean_mesh function. I read that "This directory contains mex functions that must be compiled before they can be called from matlab". I use the following command lines:
mkdir build
cd build
cmake ..
make

But for cmake .. I have this error:

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Matlab (missing: Matlab_INCLUDE_DIRS Matlab_MEX_LIBRARY
Matlab_MEX_EXTENSION MEX_COMPILER MX_LIBRARY ENG_LIBRARY) (found version
"NOTFOUND")
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
cmake/FindMatlab.cmake:1520 (find_package_handle_standard_args)
CMakeLists.txt:74 (find_package)

-- Configuring incomplete, errors occurred!
See also "/mnt/c/dev/gptoolbox/mex/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/c/dev/gptoolbox/mex/build/CMakeFiles/CMakeError.log".

I also tried the following command but still, the error is there:

cmake ../ -DMatlab_ROOT_DIR=/apps/matlab-R2019b/

Could you advise?

@reynoo
Copy link
Author

reynoo commented Mar 9, 2022

I am using:
Windows 10
Matlab 2020b Update 7
cmake 3.16.3

@MCZSynapsid
Copy link

I also get the same errors if I alternatively call "cmake ../ -DMATLAB_FIND_DEBUG=ON"

In my case, CMake is able to find my MATLAB installation by itself, but still throws the same errors regarding missing libraries (screenshot below).
Error

Do I need to have particular MATLAB toolboxes/add-ons installed? I am using MATLAB version 9.11/2021b with CMake 3.12.2 and VisualStudio 2017 Community, on a Windows 11 system.

Thanks for any help.

@alecjacobson
Copy link
Owner

From a colleague using Windows:

Haven't used VS2017 in forever, but my guess would be that it's looking for the 32-bit binaries. They'd need to specify the x64 generator. CMake uses x64 as default for VS2019 onwards only. I think the CMake parameter is -A x64

@MCZSynapsid
Copy link

Aha - that seems to solve this particular error, thanks!

But I now get a new error elsewhere, apparently something to do with libigl:
NewError

Any ideas what's causing this issue?

@otmanon
Copy link
Contributor

otmanon commented Mar 24, 2022

Which version of CMake are you running ? According to this
https://cmake.org/cmake/help/git-stage/module/FetchContent.html

That command was introduced in 3.11. Is it possible yours isn't up to date?

@MCZSynapsid
Copy link

I'm using CMake 3.12.2 - not the most up-to-date, but theoretically that should be fine if the command was introduced in 3.11. Anyway, I just updated to 3.22.3 and that error is avoided now (thanks!)....but a new one (again involving libigl) crops up:
Error

Any thoughts? I am very much out of my depth here.

@alecjacobson
Copy link
Owner

One of the issues with using an old cmake is that cmake comes with some config files that know how to locate modern versions of matlab. So an old cmake may only know how to find old matlab.

@alecjacobson
Copy link
Owner

alecjacobson commented Oct 11, 2022 via email

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

4 participants