#1605 [Cmake] HAVE_MALLOC_H_ possibly set incorrectly on MacOSX
Metadata
Property | Value |
---|---|
Reported by | Andreas Fischle (andreas.fischle@uni-due.de) |
Reported at | Mar 17, 2015 21:51 |
Type | Bug Report |
Version | Git (pre2.4) [cmake] |
Operating System | Mac OS |
Last edited by | Christoph Grüninger (gruenich@iws.uni-stuttgart.de) |
Last edited at | Mar 20, 2015 08:08 |
Closed by | Christoph Grüninger (gruenich@iws.uni-stuttgart.de) |
Closed at | Mar 20, 2015 08:08 |
Closed in version | Unknown |
Resolution | Fixed |
Comment | I went ahead and removed the checks in 5affebbd9c71…. dune-grid-howto, PDELab, DuMuX still work fine. |
Description
Dear Developers,
on my MacOSX system <malloc.h> is not available. It seems that the standard replacement is <sys/malloc.h>. (I think this is a standard issue on MacOSX, but I might be wrong.)
The effect is that HAVE_MALLOC_H_ is not set although malloc is defined (in <sys/malloc.h>.) I don't know whether this is the intended behavior. Here is the error message:
-- Determining if the include file malloc.h exists failed with the following output: Change Dir: /Users/fischi/workspace/src/dune-clean/dune-common/build-cmake/CMakeFiles/CMakeTmp
Run Build Command:"/opt/local/bin/gmake" "cmTryCompileExec1882015635/fast" /opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec1882015635.dir/build.make CMakeFiles/cmTryCompileExec1882015635.dir/build gmake[1]: Entering directory '/Volumes/HDD/Workspace/src/dune-clean/dune-common/build-cmake/CMakeFiles/CMakeTmp' /opt/local/bin/cmake -E cmake_progress_report /Users/fischi/workspace/src/dune-clean/dune-common/build-cmake/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec1882015635.dir/CheckIncludeFile.c.o /opt/local/bin/clang-mp-3.5 -o CMakeFiles/cmTryCompileExec1882015635.dir/CheckIncludeFile.c.o -c /Users/fischi/workspace/src/dune-clean/dune-common/build-cmake/CMakeFiles/CMakeTmp/CheckIncludeFile.c /Users/fischi/workspace/src/dune-clean/dune-common/build-cmake/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'malloc.h' file not found #include <malloc.h> ^ 1 error generated. CMakeFiles/cmTryCompileExec1882015635.dir/build.make:57: recipe for target 'CMakeFiles/cmTryCompileExec1882015635.dir/CheckIncludeFile.c.o' failed
A trivial quick fix on my machine is to check for the include <sys/malloc.h> in DuneMacros.cmake, see the following diff:
diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index 92d9fa0..c4ca6b1 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -600,7 +600,7 @@ macro(dune_project)
search for headers
include(CheckIncludeFile) include(CheckIncludeFileCXX)
- check_include_file("malloc.h" HAVE_MALLOC_H)
- check_include_file("sys/malloc.h" HAVE_MALLOC_H) check_include_file("stdint.h" HAVE_STDINT_H) check_include_file_cxx("memory" HAVE_MEMORY) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -DHAVE_MEMORY=${HAVE_MEMORY}")