alecjacobson / gptoolbox

Matlab toolbox for Geometry Processing.
MIT License
628 stars 166 forks source link

Mex compiling snag in Ubuntu and Windows #93

Closed geocosmite closed 4 years ago

geocosmite commented 4 years ago

I am hoping to use the mesh_boolean operation, which as you know is dependent on mex. When I follow the instructions in the README.md file that is within the gptoolbox/mex folder I run into problems in both Ubuntu 18.04 and Windows10 that seem to be associated with the MATLAB version. On both of the associated machines, I have multiple Matlab versions installed, all of which, with one exception on Windows (R2020a), are present in the MATLAB_VERSIONS_MAPPING listing within the FindMATLAB.cmake file.

In Ubuntu 18.04 I have R2019b, R2017b, and R2010b installed. After entering make (line 17 in README.md) I get this error:

rob@xenolith:~/dev/gptoolbox/mex/build$ cmake .. -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /home/rob/dev/cmake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Matlab (missing: Matlab_INCLUDE_DIRS Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION Matlab_ROOT_DIR Matlab_MX_LIBRARY MEX_COMPILER MX_LIBRARY ENG_LIBRARY) (found version "NOTFOUND") Call Stack (most recent call first): /home/rob/dev/cmake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) /home/rob/dev/cmake/share/cmake-3.16/Modules/FindMatlab.cmake:1802 (find_package_handle_standard_args) CMakeLists.txt:62 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/rob/dev/gptoolbox/mex/build/CMakeFiles/CMakeOutput.log".

On Windows10, where I have R2019a, R2019b, and R2020a installed, when I use CMake9cmake-gui I get the error below. This error is unaffected by adding "R2020a=9.8" to the MATLAB-VERSIONS_MAPPING list.

image

Thank you in advance for any help that you can provide and my apologies if the problem here is me being clueless. Many thanks as well for sharing this splendid geometric toolkit with people like me.

maisevector commented 4 years ago

It seems that you need to set the Matlab_ROOT_DIR. Not sure if this is generally recommended to modify the CMakeLists.txt file, but to set the path you can just add: set(Matlab_ROOT_DIR /usr/local/MATLAB/R2019b) As an alternative (and probably better) I think you can also pass it while calling cmake. Hope this helps.

alecjacobson commented 4 years ago

The mex/README.md now contains notes about this.