View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010044CMakeModulespublic2009-12-12 19:042011-01-31 16:02
ReporterJohannes Simon 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.4Fixed in VersionCMake 2.8.4 
Summary0010044: check_function_exists( fdatasync HAVE_FDATASYNC ) erroneously sets HAVE_FDATASYNC to 1
DescriptionOn Mac OS X 10.6 (Snow Leopard), and probably on Mac OS X in general, check_function_exists(fdatasync HAVE_FDATASYNC) will wrongly set HAVE_FDATASYNC to 1, though there is no such function on Mac OS. There's only fsync.
Additional InformationTo test it, the following CMakeLists.txt will do:
  1 include(CheckFunctionExists)
  2 check_function_exists(fdatasync HAVE_FDATASYNC)
  3 message( ${HAVE_FDATASYNC} )
TagsNo tags attached.
Attached Files

 Relationships
related to 0011685closedBrad King CHECK_SYMBOL_EXISTS doesn't find enum constants 

  Notes
(0024773)
David Cole (manager)
2011-01-17 12:26

Brad,

I can reproduce this, but I'm not 100% certain about what's going wrong yet... Is this just a short-coming of CheckFunctionExists, or is this a real problem that needs fixing?
(0024774)
Brad King (manager)
2011-01-17 12:50

The effective test source file used by the try_compile is:

$ cat test.c
char fdatasync();
int main(void) {
  fdatasync();
  return 0;
}

which does compile:

$ gcc test.c

The CheckSymbolExists module is better because it actually ensures there is a declaration in the header file.
(0024775)
Brad King (manager)
2011-01-17 12:51

$ nm /usr/lib/libSystem.B.dylib |grep fdatasync
00000000000b46f0 t ___fdatasync
00000000000b46f0 T _fdatasync
(0024776)
Brad King (manager)
2011-01-17 12:52

$ grep fdatasync /usr/include/* /usr/include/sys/*
/usr/include/sys/syscall.h:#define SYS_fdatasync 187
(0024784)
Brad King (manager)
2011-01-17 14:08

I clarified the documentation of the module to state exactly what is checked:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=114c3224 [^]

In that sense this is "fixed".

Use CheckSymbolExists to verify that a declaration is available too. Use CheckCSourceCompiles to try compiling and linking an actual call to the function.

 Issue History
Date Modified Username Field Change
2009-12-12 19:04 Johannes Simon New Issue
2010-08-03 12:24 Kovarththanan Rajaratnam Category CMake => Modules
2011-01-17 12:25 David Cole Assigned To => Brad King
2011-01-17 12:25 David Cole Status new => assigned
2011-01-17 12:26 David Cole Note Added: 0024773
2011-01-17 12:50 Brad King Note Added: 0024774
2011-01-17 12:51 Brad King Note Added: 0024775
2011-01-17 12:52 Brad King Note Added: 0024776
2011-01-17 12:55 Brad King Relationship added related to 0011685
2011-01-17 14:08 Brad King Note Added: 0024784
2011-01-17 14:08 Brad King Status assigned => closed
2011-01-17 14:08 Brad King Resolution open => fixed
2011-01-31 16:02 David Cole Fixed in Version => CMake 2.8.4
2011-01-31 16:02 David Cole Target Version => CMake 2.8.4


Copyright © 2000 - 2018 MantisBT Team