alecjacobson / gptoolbox

Matlab toolbox for Geometry Processing.
MIT License
629 stars 169 forks source link

Could NOT find Matlab #131

Open reynoo opened 2 years ago

reynoo commented 2 years ago

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 commented 2 years ago

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

MCZSynapsid commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

I believe this means you need a newer version of cmake

On Thu, Mar 24, 2022, 9:22 AM MCZSynapsid @.***> wrote:

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

But I now get a new error elsewhere, apparently something to do with libigl: [image: NewError] https://user-images.githubusercontent.com/102299995/159925111-9367bb77-4054-4b4d-b491-b693c971314b.png

Any ideas what's causing this issue?

— Reply to this email directly, view it on GitHub https://github.com/alecjacobson/gptoolbox/issues/131#issuecomment-1077622170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARDJGONUKWD4XMXPXKSKOTVBRUABANCNFSM5QKFAXXQ . You are receiving this because you commented.Message ID: @.***>

Cp675516471 commented 1 week ago

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

I used the command but another problem shows up(windows 11, matlab 2022a ,cmake3.31.0) 997010d8196ee591580b9e73cc75c2e ba897af03972750e62152983d9c0bf3

here also some additional information

cb964a1adb8e4c240a6b91dfb638c03