rr icon indicating copy to clipboard operation
rr copied to clipboard

rr fails to build with glibc-2.36 due to differences between <linux/mount.h> and <sys/mount.h> headers

Open wcohen opened this issue 3 years ago • 5 comments
trafficstars

When attempting to build a copy of rr checked out from the git repository (commit da33770d22b404d7333e46e26495eaca0c5a6d8a) on Fedora rawhide with upcoming glibc-2.36 (glibc-2.35.9000-31.fc37.x86_64). The build of rr fails with the following errors:

[  8%] Building C object CMakeFiles/64bit_child.dir/src/test/64bit_child.c.o
/usr/bin/gcc -DEXECINFO_H=1 -DFANOTIFY_H=1 -DMQUEUE_H=1 -DPROC_SERVICE_H=1 -DRR_VERSION=\"5.5.0\" -I/home/wcohen/rpmbuild/BUILD/rr-da33770/include -I/home/wcohen/rpmbuild/BUILD/rr-da33770/third-party/proc-service -I/home/wcohen/rpmbuild/BUILD/rr-da33770/third-party/brotli/include -I/home/wcohen/rpmbuild/BUILD/rr-da33770/redhat-linux-build -I/home/wcohen/rpmbuild/BUILD/rr-da33770/src/preload -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D__USE_LARGEFILE64 -pthread -msse2 -D__MMX__ -D__SSE__ -D__SSE2__ -fmacro-prefix-map=/home/wcohen/rpmbuild/BUILD/rr-da33770/= -Wstrict-prototypes -std=gnu11  -pthread  -DNDEBUG -Wall -Wextra -DDEBUG -UNDEBUG -g3 -O0 -MD -MT CMakeFiles/64bit_child.dir/src/test/64bit_child.c.o -MF CMakeFiles/64bit_child.dir/src/test/64bit_child.c.o.d -o CMakeFiles/64bit_child.dir/src/test/64bit_child.c.o -c /home/wcohen/rpmbuild/BUILD/rr-da33770/src/test/64bit_child.c
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdlib.h:26,
                 from /home/wcohen/rpmbuild/BUILD/rr-da33770/src/test/util.h:15,
                 from /home/wcohen/rpmbuild/BUILD/rr-da33770/src/test/64bit_child.c:3:
/usr/include/features.h:412:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  412 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
In file included from /usr/include/linux/fs.h:19,
                 from /usr/include/linux/aio_abi.h:31,
                 from /home/wcohen/rpmbuild/BUILD/rr-da33770/src/test/util.h:29:
/usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command'
   95 | enum fsconfig_command {
      |      ^~~~~~~~~~~~~~~~
In file included from /home/wcohen/rpmbuild/BUILD/rr-da33770/src/test/util.h:17:
/usr/include/sys/mount.h:189:6: note: originally defined here
  189 | enum fsconfig_command
      |      ^~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG'
   96 |         FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:191:3: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command'
  191 |   FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:97:9: error: redeclaration of enumerator 'FSCONFIG_SET_STRING'
   97 |         FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:193:3: note: previous definition of 'FSCONFIG_SET_STRING' with type 'enum fsconfig_command'
  193 |   FSCONFIG_SET_STRING     = 1,    /* Set parameter, supplying a string value */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:98:9: error: redeclaration of enumerator 'FSCONFIG_SET_BINARY'
   98 |         FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:195:3: note: previous definition of 'FSCONFIG_SET_BINARY' with type 'enum fsconfig_command'
  195 |   FSCONFIG_SET_BINARY     = 2,    /* Set parameter, supplying a binary blob value */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:99:9: error: redeclaration of enumerator 'FSCONFIG_SET_PATH'
   99 |         FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
      |         ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:197:3: note: previous definition of 'FSCONFIG_SET_PATH' with type 'enum fsconfig_command'
  197 |   FSCONFIG_SET_PATH       = 3,    /* Set parameter, supplying an object by path */
      |   ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:100:9: error: redeclaration of enumerator 'FSCONFIG_SET_PATH_EMPTY'
  100 |         FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:199:3: note: previous definition of 'FSCONFIG_SET_PATH_EMPTY' with type 'enum fsconfig_command'
  199 |   FSCONFIG_SET_PATH_EMPTY = 4,    /* Set parameter, supplying an object by (empty) path */
      |   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:101:9: error: redeclaration of enumerator 'FSCONFIG_SET_FD'
  101 |         FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
      |         ^~~~~~~~~~~~~~~
/usr/include/sys/mount.h:201:3: note: previous definition of 'FSCONFIG_SET_FD' with type 'enum fsconfig_command'
  201 |   FSCONFIG_SET_FD         = 5,    /* Set parameter, supplying an object by fd */
      |   ^~~~~~~~~~~~~~~
/usr/include/linux/mount.h:102:9: error: redeclaration of enumerator 'FSCONFIG_CMD_CREATE'
  102 |         FSCONFIG_CMD_CREATE     = 6,    /* Invoke superblock creation */
      |         ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:203:3: note: previous definition of 'FSCONFIG_CMD_CREATE' with type 'enum fsconfig_command'
  203 |   FSCONFIG_CMD_CREATE     = 6,    /* Invoke superblock creation */
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:103:9: error: redeclaration of enumerator 'FSCONFIG_CMD_RECONFIGURE'
  103 |         FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:205:3: note: previous definition of 'FSCONFIG_CMD_RECONFIGURE' with type 'enum fsconfig_command'
  205 |   FSCONFIG_CMD_RECONFIGURE = 7,   /* Invoke superblock reconfiguration */
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:129:8: error: redefinition of 'struct mount_attr'
  129 | struct mount_attr {
      |        ^~~~~~~~~~
/usr/include/sys/mount.h:161:8: note: originally defined here
  161 | struct mount_attr
      |        ^~~~~~~~~~
gmake[2]: *** [CMakeFiles/64bit_child.dir/build.make:79: CMakeFiles/64bit_child.dir/src/test/64bit_child.c.o] Error 1

Doing some research it appears that this problem occurs on a number of software packages due to differences between <linux/mount.h> and <sys/mount.h> :

https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E

wcohen avatar Aug 04 '22 18:08 wcohen

Here are the RPMs the associated headers are coming from:

[wcohen@rawhide rr-da33770]$ rpm -qf /usr/include/linux/mount.h kernel-headers-5.19.0-1.fc37.x86_64 [wcohen@rawhide rr-da33770]$ rpm -qf /usr/include/sys/mount.h glibc-headers-x86-2.35.9000-31.fc37.noarch

wcohen avatar Aug 04 '22 19:08 wcohen

There are two patches on https://github.com/wcohen/rr/tree/wcohen/rhbz2113185 that allow rr to build on Fedora rawhide.

wcohen avatar Aug 05 '22 14:08 wcohen

Also broken on Arch with glibc 2.36 + linux-headers 5.18.16; I'll try your patch

rdrpenguin04 avatar Aug 06 '22 04:08 rdrpenguin04

Can confirm, builds on Arch Linux with aforementioned settings.

rdrpenguin04 avatar Aug 06 '22 04:08 rdrpenguin04

This would be more useful in the form of a PR.

khuey avatar Aug 08 '22 00:08 khuey

Apparently it has been fixed on "2.36 release branch", but the next bug release is likely some time off (2.36.1 with 23 day since 2.36): https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E

See also https://github.com/lxc/lxc/issues/4176 https://aur.archlinux.org/packages/qemu-user-static

matu3ba avatar Sep 05 '22 23:09 matu3ba

The issue has been fixed on Fedora, so the patches are no longer required. I would expect that other distirbutions will also have the problem self resolve with newer kernel headers/glibc.

wcohen avatar Sep 22 '22 22:09 wcohen