compilation issues when gmpfr is installed to a non-standard directory

Issue #16 closed
Thomas Hisch created an issue

I tried to compile mshr on a cluster, where I had to install gmpfr into my home directory. In order to fix the find MPFR (missing: MPFR_LIBRARIES MPFR_INCLUDE_DIR) cmake error I had to specify the MPFR_INCLUDE_DIR and MPFR_LIBRARIES cmake flags.

cmake -DMPFR_INCLUDE_DIR=$HOME/software/local/include -DMPFR_LIBRARIES=$HOME/software/local/lib/libmpfr.so -DCMAKE_INSTALL_PREFIX=$HOME/miniconda3/envs/py27 ..

The MPFR vars are not used for building the external project CGAL. Therefore I get this error

[100%] Building CXX object src/CGAL/CMakeFiles/CGAL.dir/all_files.cpp.o
In file included from ~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/include/CGAL/Gmp_coercion_traits.h:30:0,
                 from ~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/include/CGAL/Gmpz.h:33,
                 from ~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/include/CGAL/Gmpq.h:25,
                 from ~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/include/CGAL/Kinetic/basic.h:53,
                 from ~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/include/CGAL/Kinetic/internal/debug_counters.h:21,
                 from ~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/src/CGAL/KDS_Log.cpp:28,
                 from ~/gitrepos/fenics/dev/mshr/build_test/3rdparty/CGAL-4.5-prefix/src/CGAL-4.5-build/src/CGAL/all_files.cpp:3:
~/gitrepos/fenics/dev/mshr/3rdparty/CGAL-4.5/include/CGAL/GMP/Gmpz_type.h:31:18: fatal error: mpfr.h: No such file or directory
 #include <mpfr.h>

I was able to fix this issue by editing 3rdparty/CMakeLists.txt but I still got other errors related to my mpfr installation.

Comments (14)

  1. Thomas Hisch reporter
    [ 46%] Building CXX object CMakeFiles/mshr.dir/src/CSGCGALDomain3D.cpp.o
    In file included from ~/gitrepos/fenics/dev/mshr/build_test/CGAL-4.5-installdir/include/CGAL/internal/Exact_type_selector.h:39:0,
                     from ~/gitrepos/fenics/dev/mshr/build_test/CGAL-4.5-installdir/include/CGAL/Filtered_kernel.h:35,
                     from ~/gitrepos/fenics/dev/mshr/build_test/CGAL-4.5-installdir/include/CGAL/Exact_predicates_exact_constructions_kernel.h:29,
                     from ~/gitrepos/fenics/dev/mshr/src/CSGCGALDomain3D.cpp:35:
    ~/gitrepos/fenics/dev/mshr/build_test/CGAL-4.5-installdir/include/CGAL/Mpzf.h: In function ‘CGAL::Mpzf CGAL::Mpzf_square(const CGAL::Mpzf&)’:
    ~/gitrepos/fenics/dev/mshr/build_test/CGAL-4.5-installdir/include/CGAL/Mpzf.h:718:38: error: ‘mpn_sqr’ was not declared in this scope
         mpn_sqr(res.data(),a.data(),asize);
    
  2. Thomas Hisch reporter

    thx. now i get

    -- Preconfiguring library: GMP ...
    -- GMP has been preconfigured:
    --   UseGMP-file:      
    --   GMP include:      /usr/include
    --   GMP libraries:    /usr/lib64/libgmp.so
    --   GMP definitions:  
    -- USING GMP_VERSION = '4.3.1'
    -- Preconfiguring library: MPFR ...
    -- Could NOT find MPFR (missing:  MPFR_INCLUDE_DIR)
    
  3. Benjamin Dam Kehlet

    Ah, typo! Could you pull and try again now?

    (Sorry about the late reply on this issue, btw)

  4. Thomas Hisch reporter

    No problem. It was not that urgent.

    Installing the 3rd party libs is fixed now - thx. However, I still get the mpn_sqr error.

    [ 63%] Building CXX object CMakeFiles/mshr.dir/src/CSGPrimitives2D.cpp.o
    In file included from ~/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/internal/Exact_type_selector.h:39:0,
                     from ~/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Filtered_kernel.h:35,
                     from ~/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Exact_predicates_exact_constructions_kernel.h:29,
                     from ~/mshr/src/CSGCGALDomain3D.cpp:35:
    ~/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h: In function CGAL::Mpzf CGAL::Mpzf_square(const CGAL::Mpzf&):
    ~/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:718:38: error: mpn_sqr was not declared in this scope
         mpn_sqr(res.data(),a.data(),asize);
    
  5. Benjamin Dam Kehlet

    Strange... I'll try to reproduce this tomorrow. What compiler (and version) are you using?

  6. Benjamin Dam Kehlet

    Bitbucket was a little too smart, so it marked the issue as resolved based on the commit message.

    I applied the fix suggested here: cgal-discuss.949826.n4.nabble.com/Error-on-installing-CGAL-on-LINUX-CentOS-td4659148.html Let me know if this works for you. If not, we'll reopen the issue.

  7. Thomas Hisch reporter

    The not declared in this scope error was fixed by your recent commit(s). Thx!

    I still get some other errors:

    [ 46%] Building CXX object CMakeFiles/mshr.dir/src/CSGCGALDomain3D.cpp.o
    In file included from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/internal/Exact_type_selector.h:39:0,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Filtered_kernel.h:35,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Exact_predicates_exact_constructions_kernel.h:29,
                     from ~/gitrepos/fenics/dev/mshr/src/CSGCGALDomain3D.cpp:35:
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h: In function ?CGAL::Mpzf CGAL::Mpzf_square(const CGAL::Mpzf&)?:
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:726:31: error: invalid conversion from ?const mp_limb_t* {aka const long unsigned int*}? to ?mp_size_t {aka long int}? [-fpermissive]
         mpn_sqr(res.data(),a.data(),asize);
                                   ^
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:62:42: note: in definition of macro ?mpn_sqr?
     #define mpn_sqr(dest,a,n) mpn_mul(dest,a,a,n)
                                              ^
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:62:45: error: invalid conversion from ?int? to ?mp_srcptr {aka const long unsigned int*}? [-fpermissive]
     #define mpn_sqr(dest,a,n) mpn_mul(dest,a,a,n)
                                                 ^
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:726:5: note: in expansion of macro ?mpn_sqr?
         mpn_sqr(res.data(),a.data(),asize);
         ^
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:62:45: error: too few arguments to function ?mp_limb_t __gmpn_mul(mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)?
     #define mpn_sqr(dest,a,n) mpn_mul(dest,a,a,n)
                                                 ^
    ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Mpzf.h:726:5: note: in expansion of macro ?mpn_sqr?
         mpn_sqr(res.data(),a.data(),asize);
         ^
    In file included from /usr/include/gmp.h:53:0,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/gmp.h:30,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/GMP/Gmpz_type.h:30,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Gmp_coercion_traits.h:30,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Gmpz.h:33,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/internal/Exact_type_selector.h:36,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Filtered_kernel.h:35,
                     from ~/gitrepos/fenics/dev/mshr/build_openmpi_py27/CGAL-4.5-installdir/include/CGAL/Exact_predicates_exact_constructions_kernel.h:29,
                     from ~/gitrepos/fenics/dev/mshr/src/CSGCGALDomain3D.cpp:35:
    /usr/include/gmp-x86_64.h:1545:26: note: declared here
     __GMP_DECLSPEC mp_limb_t mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
                              ^
    make[2]: *** [CMakeFiles/mshr.dir/src/CSGCGALDomain3D.cpp.o] Error 1
    
  8. Benjamin Dam Kehlet

    I was too quick. There are several versions of the mpn_mul function in gmp. Please try again now.

  9. Log in to comment