GNOME Bugzilla – Bug 756475
ac_cv_func_posix_getpwuid_r/ac_cv_func_posix_getgrgid_r breaks cross-compile
Last modified: 2015-12-16 14:09:53 UTC
the glib configure.ac has: AC_CACHE_CHECK([for posix getpwuid_r], ac_cv_func_posix_getpwuid_r, [AC_TRY_RUN([ #include <errno.h> #include <pwd.h> int main () { char buffer[10000]; struct passwd pwd, *pwptr = &pwd; int error; errno = 0; error = getpwuid_r (0, &pwd, buffer, sizeof (buffer), &pwptr); return (error < 0 && errno == ENOSYS) || error == ENOSYS; } ], [ac_cv_func_posix_getpwuid_r=yes], [ac_cv_func_posix_getpwuid_r=no])]) in the cross-compile case, this fails. it should just fallback to a link time test and call it a day.
I think most projects that focus on cross builds like OpenEmbedded have been maintaining cache variables there. (It's overall not a very robust system either way, but in reality the cross frameworks are more likely to learn first about exotic architectures than each upstream project is to)
(In reply to Mike Frysinger from comment #0) let's lump the ac_cv_func_posix_getgrgid_r test in here too since it's right after and does the same exact thing (In reply to Colin Walters from comment #1) i'm aware of OE works (and i've designed the same exact systems multiple times). but it's just a hack that devs do because they can't be bothered to report the issue to the respective upstream to get it fixed properly in the first place.
(In reply to Mike Frysinger from comment #2) > (In reply to Mike Frysinger from comment #0) > > let's lump the ac_cv_func_posix_getgrgid_r test in here too since it's right > after and does the same exact thing > > (In reply to Colin Walters from comment #1) > > i'm aware of OE works (and i've designed the same exact systems multiple > times). but it's just a hack that devs do because they can't be bothered to > report the issue to the respective upstream to get it fixed properly in the > first place. I'm aware of your experience with build systems too =) I don't think it's quite as clear cut as that. Your bug reports look correct, but a tricky thing for doing this upstream is often we don't have the setup to *test* the patch. You'd get a lot more mileage out of submitting (downstream tested) patches rather than bugs for this.
(In reply to Colin Walters from comment #3) submitting to bugzilla or some mailing list ? i've submitted patches and one-line diffs to other bugs to the GNOME bugzilla and haven't seen any responses, so i'm a bit pessimistic :/.
The check is broken even without considering cross-compile cases: we should never check ENOSYS at ./configure time because the build machine very likely has a different kernel version than the one (or ones) that the resulting binary will actually be run on... I'd be happy to see this simplified in any case.
Created attachment 313455 [details] [review] Stop supporting non-POSIX getpwuid_r, getgrgid_r Bug 13403 introduced support for the non-POSIX variants of these APIs found on a system called "DG/UX". Meanwhile, the complicated checks here are breaking cross-builds on systems that we actually care about. Remove the complicated checks and replace them with AC_CHECK_FUNCS. Remove the resulting dead code from a couple of .c files.
Review of attachment 313455 [details] [review]: Looks fine to me.
Attachment 313455 [details] pushed as aa16359 - Stop supporting non-POSIX getpwuid_r, getgrgid_r