[Dune] dunecontrol crash

Jö Fahlke jorrit at jorrit.de
Tue May 12 12:20:57 CEST 2015


Am Tue, 12. May 2015, 10:26:50 +0200 schrieb Aleksejs Fomins:
> Date: Tue, 12 May 2015 10:26:50 +0200
> From: Aleksejs Fomins <aleksejs.fomins at lspr.ch>
> To: dune at dune-project.org
> Subject: Re: [Dune] dunecontrol crash
> 
> Dear All,
> 
> I think I have narrowed the problem as much as I could, but I still can not solve it.
> 
> So here is the problem:
> 
> I have a file in my project called cmake/modules/FindBoost.cmake
> This file has exactly 1 uncommented line
>   find_package(Boost)
> 
> Currently this line crashes dune-control (see crash log below)
> 
> However, if I comment this line, and write the line
>   find_package(Boost)
> explicitly in the root CMakeLists.txt file of my project, the code does not crash.
> 
> 
> Could you please tell me what is the problem. I really have the feeling it is something stupid

It is indeed (but we've all been there ;))

"find_package(Boost)" tells cmake to look for a file FindBoost.cmake and
execute it[1].  However, since you say that file contains a line
"find_package(Boost)", cmake will recursively look for the file
FindBoost.cmake and execute it.  So you have an infinite recursion, which is
likely to overflow the stack, which on many architectures results in a
segmentation fault.

So, FindBoost.cmake should not contain "find_package(Boost)".

[1] Probably in some special way that is different from "include(FindBoost)".
> 
> 
> 
> ---------------------------------------------------------------
> -- 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.
> ./dune-common/bin/dunecontrol: line 723: 146086 Segmentation fault      CXX=mpicxx CC=mpicc cmake -DCMAKE_MODULE_PATH="" "-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" -DENABLE_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE "-Ddune-grid_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-grid/build-cmake" "-Ddune-istl_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-istl/build-cmake" "-Ddune-localfunctions_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-localfunctions/build-cmake" "-Ddune-alugrid_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-alugrid/build-cmake" "-Ddune-curvilineargeometry_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargeometry/build-cmake" "-Ddune-curvilineargrid_DIR=/home/fomins/gitwork/hades-github-lspr-ag/dune-curvilineargrid/build-cmake" -DHADES_FLAGS="-DHAVE_DEBUG" -DCMAKE_CXXFLAGS="-Wall -pedantic -O0 -g3 -I/opt/extli
>  b
> /parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0 -I/opt/extlib/metis/5.1.0/gcc/4.9.0/include -I/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/SRC " -DMETIS_ROOT="/opt/extlib/metis/5.1.0/gcc/4.9.0" -DPARMETIS_ROOT="/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0" -DSUPERLUDIST_ROOT="/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0" -DCMAKE_LIBRARY_PATH:RELEASE="/opt/extlib/boost/1.58.0/gcc/4.9.0/lib" -DCMAKE_LIBRARY_PATH:DEBUG="/opt/extlib/boost/1.58.0/gcc/4.9.0/lib" -DCMAKE_STANDARD_LIBRARIES:RELEASE="-lboost_system -lprogram_options" -DCMAKE_STANDARD_LIBRARIES:DEBUG="-lboost_system -lprogram_options" -DCMAKE_PREFIX_PATH="/opt/extlib/boost/1.58.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;/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0;/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/SRC;/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/lib;" -DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE -DCMAKE_SHARED_LINKER_FLAGS="
>  -
> lzlib" "/home/fomins/gitwork/hades-github-lspr-ag/hades"
> --- Failed to build hades ---
> Terminating dunecontrol due to previous errors!
> ---------------------------------------------------------------
> 
> 
> On 11/05/15 17:44, Aleksejs Fomins wrote:
> > Dear Jö,
> > 
> > I have taken a look at that line, and there was nothing special there, just a bunch of libraries.
> > Anyway, I moved the CMake script initializing SuperLUDist away without modifying the job file, and this particular error went away.
> > So I am almost certain that the bug is not with the wrong parameters.
> > 
> > My conclusion is that CMake came across some sort of bug in the script I just wrote and simply crashed. I will try to re-read the script
> > 
> > Kind regards,
> > Aleksejs
> > 
> > 
> > 
> > On 11/05/15 17:04, Jö Fahlke wrote:
> >> Am Mon, 11. May 2015, 13:58:15 +0200 schrieb Aleksejs Fomins:
> >>> Date: Mon, 11 May 2015 13:58:15 +0200
> >>> From: Aleksejs Fomins <aleksejs.fomins at lspr.ch>
> >>> To: Dune <dune at dune-project.org>
> >>> Subject: [Dune] dunecontrol crash
> >>> X-No-Auth: unauthenticated sender
> >>> X-No-Relay: not in my network
> >>> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101
> >>>  Icedove/31.5.0
> >>> X-Envelope-From: <aleksejs.fomins at lspr.ch>
> >>>
> >>> Dear All,
> >>>
> >>> I wrote a little CMake script to locate SuperLUDist, so I tried to compile my project with it.
> >>> So, the only things that were changed was the .opts file and the extra CMake routines. 
> >>>
> >>> The compilation went well for all libraries, except our code Hades3d, which crashed 
> >>> ./dune-common/bin/dunecontrol: line 723: 84478 Segmentation fault 
> > 
> >> line 723 of dunecontrol (current master) is
> > 
> >>       eval $PREPARAMS $CMAKE "-DCMAKE_MODULE_PATH=\"$CMAKE_MODULE_PATH\" $CMAKE_PARAMS $CMAKE_FLAGS \"$SRCDIR\"" || exit 1
> > 
> >> <https://cgit.dune-project.org/repositories/dune-common/tree/bin/dunecontrol?id=87b0e08a4f0f8369906fd9a79d2678461ecf04b7#n723>
> > 
> >> This probably means that it is cmake that is segfaulting.  Could you give us
> >> the output emitted by dunecontrol and cmake leading up to the segfault?  in
> >> particular, in the line before the one above dunecontrol prints the command it
> >> is going to run.
> > 
> >> Regards,
> >> Jö.
> > 
> > 
> > 
> > _______________________________________________
> > Dune mailing list
> > Dune at dune-project.org
> > http://lists.dune-project.org/mailman/listinfo/dune
> > 

> #################################################################
> ## HADES3D. All rights reserved for and by Benedikt Oswald, 2002-
> #################################################################
> # set up project
> project("hades" C CXX)
> 
> #circumvent not building docs
> set(BUILD_DOCS 1)
> 
> # general stuff
> cmake_minimum_required(VERSION 2.8.6)
> 
> # guess build tree of dune-common
> if(NOT (dune-common_DIR OR dune-common_ROOT OR
>         "${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
>     string(REPLACE  ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
>       ${PROJECT_BINARY_DIR})
> 
> endif()
> 
> #find dune-common and set the module path
> find_package(dune-common REQUIRED)
> #find_package(Boost COMPONENTS regex filesystem system thread date_time program_options log_setup log REQUIRED regex filesystem system thread date_time program_options log_setup log)
> 
> list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules")
> 
> 
> #include the dune macros and hades macros
> include(DuneMacros)
> 
> #include(FindBoost)
> #include(HadesMacros)
> 
> # start a dune project with information from dune.module
> dune_project()
> 
> 
> # make sure our own modules are found
> #set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules")
> add_subdirectory("cmake/modules")
> 
> 
> 
> 
> 
> ########################################################
> # retrieve HADES repository information through querying
> ########################################################
> execute_process (
>     COMMAND git show -s --format=%H
>     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
>     OUTPUT_VARIABLE HADES_REPOSITORY_VERSION
>     OUTPUT_STRIP_TRAILING_WHITESPACE
> )
> 
> execute_process (
>     COMMAND git show -s --format=%cn
>     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
>     OUTPUT_VARIABLE HADES_REPOSITORY_COMMITTER
>     OUTPUT_STRIP_TRAILING_WHITESPACE
> )
> 
> execute_process (
>     COMMAND git show -s --format=%cd
>     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
>     OUTPUT_VARIABLE HADES_REPOSITORY_COMMIT_DATE
>     OUTPUT_STRIP_TRAILING_WHITESPACE
> )
> 
> execute_process (
>     COMMAND git show -s --format=%ce
>     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
>     OUTPUT_VARIABLE HADES_REPOSITORY_COMMITTER_EMAIL
>     OUTPUT_STRIP_TRAILING_WHITESPACE
> )
> 
> 
> 
> 
> 
> 
> 
> #########################################
> ## define header to pass version settings
> #########################################
> configure_file (
>     "${PROJECT_SOURCE_DIR}/version/version.hh.in"
>     "${PROJECT_BINARY_DIR}/version/version.hh"
> )
> 
> 
> 
> ###########################################################################
> ## add global paths that are searched by the linker 
> ###########################################################################
> link_directories(${PROJECT_BINARY_DIR}/hadesgeo/parser)
> link_directories(${PROJECT_BINARY_DIR}/hadesgeo/exporter)
> 
> 
> 
> 
> #########################################
> ## define header to pass version settings
> #########################################
> configure_file (
>     "${PROJECT_SOURCE_DIR}/stdincl/version.hh.in"
>     "${PROJECT_BINARY_DIR}/stdincl/version.hh"
> )
> 
> 
> 
> ###########################################################################
> ## add subdirectories of the HADES3D solve family
> ###########################################################################
> 
> 
> # add directory that contains the core solver executables
> add_subdirectory("hades")
> add_subdirectory("hadesx")
> add_subdirectory("hadesgeo")
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> # finalize the dune project, e.g. generating config.h etc.
> finalize_dune_project(GENERATE_CONFIG_H_CMAKE)

> #################################################################################################################
> ## objective - opts file for building curvilineargrid, 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.58.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;\
> /opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0;\
> /opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/SRC;\
> /opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/lib;\
> "
> 
> GXX_WARNING_OPTS="-Wall -pedantic" 
> GXX_OPTS="-O0 -g3" 
> 
> ## define superludist paths & library
> SUPERLU_DIST_OPTS="-DHAVE_SUPERLU_DIST"
> SUPERLU_DIST_INCLUDE_PATH="-I/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0 -I/opt/extlib/metis/5.1.0/gcc/4.9.0/include -I/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/SRC"
> SUPERLU_DIST_LIBRARY="-L/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/lib -L/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0/lib -L/opt/extlib/metis/5.1.0/gcc/4.9.0/lib -framework Accelerate"
> 
> 
> CMAKE_FLAGS=" \
> -DHADES_FLAGS=\"-DHAVE_DEBUG\" \
> -DCMAKE_CXXFLAGS=\"$GXX_WARNING_OPTS $GXX_OPTS $SUPERLU_DIST_INCLUDE_PATH \" \
> -DMETIS_ROOT=\"/opt/extlib/metis/5.1.0/gcc/4.9.0\" \
> -DPARMETIS_ROOT=\"/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0\" \
> -DSUPERLUDIST_ROOT=\"/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0\" \
> -DCMAKE_LIBRARY_PATH:RELEASE=\"/opt/extlib/boost/1.58.0/gcc/4.9.0/lib\" \
> -DCMAKE_LIBRARY_PATH:DEBUG=\"/opt/extlib/boost/1.58.0/gcc/4.9.0/lib\" \
> -DCMAKE_STANDARD_LIBRARIES:RELEASE=\"-lboost_system -lprogram_options\" \
> -DCMAKE_STANDARD_LIBRARIES:DEBUG=\"-lboost_system -lprogram_options\" \
> -DCMAKE_PREFIX_PATH=\"$CMAKE_PREFIX_PATH\" \
> -DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS:BOOL=TRUE \
> -DCMAKE_SHARED_LINKER_FLAGS=\"-lzlib\" \
> " 
> 
> 
> 
> # -DMY_WEIRD_FLAGS='-DHAVE_SUPERLU_DIST -DBOOST_LOG_DYN_LINK -DHAVE_DEBUG' \
> # -DMY_WEIRD_LIB_PATH='-L/opt/extlib/superludist/3.3/openmpi/1.8.1/gcc/4.9.0/lib -L/opt/extlib/parmetis/4.0.3/openmpi/1.8.1/gcc/4.9.0/lib -L/opt/extlib/metis/5.1.0/gcc/4.9.0/lib' \

> ################################################################
> # Using CMake-automatic routine to find Boost and its packages
> ################################################################
> 
> 
> # Avoid using deprecated boost filesystem code
> #set (BOOST_FILESYSTEM_NO_DEPRECATED)
> #set (BOOST_ERROR_CODE_HEADER_ONLY)
> 
> # search for boost
> find_package(Boost)
> #if(Boost_FOUND)
>     # check for all boost libraries
> #    find_package(Boost COMPONENTS regex filesystem system thread date_time program_options log_setup log REQUIRED regex filesystem system thread date_time program_options log_setup log)
> #    include_directories(${Boost_INCLUDE_DIRS})
> #else(Boost_FOUND)
> #  message(STATUS "HADES requires boost, and will not be compiled without it.")
> #endif(Boost_FOUND)

> ## set(modules "VulcainMacros.cmake")
> 
> set(modules
>   AddBoostFlags.cmake
>   AddSUPERLUDISTFlags.cmake
>   FindBoost.cmake
> )
> 
> install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR})

> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune


-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

Interpunktion, Orthographie und Grammatik der Email ist frei erfunden.
Eine Übereinstimmung mit aktuellen oder ehemaligen Regeln wäre rein
zufällig und ist nicht beabsichtigt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150512/1ba96745/attachment.sig>


More information about the Dune mailing list