skoobe / riofs

Userspace S3 filesystem
GNU General Public License v3.0
393 stars 60 forks source link

gcc compiler warnings - nftw and strcasecmp not defined #135

Closed ThePythonicCow closed 7 years ago

ThePythonicCow commented 7 years ago

Since the 11 Nov 2016 commit 7ba995f21f20b765faf37d3938ce3b5049dbddf7, that removed the defines of _XOPEN_SOURCE, _BSD_SOURCE, _GNU_SOURCE, and _DEFAULT_SOURCE from include/global.h, I've been getting gcc compiler warnings that various nftw symbols, and strcasecmp, were not defined. When I add back in these removed defines to global.h, the warnings go away, as expected. I believe that at least _XOPEN_SOURCE is needed to expose various nftw symbols, and that _GNU_SOURCE is needed to expose strcasecmp ... at least in the /usr/include header files on my recent model Linux distro.

I'd like to add these defines back in, but before sending in a patch to do that, I should check whether or not there was a good reason to remove them from include/global.h, perhaps in some other build envionment.

So I am posting this issue, to see if others have some more ideas on this.

wizzard commented 7 years ago

Which OS/distro do you use? I'm on Gentoo and don't see any warnings.

ThePythonicCow commented 7 years ago

I am using Manjaro-openrc 16.10.

However I am finding that I don't always get these warnings. I need to look into this further. I don't understand it well enough yet.

I will also send an email to the author of commit https://github.com/skoobe/riofs/commit/7ba995f21f20b765faf37d3938ce3b5049dbddf7. Perhaps he can say more as to why he removed the defines of _XOPEN_SOURCE, _BSD_SOURCE, _GNU_SOURCE, and _DEFAULT_SOURCE from include/global.h

nopjmp commented 7 years ago

FreeBSD and other platforms (non-Linux) and possible other libc's will remove definitions of POSIX and others that are not available. This is why AC_USE_SYSTEM_EXTENSIONS was added to the autoconfig file. You shouldn't be adding them to the global config and they should be a build option that gets detected automatically. I'm guessing Manjaro is using some version of glibc that doesn't like what autoconfig is giving it.

I'm not the best portability guru to ask, but I can stare it when I get a chance. @ThePythonicCow can you provided the build output from a fresh clone? glibc and compiler would be nice to have to, but I can look those up later.

ThePythonicCow commented 7 years ago

nopjmp wrote "This is why AC_USE_SYSTEM_EXTENSIONS was added to the autoconfig file. You shouldn't be adding them to the global config and they should be a build option that gets detected automatically".

OK - that sounds likely so. I am getting inconsistent results (warnings sometimes, not other times) on my end. I have worked occasionally (albeit painfully) with autoconfig in the past at times, so I should do some more work on my end, to see if there really is a problem here, or if I just had some unreproducible inconsistency in my current build tree.

Thanks for the quick response and explanation.

I'll get back to this Issue later, once I can either recommend closing it, "No Problem Found", or if I have some useful, reproducible issue that I think needs further work.

ThePythonicCow commented 7 years ago

I'm guessing that the problem that caused me to think that I needed to restore the defines of _XOPEN_SOURCE and _GNU_SOURCE back into include/global.h was because I had not rerun autoreconf (as in the autogen.sh script) again, after picking up the change that removed those defines, in favor of the AC_USE_SYSTEM_EXTENSIONS in the autoconfig file.

In any case, I can no longer reproduce the problem that started this issue.

So I'm closing this issue.