Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wcohen opened this issue Aug 4, 2022 · 7 comments

Comments

@wcohen
Copy link
Contributor

wcohen commented Aug 4, 2022

When attempting to build a copy of rr checked out from the git repository (commit da33770) 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
Copy link
Contributor Author

wcohen commented Aug 4, 2022

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
Copy link
Contributor Author

wcohen commented Aug 5, 2022

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

@rdrpenguin04
Copy link

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

@rdrpenguin04
Copy link

Can confirm, builds on Arch Linux with aforementioned settings.

@khuey
Copy link
Collaborator

khuey commented Aug 8, 2022

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

@matu3ba
Copy link

matu3ba commented Sep 5, 2022

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
lxc/lxc#4176
https://aur.archlinux.org/packages/qemu-user-static

matu3ba added a commit to matu3ba/rr that referenced this issue Sep 5, 2022
This should be reverted, once there are no distros with the affected
release.
The last release was 2022-08-01 and "It has been fixed upstream and
backported to 2.36 release branch.", but there is still no announcement
for the bug fix release.

Further more, "Not a blocker. We can review in 2.37." hints there might
be none.

Due to this bug, rr does not build on Arch Linux as of 2022-09-06.

All credits go to @wcohen for the patch.

Closes rr-debugger#3356.
@wcohen
Copy link
Contributor Author

wcohen commented Sep 22, 2022

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 wcohen closed this as completed Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants