mesos-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chun-Hung Hsiao (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MESOS-8724) G++ Warning about libc system macros `major` and `minor` prevents Mesos build
Date Thu, 01 Nov 2018 19:11:00 GMT

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

Chun-Hung Hsiao commented on MESOS-8724:
----------------------------------------

NOTE: This seems to be caused by the change in glibc 2.25:
{noformat}
* The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated. This
 means that in a future release, the macros “major”, “minor”, and “makedev”
 will only be available from <sys/sysmacros.h>.

 These macros are not part of POSIX nor XSI, and their names frequently
 collide with user code; see for instance glibc bug 19239 and Red Hat bug
 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and C++ code
 presently cannot avoid being compiled under _GNU_SOURCE, exacerbating the
 problem.{noformat}

> G++ Warning about libc system macros `major` and `minor` prevents Mesos build
> -----------------------------------------------------------------------------
>
>                 Key: MESOS-8724
>                 URL: https://issues.apache.org/jira/browse/MESOS-8724
>             Project: Mesos
>          Issue Type: Bug
>    Affects Versions: 1.5.2
>            Reporter: Benno Evers
>            Assignee: Chun-Hung Hsiao
>            Priority: Blocker
>             Fix For: 1.6.0
>
>
> On linux systems, the header `<sys/sysmacros.h>` defines three macros called makedev(),
major() and minor(). (See also [http://man7.org/linux/man-pages/man3/makedev.3.html])
> Trying to compile Mesos using g++ 7.2.0 leads to the following warning:
> {noformat}
> ../include/csi/csi.pb.h:6042:13: error: In the GNU C Library, "minor" is defined
>  by <sys/sysmacros.h>. For historical compatibility, it is
>  currently defined by <sys/types.h> as well, but we plan to
>  remove this soon. To use "minor", include <sys/sysmacros.h>
>  directly. If you did not intend to use a system-defined macro
>  "minor", you should undefine it after including <sys/types.h>. [-Werror]
>  inline ::google::protobuf::uint32 Version::minor() const {
> {noformat}
> The root cause is that csi.proto defines the following protobuf message:
> {noformat}
> message Version {
>   uint32 major = 1;  // This field is REQUIRED.
>   uint32 minor = 2;  // This field is REQUIRED.
>   uint32 patch = 3;  // This field is REQUIRED.
> }
> {noformat}
> The generated C++ in `csi.pb.h` headers will contain, amongst others, the following function:
> {noformat}
> #include <string>
> // [6000 lines of code...]
> inline ::google::protobuf::uint32 Version::major() const {
>   // @@protoc_insertion_point(field_get:csi.Version.major)
>   return major_;
> }
> {noformat}
> And the recursive include structure of the header `<string>` leads to `stdlib.h`
as follows:
> {noformat}
> .       /usr/include/c++/7/string
> ..      /usr/include/c++/7/bits/basic_string.h
> ...     /usr/include/c++/7/ext/string_conversions.h
> ....    /usr/include/c++/7/cstdlib
> .....   /usr/include/stdlib.h
> ......  /usr/include/x86_64-linux-gnu/sys/types.h
> ....... /usr/include/x86_64-linux-gnu/sys/sysmacros.h{noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message