hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8569) CMakeLists.txt: define _GNU_SOURCE and _LARGEFILE_SOURCE
Date Mon, 16 Jul 2012 20:44:35 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-8569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13415619#comment-13415619
] 

Colin Patrick McCabe commented on HADOOP-8569:
----------------------------------------------

_GNU_SOURCE was defined previously in most (if not all) of our native projects.  After I did
the CMake conversion, the fact that it wasn't defined in the CMakeLists.txt was a bug, not
a feature.  That's what I'm trying to fix here.

I realize that it's tempting to assume that code that you write without _GNU_SOURCE defined
will automatically be portable.  However, this is *NOT TRUE*.  For example, even without _GNU_SOURCE
defined, you still get the non-POSIX definition of strerror_r out of glibc.

The only valid way to make sure your code is portable is to build and test it on multiple
platforms.  Any other strategy is just a waste of time.  Defining GNU_SOURCE is similar to
setting the correct DOCTYPE in your HTML file.  It tells the browser (or compiler in this
case) to turn off "quirks mode" and give you the real deal.

I don't think the CheckFunctionExists stuff in the CMakeLists.txt will work consistently without
_GNU_SOURCE defined.

There are better ways to improve our portability.  For example, we should probably have some
OpenBSD jenkins build slaves.  But let's not waste our time messing with macros.  It really
adds nothing but inconvenience.

bq. If we don't have FILE_OFFSET_BITS=64, then shouldn't we also leave out LARGEFILE_SOURCE?

_LARGEFILE_SOURCE exposes fseeko and ftello.   _FILE_OFFSET_BITS changes the default off_t
type to be 64 bits.  Basically _LARGEFILE_SOURCE is something you need to define in addition
to _FILE_OFFSET_BITS, but the two things do different things.
                
> CMakeLists.txt: define _GNU_SOURCE and _LARGEFILE_SOURCE
> --------------------------------------------------------
>
>                 Key: HADOOP-8569
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8569
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>         Attachments: HADOOP-8569.001.patch
>
>
> In the native code, we should define _GNU_SOURCE and _LARGEFILE_SOURCE so that all of
the functions on Linux are available.
> _LARGEFILE enables fseeko and ftello; _GNU_SOURCE enables a variety of Linux-specific
functions from glibc, including sync_file_range.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message