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

Compiling mex on Linux/Ubuntu - Could NOT find MPFR and other issues #118

Open
albertotono opened this issue Jul 18, 2021 · 8 comments
Open

Comments

@albertotono
Copy link

Dear Alec,

Thanks again for this great work.

I am trying to compile mex for Linux for the SGI workshop

Using matlab 2021a and (gptoolbox was installed via matlab-addon: /home/alberto/MATLAB Add-Ons/Collections/gptoolbox)

currently I tried both

cmake ..
cmake ../ -DMatlab_ROOT_DIR=/usr/local/MATLAB/R2021a
on the build folder

In attached the log and error files, it is outputting this folder structure with empty folders
Screenshot from 2021-07-18 13-27-42

It seems there is an issue with

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find MPFR (missing: MPFR_LIBRARIES MPFR_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  external/libigl/external/cgal/Installation/cmake/modules/FindMPFR.cmake:53 (find_package_handle_standard_args)
  external/libigl/external/cgal/Installation/cmake/modules/CGAL_SetupGMP.cmake:21 (find_package)
  external/libigl/external/cgal/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake:41 (include)
  external/libigl/external/cgal/Installation/lib/cmake/CGAL/CGALConfig.cmake:106 (include)
  external/libigl/external/cgal/CGALConfig.cmake:6 (include)
  external/libigl/cmake/libigl.cmake:233 (find_package)
  cmake/FindLIBIGL.cmake:35 (include)
  CMakeLists.txt:78 (find_package)

Maybe related with this one PyMesh/PyMesh#96

so I performed

  • sudo apt install libcgal-dev
  • sudo apt install libcgal-demo
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.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
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Success
-- Found Matlab: /usr/local/MATLAB/R2021a/extern/include (found version "9.10") found components: MEX_COMPILER MX_LIBRARY ENG_LIBRARY 
-- Found LIBIGL: /home/alberto/MATLAB Add-Ons/Collections/gptoolbox/mex/external/libigl/include  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Creating target: igl::core (igl)
BOOST_ROOT: 
-- Using header-only CGAL
-- Targetting Unix Makefiles
-- Using /usr/bin/c++ compiler.
-- Found GMP: /usr/lib/x86_64-linux-gnu/libgmp.so  
-- Found MPFR: /usr/lib/x86_64-linux-gnu/libmpfr.so  
-- __cplusplus is 201402
--   --> Do not link with Boost.Thread
-- Found Boost 1.70.0 at /home/alberto/anaconda3/lib/cmake/Boost-1.70.0
--   Requested configuration: QUIET REQUIRED
-- Found boost_headers 1.70.0 at /home/alberto/anaconda3/lib/cmake/boost_headers-1.70.0
-- Found Boost: /home/alberto/anaconda3/lib/cmake/Boost-1.70.0/BoostConfig.cmake (found suitable version "1.70.0", minimum required is "1.48")  
-- Boost include dirs: /home/alberto/anaconda3/include
-- Boost libraries:    
-- Found Boost 1.70.0 at /home/alberto/anaconda3/lib/cmake/Boost-1.70.0
--   Requested configuration: QUIET REQUIRED COMPONENTS thread;system
-- Found boost_thread 1.70.0 at /home/alberto/anaconda3/lib/cmake/boost_thread-1.70.0
-- No suitable boost_thread variant has been identified!
--   libboost_thread.so.1.70.0 (shared, BUILD_SHARED_LIBS not ON, set Boost_USE_STATIC_LIBS=OFF to override)
--   libboost_thread.a (static, Boost_USE_STATIC_LIBS=OFF)
CMake Error at /home/alberto/anaconda3/lib/cmake/Boost-1.70.0/BoostConfig.cmake:95 (find_package):
  Found package configuration file:

    /home/alberto/anaconda3/lib/cmake/boost_thread-1.70.0/boost_thread-config.cmake

  but it set boost_thread_FOUND to FALSE so package "boost_thread" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

Call Stack (most recent call first):
  /home/alberto/anaconda3/lib/cmake/Boost-1.70.0/BoostConfig.cmake:124 (boost_find_dependency)
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
  external/libigl/external/cgal/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake:59 (find_package)
  external/libigl/external/cgal/Installation/lib/cmake/CGAL/CGALConfig.cmake:106 (include)
  external/libigl/external/cgal/CGALConfig.cmake:6 (include)
  external/libigl/cmake/libigl.cmake:233 (find_package)
  cmake/FindLIBIGL.cmake:35 (include)
  CMakeLists.txt:78 (find_package)

I have installed boost and set the path
export BOOST_ROOT=/home/alberto/Documents/boost/boost_1_76_0

Should I install manually all the other libraries or this is supposed to support all of them (stl, Eigen libigl, CGAL, Embree,El Topo.) already?

CMakeError.log
CMakeOutput.log

Any help would be much appreciated.

@alecjacobson
Copy link
Owner

alecjacobson commented Jul 18, 2021 via email

@albertotono
Copy link
Author

albertotono commented Jul 18, 2021

Thank you so much for the quick reply.
yes, I used the
sudo apt-get install libmpfr-dev
and sudo apt-get install libgmp-dev
before.

Do you know someone who have already compiled mex on Linux successfully?

@alecjacobson
Copy link
Owner

alecjacobson commented Jul 18, 2021 via email

@alecjacobson
Copy link
Owner

alecjacobson commented Jul 18, 2021 via email

@alecjacobson
Copy link
Owner

alecjacobson commented Jul 18, 2021 via email

@albertotono
Copy link
Author

albertotono commented Jul 18, 2021

Thank you so much.

Yes, now I don't have that error about MPFR anymore

I had also a conflict with different boost version before ( one in anaconda and another one 1.70 and 1.76) . I was able to solve that (mayybe)

Now the build folder looks like this

Screenshot from 2021-07-18 14-22-58

and the external
Screenshot from 2021-07-18 14-23-21

Not sure what is the specific error that I am getting.
CMakeError.log
CMakeOutput.log

as far as I am reading the pthread shouldn't be an issue

Would you be able to share your notes with us about the linux installation?

We are doing our best to make sure students will be able to install it as well https://github.com/odedstein/sgi-introduction-course/blob/main/205_mex/compilation_instructions.md.

Any help would be much appreciated.

@albertotono
Copy link
Author

albertotono commented Jul 18, 2021

It seems it was missing also this

sudo apt-get install liblapack-dev

Using cmake-gui
It seems working now

Screenshot from 2021-07-18 14-38-36

also on make
Screenshot from 2021-07-18 14-39-28

albertotono referenced this issue in odedstein/sgi-introduction-course Jul 18, 2021
@alecjacobson
Copy link
Owner

ooffff. Glad you made it through. If you have a suggestion of how to give better instructions for linux uses, please share.

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