View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001487CMakeModulespublic2005-01-15 17:172007-10-12 11:29
ReporterMathieu Malaterre 
Assigned ToBill Hoffman 
PrioritylowSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001487: CHECK_INCLUDE_FILE not bullet proof
DescriptionThe approach for CHECK_INCLUDE_FILES is not resitant in case the include file produce error. for example on MacOSX we have the file:

$ ls -al /usr/include/net/if.h
-r--r--r-- 1 root wheel 10923 10 Dec 2003 /usr/include/net/if.h

But if we try to compile:
#include <net/if.h>

int main()
{
  return 0;
}

we get:
$ gcc -c /tmp/foo.c
In file included from /tmp/foo.c:1:
/usr/include/net/if.h:186: error: field `ifru_addr' has incomplete type
/usr/include/net/if.h:187: error: field `ifru_dstaddr' has incomplete type
/usr/include/net/if.h:188: error: field `ifru_broadaddr' has incomplete type
/usr/include/net/if.h:219: error: field `ifra_addr' has incomplete type
/usr/include/net/if.h:220: error: field `ifra_broadaddr' has incomplete type
/usr/include/net/if.h:221: error: field `ifra_mask' has incomplete type
/usr/include/net/if.h:290: error: field `addr' has incomplete type
/usr/include/net/if.h:291: error: field `dstaddr' has incomplete type
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0001949)
Mathieu Malaterre (developer)
2005-01-17 14:29

CHECK_INCLUDE_FILE_CONCAT solve this problem. Changing bug to feature request so this MACRO is directly in cmake Modules.
(0008802)
dizzy (reporter)
2007-09-02 07:44
edited on: 2007-09-02 07:44

(I deleted my check_symbol_exists useless observation)

Ok maybe I miss something but check_include_file/check_include_files both properly detect if including the header(s) gives error. What do you mean by "resitant"?

Your error seems like the standard BSD include file organization technique where dependentcy headers are not included by the header that needs them and usually you need to include "sys/types.h" and such before using such a header. As such your check_include_files should be something of the form check_include_files("sys/types.h;net/if.h" HAVE_NET_IF_H) (I don't know exactly what header "net/if.h" needs included first, "sys/types.h" is probably a good guess but your manual page for the API that you need from "net/if.h" should tell you exactly all the includes needed and their order).

Or do you mean something else?

(0009440)
Bill Hoffman (manager)
2007-10-12 11:29

You just have to have the right test and add more includes.

 Issue History
Date Modified Username Field Change
2007-08-31 11:28 Alex Neundorf Assigned To System Admin => Bill Hoffman
2007-09-01 04:50 dizzy Note Added: 0008799
2007-09-02 07:44 dizzy Note Added: 0008802
2007-09-02 07:44 dizzy Note Edited: 0008802
2007-09-02 07:45 dizzy Note Deleted: 0008799
2007-10-12 11:29 Bill Hoffman Status assigned => closed
2007-10-12 11:29 Bill Hoffman Note Added: 0009440
2007-10-12 11:29 Bill Hoffman Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team