[Bug libfortran/51646] New: Make libgfortran compile on Android - without S_IREAD

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 21 08:33:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51646

             Bug #: 51646
           Summary: Make libgfortran compile on Android - without S_IREAD
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: jb@gcc.gnu.org


Created attachment 26156
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26156
Draft patch

Janne: What do you think of the attached patch?

http://specificimpulses.blogspot.com/2011/01/my-android-speaks-fortran-yours-can-too.html
shows that gfortran can be build for on Android (= host + target).

However, Android's NDK does not support S_IREAD and S_IWRITE but only S_IRUSR
and S_IWUSR.

In the Linux man page I find:
       UNIX  V7 (and later systems) had S_IREAD, S_IWRITE, S_IEXEC, where POSIX
       prescribes the synonyms S_IRUSR, S_IWUSR, S_IXUSR.

While POSIX (IEEE Std 1003.1, 2003) just lists the latter:
       S_IRUSR
              Read permission, owner.
       S_IWUSR
              Write permission, owner.

Expected: If no S_IREAD/S_IWRITE is available, use S_IRUSR/S_IWUSR. (Or rather
the other way round, given that only the latter is standard.)

S_IREAD/S_IWRITE is
- checked for in LIBGFOR_CHECK_UNLINK_OPEN_FILE  (libgfortran/acinclude.m4)
- used in io/unix.c's id_from_fd

 * * *

In the blog, the existence of other issues is mentioned and it links to a hack:
http://aeromonkey.homeip.net/public/ugly_gfortran_hacks.patch
(Google cache:
http://webcache.googleusercontent.com/search?q=cache:khmjfgpFiAIJ:aeromonkey.homeip.net/public/ugly_gfortran_hacks.patch+aeromonkey.homeip.net/public/ugly_gfortran_hacks.patch
)

However, the patch/hack does not tell me much: It disable configure checking
(as_fn_exit returns 0 ("echo $1") instead of "exit $1") and in
intrinsics/date_and_time.c the "#ifndef" has been changed into an "#ifdef" for
HAVE_LOCALTIME_R and for HAVE_GMTIME_R.

Without config.log, one can probably not deduce what went wrong.



More information about the Gcc-bugs mailing list