[Dune] Problem linking boost with cmake

Aleksejs Fomins aleksejs.fomins at lspr.ch
Mon Dec 1 10:04:30 CET 2014


Dear Dune,

I am sorry to post on a very similar issue that was already largely
discussed, but I can't make it work by using the previous suggestions.

I have:
* Specified boost libraries in the opts file
* written find_package(Boost 1.55.0 COMPONENTS system) in the cmake
macros file
* written target_link_libraries(curvilineargmshtest ${Boost_LIBRARIES})
in the CMakeLists.txt file.

The boost library is found by dunecontrol, but no flags are passed to
the compilation of the target.

I appreciate your suggestions,

Regards,
Aleksejs
-------------- next part --------------
#################################################################################################################
## objective - opts file for building vulcain, based on Dune, with cmake
##
## history - 2014 apr 16, created
##
## usage - time ./dune-common/bin/dunecontrol --use-cmake --opts=af.debian7.lsprag.cmakebuild.minimalistic.opts all
##
##################################################################################################################


USE_CMAKE=yes

CONFIGURE_FLAGS="--enable-parallel --enable-experimental-grid-extensions CC=mpicc CXX=mpicxx" 

CMAKE_PREFIX_PATH="\
/opt/extlib/boost/1.55.0/gcc/4.9.0;\
/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0;\
/opt/extlib/metis/5.1.0/gcc/4.9.0;\
"

GXX_WARNING_OPTS="-Wall -pedantic" 
GXX_OPTS="-O0 -g2" 

CMAKE_FLAGS="\
CXXFLAGS=\"$GXX_WARNING_OPTS $GXX_OPTS\" \
-DPARMETIS_ROOT="/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0" \
-DCMAKE_LIBRARY_PATH:RELEASE=\"/opt/extlib/boost/1.55.0/gcc/4.9.0/lib\" \
-DCMAKE_LIBRARY_PATH:DEBUG=\"/opt/extlib/boost/1.55.0/gcc/4.9.0/lib\" \
-DCMAKE_STANDARD_LIBRARIES:RELEASE=\"-lboost_system\" \
-DCMAKE_STANDARD_LIBRARIES:DEBUG=\"-lboost_system\" \
-DCMAKE_PREFIX_PATH=\"$CMAKE_PREFIX_PATH\" \
-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE \
" 



# -DCXXFLAGS=\"-O2 -Wall\" \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DuneCurvilineargridMacros.cmake
Type: text/x-cmake
Size: 134 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141201/16db4164/attachment.bin>
-------------- next part --------------
# Define variable with path to the grids to be used in the code
add_definitions("-DDUNE_CURVILINEARGRID_EXAMPLE_GRIDS_PATH=\"${PROJECT_SOURCE_DIR}/doc/grids/\"")

# Define tests to be run
set(TESTS
  curvilineargmshtest)

add_executable(curvilineargmshtest curvilineargmshtest.cc)
target_link_libraries(curvilineargmshtest dunecommon dunegeometry dunegrid)  # dunecurvilineargeometry


# We do not want want to build the tests during make all,
# but just build them on demand
add_directory_test_target(_test_target)
add_dependencies(${_test_target} ${TESTS})

foreach(_test ${TESTS})
  add_test(${_test} ${_test})
endforeach(_test ${TESTS})


# Add parmetis
if(HAVE_MPI)
    add_dune_parmetis_flags(curvilineargmshtest)
endif(HAVE_MPI)

# Add boost
target_link_libraries(curvilineargmshtest ${Boost_LIBRARIES})
-------------- next part --------------
----- using default flags $CONFIGURE_FLAGS from /home/fomins/gitwork/hades-github-lspr-ag/af.debian7.lsprag.cmakebuild.minimalistic.opts -----
--- going to build dune-curvilineargrid  ---
--- calling all for dune-curvilineargrid ---
--- calling vcsetup for dune-curvilineargrid ---
--- calling autogen for dune-curvilineargrid ---
Skipping dune-autogen because of CMake
--- calling configure for dune-curvilineargrid ---
----- using default flags $CONFIGURE_FLAGS from /home/fomins/gitwork/hades-github-lspr-ag/af.debian7.lsprag.cmakebuild.minimalistic.opts -----
/home/fomins/gitwork/hades-github-lspr-ag/dune-geometry/lib/dunegeometryam2cmake.lib for converting options does not exist
/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargeometry/lib/dunecurvilineargeometryam2cmake.lib for converting options does not exist
/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/lib/dunecurvilineargridam2cmake.lib for converting options does not exist
 CXX=mpicxx CC=mpicc cmake -DCMAKE_MODULE_PATH=""  -DUSE_MPI=ON "-Ddune-common_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-common/build-cmake" "-Ddune-geometry_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-geometry/build-cmake" "-Ddune-curvilineargeometry_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargeometry/build-cmake" -DENABLE_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE "-Ddune-grid_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-grid/build-cmake" CXXFLAGS="-Wall -pedantic -O0 -g2" -DPARMETIS_ROOT=/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0 -DCMAKE_LIBRARY_PATH:RELEASE="/opt/extlib/boost/1.55.0/gcc/4.9.0/lib" -DCMAKE_LIBRARY_PATH:DEBUG="/opt/extlib/boost/1.55.0/gcc/4.9.0/lib" -DCMAKE_STANDARD_LIBRARIES:RELEASE="-lboost_system" -DCMAKE_STANDARD_LIBRARIES:DEBUG="-lboost_system" -DCMAKE_PREFIX_PATH="/opt/extlib/boost/1.55.0/gcc/4.9.0;/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0;/opt/extlib/metis/5.1.0/gcc/4.9.0;" -DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE "/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid"
-- Dependencies for dune-curvilineargrid: dune-common;dune-geometry;dune-curvilineargeometry;dune-grid
-- Dependencies for dune-geometry: dune-common (>= 2.4)
-- Dependencies for dune-curvilineargeometry: dune-common;dune-geometry
-- Dependencies for dune-grid: dune-common (>= 2.4);dune-geometry (>= 2.4)
-- Dependencies for dune-geometry: dune-common (>= 2.4)
-- Dependencies for dune-geometry: dune-common (>= 2.4)
-- I could not find the latex2html command.
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Performing tests specific to dune-common from file /home/fomins/gitwork/hades-github-lspr-ag/dune-common/cmake/modules/DuneCommonMacros.cmake.
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Could NOT find GMP (missing:  GMP_INCLUDE_DIR GMP_LIB GMPXX_LIB GMP_HEADER_WORKS GMPXX_LIB_WORKS) 
-- Setting dune-common_INCLUDE_DIRS=/home/fomins/gitwork/hades-github-lspr-ag/dune-common
-- Setting dune-common_LIBRARIES=dunecommon
-- Setting dune-geometry_INCLUDE_DIRS=/home/fomins/gitwork/hades-github-lspr-ag/dune-geometry
-- Setting dune-geometry_LIBRARIES=dunegeometry
-- Performing tests specific to dune-grid from file /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/cmake/modules/DuneGridMacros.cmake.
-- checking for module 'alugrid'
--   package 'alugrid' not found
-- checking for module 'alugrid'
--   package 'alugrid' not found
-- Could NOT find ALUGrid (missing:  ALUGRID_VERSION ALUGRID_INCLUDE_PATH ALUGRID_LIB ALUGRID_LIB_PATH ALULIB_FUNCTIONAL HAVE_ALUGRID_SERIAL_H) 
CMake Warning at /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/cmake/modules/UseUG.cmake:27 (find_package):
  Could not find a package configuration file provided by "UG" (requested
  version 3.11.0) with any of the following names:

    UGConfig.cmake
    ug-config.cmake

  Add the installation prefix of "UG" to CMAKE_PREFIX_PATH or set "UG_DIR" to
  a directory containing one of the above files.  If "UG" provides a separate
  development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  /home/fomins/gitwork/hades-github-lspr-ag/dune-grid/cmake/modules/DuneGridMacros.cmake:11 (include)
  /home/fomins/gitwork/hades-github-lspr-ag/dune-common/cmake/modules/DuneMacros.cmake:505 (include)
  /home/fomins/gitwork/hades-github-lspr-ag/dune-common/cmake/modules/DuneMacros.cmake:634 (dune_process_dependency_macros)
  CMakeLists.txt:24 (dune_project)


-- Could NOT find UG (missing:  UG_DIR HAVE_UG) 
-- Could NOT find Grape (missing:  GRAPE_INCLUDE_DIR GRAPE_LIBRARY _GRAPE_LIB_FUNCTIONAL _GRAPE_HEADER_USABLE) 
-- checking for one of the modules 'psurface'
-- checking for module 'psurface'
--   package 'psurface' not found
-- Could NOT find psurface (missing:  PSURFACE_INCLUDE_DIR PSURFACE_LIBRARY) 
-- Could NOT find AmiraMesh (missing:  AMIRAMESH_INCLUDE_DIR AMIRAMESH_LIBRARY) 
-- Setting dune-grid_INCLUDE_DIRS=/home/fomins/gitwork/hades-github-lspr-ag/dune-grid
-- Setting dune-grid_LIBRARIES=dunegrid
-- Performing tests specific to dune-curvilineargeometry from file /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargeometry/cmake/modules/DuneCurvilineargeometryMacros.cmake.
-- Setting dune-curvilineargeometry_INCLUDE_DIRS=/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargeometry
-- Performing tests specific to dune-curvilineargrid from file /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/cmake/modules/DuneCurvilineargridMacros.cmake.
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
-- Using scripts from /home/fomins/gitwork/hades-github-lspr-ag/dune-common/cmake/scripts for creating doxygen stuff.
-- Adding custom target for config.h generation
-- 
-- The following features have been enabled:

 * Experimental grid extensions , Enables additional grid features.

-- The following OPTIONAL packages have been found:

 * MPI
 * PkgConfig
 * BLAS
 * Threads
 * LAPACK
 * Inkscape
 * X11
 * OpenGL
 * ParMETIS
 * Boost (required version >= 1.55.0)

-- The following REQUIRED packages have been found:

 * dune-common
 * dune-geometry
 * dune-curvilineargeometry
 * dune-grid

-- The following OPTIONAL packages have not been found:

 * LATEX
 * UnixCommands
 * Doxygen
 * GMP
 * ALUGrid
 * Alberta
 * UG (required version >= 3.11.0)
 * Grape
 * Psurface
 * AmiraMesh

-- Configuring done
-- Generating done
-- Build files have been written to: /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/build-cmake
--- calling make for dune-curvilineargrid ---
build directory: build-cmake
make 
[ 50%] Built target dune_curvilineargrid
[100%] Building CXX object dune/curvilineargrid/io/file/test/CMakeFiles/curvilineargmshtest.dir/curvilineargmshtest.cc.o
In file included from /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/io/file/curvilineargmshreader.hh:44:0,
                 from /home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/io/file/test/curvilineargmshtest.cc:43:
/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/dune/curvilineargrid/feedback/loggingmessage.hh:16:53: fatal error: boost/date_time/posix_time/posix_time.hpp: No such file or directory
 #include <boost/date_time/posix_time/posix_time.hpp>
                                                     ^
compilation terminated.
make[2]: *** [dune/curvilineargrid/io/file/test/CMakeFiles/curvilineargmshtest.dir/curvilineargmshtest.cc.o] Error 1
make[1]: *** [dune/curvilineargrid/io/file/test/CMakeFiles/curvilineargmshtest.dir/all] Error 2
make: *** [all] Error 2
--- Failed to build dune-curvilineargrid ---
Terminating dunecontrol due to previous errors!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141201/16db4164/attachment.sig>


More information about the Dune mailing list