GNOME Bugzilla – Bug 444097
Cannot compile gtksearchenginesimple.c
Last modified: 2007-06-10 17:25:24 UTC
gtksearchenginesimple.c:199: warning: `struct FTW' declared inside parameter list gtksearchenginesimple.c:199: warning: its scope is only this definition or declaration, which is probably not what you want. gtksearchenginesimple.c: In function `search_visit_func': gtksearchenginesimple.c:248: warning: assignment discards qualifiers from pointer target type gtksearchenginesimple.c: In function `search_thread_func': gtksearchenginesimple.c:293: warning: implicit declaration of function `nftw' gtksearchenginesimple.c:297: `FTW_PHYS' undeclared (first use in this function) configure determined that #undef HAVE_GNU_FTW #define HAVE_FTW_H 1 However, if I modify the block at the top of the file #ifdef HAVE_GNU_FTW #define _XOPEN_SOURCE 500 #define _GNU_SOURCE #endif to define those two symbols unconditionally, the build succeeds. Seems I don't have GNU FTW but still need those.
does this happen with a clean check out of trunk? it's quite odd: the FTW structure and nftw() are part of the POSIX file tree walk API, which is included if HAVE_FTW_H is defined - which apparently is. what configure checks, aside from the existence of ftw.h, is whether ftw.h enables the GNU libc extensions. if no _XOPEN_SOURCE or _GNU_SOURCE are defined then the GNU libc implementation falls back to the POSIX one. could you please make a clean check out of gtk+ trunk, run the autogen.sh script and attach the resulting config.h to the bug? also the config.log would be helpful.
Created attachment 89357 [details] config.h This was built from the 2.11.1 tarball.
Created attachment 89358 [details] config.log
the configure script correctly defines HAVE_FTW_H and undefs HAVE_GNU_FTW, so you should have the definitions for nftw(), struct FTW and FTW_PHYS. this is very strange. I've noticed you're using linux 2.4.x - which version of libc is that you're using?
glibc is 2.2.3 (yeah, I know...)
could you cook up a patch to detect such changes? thanks.
Would there be any problems simply defining _XOPEN_SOURCE unconditionally?
Created attachment 89427 [details] [review] [PATCH] Unconditionally define GNU libc symbols in GtkSearchEngineSimple Really old GNU libc versions have ftw.h but export POSIX ftw() and friends only if _XOPEN_SOURCE and _GNU_SOURCE are defined. See bug 444097. --- gtk/gtksearchenginesimple.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
I'd like to get this tested on other platforms, before committing it: we added checks to avoid breaking compilation, I'd hate to break it while trying to unbreak it. :-) Jens: you can confirm the patch above makes everything work for you, right?
(In reply to comment #9) > Jens: you can confirm the patch above makes everything work for you, right? Yes, although I don't actually need the _GNU_SOURCE.
2007-06-10 Emmanuele Bassi <ebassi@gnome.org> * gtk/gtksearchenginesimple.c: Unconditionally define _GNU_SOURCE and XOPEN_SOURCE, in order to make the simple search engine backend build on really ancient GNU libc. (#444097)