cgal icon indicating copy to clipboard operation
cgal copied to clipboard

problem with self-compiled mpfr static library

Open lacrymose opened this issue 2 years ago • 5 comments

Please use the following template to help us solving your issue.

Issue Details

I am trying to work with the example Surface Reconstruction from Point Clouds presented in the tutorial of cgal mannual. Instead of using the precompiled gmp and mpfr libraries provided by cgal team, I compile static libraries from the source codes. The example code can be successfully compiled. However, an error occurs when running. It says GNU MP: Cannot allocate memory (size=4571650753201366944). FYI. The example code can be successfully executed when using the precompiled mpfr library.

Source Code

example code: https://doc.cgal.org/latest/Manual/tuto_reconstruction.html#TutorialsReconstruction_recap gmp: https://github.com/ShiftMediaProject/gmp mpfr: https://github.com/BrianGladman/mpfr

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): windows 7, 64 bits
  • Compiler: vc2017
  • Release or debug mode: debug and release
  • Specific flags used (if any):
  • CGAL version: 5.4.1
  • Boost version: 1.79.0
  • Other libraries versions if used (Eigen, TBB, etc.):

lacrymose avatar Jul 19 '22 08:07 lacrymose

I do not see how the CGAL project can help you debug that issue. That is probably a binary incompatibility issue, due to something in the way you compiled GMP and MPFR. You did not say if you have tried to use the GMP and MPFR binaries provided by the CGAL project.

lrineau avatar Jul 19 '22 13:07 lrineau

Thanks for your reply! I have tried the GMP and MPFR dlls provided by the CGAL project. It works. But I want to use GMP and MPFRs' static libraries. Hence I made attempts to complie the GMP and MPFR source codes from scratch. Then the erros comes out. I have been troubled by this issue for weeks. Could you help me with this or provide the static libraries?

lacrymose avatar Jul 19 '22 13:07 lacrymose

You need to make sure that the header files included are the one from the libraries you compiled yourself. Otherwise you will get the binary incompatibility Laurent's talking about.

sloriot avatar Jul 19 '22 13:07 sloriot

As an alternative to compiling GMP and MPFR yourself, I suggest you use https://github.com/microsoft/vcpkg, using the triplet x64-windows-static, to install MPFR and GMP.

lrineau avatar Jul 19 '22 15:07 lrineau

@sloriot I double-checked the header files. They are the ones from the libraries I compiled. Strangely, if I complie dynamic library, the example code can be successfully executed. I donot know what is wrong here. @lrineau I made attempts, but failed. yasm is needed when compiling MPFR and it seems yasm cannot be installed through vcpkg on windows 7. I donot know what to do now.

lacrymose avatar Jul 20 '22 15:07 lacrymose