[Kde-pim] Re: Grantlee 0.1.9 fails to build on FreeBSD due to strings.h

Raphael Kubo da Costa kubito at gmail.com
Mon Aug 1 00:32:14 BST 2011


Stephen Kelly <steveire at gmail.com> writes:

> The issue regarding exception.h was this one which now has a patch in the
> 0.1 branch:
>
> https://bugs.kde.org/show_bug.cgi?id=276425
>
> I looked for instances of strings.h being included and only found them in
> the same directory as the file strings.h, which means that the correct one
> should be found.
>
> I guess the actual issue with that file is slightly different to the issue
> with exception.h? Can you give more information about the build failure?

Looking at the commit which fixed the exceptions.h bug, the cause seems
to be the same, but the strings.h problem cannot be fixed the same way.

In this specific issue, there is a Grantlee header file (strings.h) with
the same name as a POSIX.1, system-wide one. Note this is not the POSIX
header string.h. Contrary to glibc, FreeBSD's libc does the following in
/usr/include/string.h:

  /*
   * Prototype functions which were historically defined in <string.h>,
   * but are required by POSIX to be prototyped in <strings.h>.
   */
  #if __BSD_VISIBLE
  #include <strings.h>
  #endif

So we have /usr/include/strings.h, a system header, and
$GRANTLEE/templates/defaultfilters/strings.h.

Grantlee's build system passes -I$GRANTLEE_SRC/templates/defaultfilters
to gcc during compilation, which makes this directory be looked up
_before_ the system include directories by gcc. This means that whenever
a file does #include <strings.h> the Grantlee version will be found
instead of the system-wide one, causing all sorts of compilation
problems.

As I said, I don't see this being fixed the same way the exception bug
was fixed because in this case the problem is not caused by a direct
#include in Grantlee's code, but rather by grantlee including Qt stuff
which includes stl stuff which includes string.h, which finally includes
<strings.h>.

Would it be too troublesome to rename strings.h to a non-POSIX header
name?

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list