You have been subscribed to a public bug:

The program try.c, below, does not compile.
Though with HAVE_ARCH_STRUCT_FLOCK and HAVE_ARCH_STRUCT_FLOCK64 defined, it 
compiles.
But then fails again to compile, when _GNU_SOURCE is also defined.
I expect this to compile in all three cases.

$ cat try.c
//#define _GNU_SOURCE
//#define HAVE_ARCH_STRUCT_FLOCK
//#define HAVE_ARCH_STRUCT_FLOCK64
#include <fcntl.h>
#include <linux/fcntl.h>
int main(int argc, char *argv[]){}

$ gcc try.c 
In file included from /usr/include/x86_64-linux-gnu/asm/fcntl.h:1:0,
                 from /usr/include/linux/fcntl.h:4,
                 from try.c:5:
/usr/include/asm-generic/fcntl.h:195:8: error: redefinition of ‘struct flock’
 struct flock {
        ^~~~~
In file included from /usr/include/fcntl.h:35:0,
                 from try.c:4:
/usr/include/x86_64-linux-gnu/bits/fcntl.h:35:8: note: originally defined here
 struct flock
        ^~~~~
$ gcc -DHAVE_ARCH_STRUCT_FLOCK -DHAVE_ARCH_STRUCT_FLOCK64 try.c ## this is ok

$ gcc -D_GNU_SOURCE -DHAVE_ARCH_STRUCT_FLOCK -DHAVE_ARCH_STRUCT_FLOCK64 try.c 
In file included from /usr/include/x86_64-linux-gnu/asm/fcntl.h:1:0,
                 from /usr/include/linux/fcntl.h:4,
                 from try.c:5:
/usr/include/asm-generic/fcntl.h:155:8: error: redefinition of ‘struct 
f_owner_ex’
 struct f_owner_ex {
        ^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/fcntl.h:61:0,
                 from /usr/include/fcntl.h:35,
                 from try.c:4:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:267:8: note: originally 
defined here
 struct f_owner_ex
        ^~~~~~~~~~

$ gcc --version | head -1
gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0

$ lsb_release -rd
Description:    Ubuntu 17.10
Release:        17.10

$ dpkg -S /usr/include/x86_64-linux-gnu/bits/fcntl.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/fcntl.h
# Package: libc6-dev
# Version: 2.26-0ubuntu2

$ dpkg -S /usr/include/x86_64-linux-gnu/asm/fcntl.h
linux-libc-dev:amd64: /usr/include/x86_64-linux-gnu/asm/fcntl.h
# Package: linux-libc-dev
# Version: 4.13.0-19.22

Regards, Mike

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: bot-comment
-- 
The header files fcntl.h and linux/fcntl.h are incompatible
https://bugs.launchpad.net/bugs/1739300
You received this bug notification because you are a member of Kernel Packages, 
which is subscribed to linux in Ubuntu.

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to