0
[Ubuntu]

I have compiled CGAL locally:

/path/to/cgal/
    /lib/
        libCGAL_Core.so     libCGAL_Core.so.13.0.2  
        libCGAL_ImageIO.so.13      libCGAL.so     libCGAL.so.13.0.2
        libCGAL_Core.so.13  libCGAL_ImageIO.so      
        libCGAL_ImageIO.so.13.0.2  libCGAL.so.13
    /include/
        /CGAL/
            version.h compiler_config.h

And I have managed to satisfy all of the graph-tool requirements except cgal (at least all of the requirements checked up to cgal):

./configure --with-boost=/path/to/boost --with-cgal=/path/to/cgal

And I get all successes up and until I get the following error message:

checking for __gmpz_init in -lgmp... yes
checking for __gmpz_init in -lgmp... (cached) yes
checking whether CGAL is available in /path/to/cgal... no
configure: error: CGAL library not found.

// the harshest part is that it seems to be searching in the correct
// directory.  

I have tried specifying different points in the cgal build directory. The cgal compilation command I used was (from build directory):

cmake path/to/cgal_src_dir -DCMAKE_BUILD_TYPE=Release;

Next, I tried adding includes:

./configure --with-boost=$boost --with-cgal=path/to/cgal CPPFLAGS="-I path/to/cgal/include -I $HOME/.local/include" LDFLAGS="-L path/to/cgal/lib -L $HOME/.local/lib -Wl,-rpath=$HOME/.local/lib"

I will admit that I don't understand the -Wl,-rpath= part, I copied that from the graph-tool installation guide. The .local/lib folder contains the files for the other components, such as gmp, expat, sparsehash, etc.

Chris
  • 28,822
  • 27
  • 83
  • 158
  • `libcgal-dev` is installed? – Avezan Jun 11 '18 at 23:40
  • @Avezan no, I am trying to set up an install that doesn't need sudo – Chris Jun 11 '18 at 23:42
  • 1
    are you setting path `-with-cgal=/wherever/you/have/compiled`, you will have to set `include` as well I think, see if an option exists. `./configure --help` – Avezan Jun 11 '18 at 23:45
  • @Avezan updated with what I have done with the includes (currently, this does not work either) – Chris Jun 11 '18 at 23:51
  • Are you on ubuntu? – Avezan Jun 11 '18 at 23:53
  • @Avezan yeah...is this something that happens on ubuntu? – Chris Jun 11 '18 at 23:54
  • 1
    The best bet on ubuntu is to add a deb configuration in cmake(I always do, its easy), and let the deb install in `~/.local`. After it you can easily point `-with-cgal` and compilation completes. In case you need to know how to do it I can post a configuration in answer but that won't be an answer. – Avezan Jun 11 '18 at 23:58
  • @Avezan I can change scope of question if you do that, because, ultimately, that is the answer to the bigger question (getting this thing to work :) – Chris Jun 11 '18 at 23:59
  • 1
    Ok posting..... – Avezan Jun 12 '18 at 00:01
  • Awesome, man--thank you!! – Chris Jun 12 '18 at 00:06

1 Answers1

1

This is not exact answer but as asked by OP will help in finishing installation, so please don't vote blindly.

To create debian package of libcgal open your CMakeList.txt and at the end of file add:

#--------------------------------------------------------------------
# Create debian files
#--------------------------------------------------------------------
if (UNIX AND NOT APPLE)
    SET(CPACK_GENERATOR "DEB")
    SET(CPACK_PACKAGE_NAME  "libcgal-all")
    SET(CPACK_PACKAGE_VERSION  "${CGAL_VERSION}")
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY  "C++ library for computational geometry (development files)\n CGAL (Computational Geometry Algorithms Library) makes the most important of the solutions and methods developed in computational geometry available to users in industry and academia in a C++ library. The goal is to provide easy access to useful, reliable geometric algorithms.\n .\n This package contains the header files and static libraries for libCGAL.so, libCGAL_Core.so, and libCGAL_ImageIO.so. The  header files and static libraries for libCGAL_Qt4.so can be found in the package libcgal-qt4-dev.")
    SET(CPACK_PACKAGE_CONTACT "bordeo")
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS  "libboost-dev, libboost-thread-dev, libboost-system-dev, libboost-program-options-dev, libgmp10-dev, libmpfr-dev, zlib1g-dev")
    SET(CPACK_DEBIAN_PACKAGE_REPLACES "libcgal10, libcgal-dev")
    INCLUDE(CPack)
endif()

In case you don't have any dependency remove whole line of SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libcln6, libcln-dev, libreadline6, libreadline6-dev, flex, bison"), and change others as it seems fit.

Now go to the terminal and issue following commands in cgal directory

mkdir build
cd build
cmake-gui ..
# set CMAKE_INSTALL_PREFIX to `~/.local
cmake ..
make -j4
cpack ..

you will find your debian built. Extract or install the debian to ~/.local.

Once this is done go to graph tool directory and start the build like

./configure --prefix="/wherever"  --with-boost=/path/to/boost --with-cgal=~/.local
make -j4
make install

Hope this will solve your problem.

Avezan
  • 673
  • 4
  • 9
  • Avezan, this is amazing! Thank you. It will probably be till tomorrow before I can confirm, but I'll go ahead and accept until I have a chance to try it out. Maybe I'll have a chance to discover what the issue is when I can compare the results – Chris Jun 12 '18 at 00:22
  • Great let me know tomorrow ... :) – Avezan Jun 12 '18 at 00:23
  • strangely, it did not work until I sudo-installed cgal. Then, it worked when I referenced either the library, or the package – Chris Jun 12 '18 at 15:04
  • 1
    You mean into your system directories `/usr/(/local)bin`. For deb, sudo is required and to avoid sudo you can extract and copy. Either way it wont pollute system directories. This usually works for all kind of libraries except where there is conflict `alternatives` or extra ld configuration is required. – Avezan Jun 12 '18 at 17:33