Menu

#52 Fix built with glibc 2.36

Unstable (example)
closed-fixed
nobody
None
5
2022-09-06
2022-07-29
Khem Raj
No

Compile fails with upcoming glibc 3.36

| In file included from /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/unistd.h:25,
| from hdparm.c:9:
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/features.h:194:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
| 194 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
| | ^~~~~~~
| In file included from /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/fs.h:19,
| from hdparm.c:28:
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/mount.h:95:6: error: redeclaration of 'enum fsconfig_command'
| 95 | enum fsconfig_command {
| | ^~~~~~~~~~~~~~~~
| In file included from hdparm.c:24:
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/sys/mount.h:189:6: note: originally defined here
| 189 | enum fsconfig_command
| | ^~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG'
| 96 | FSCONFIG_SET_FLAG = 0, / Set parameter, supplying no value /
| | ^~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/mount.h💯9: error: redeclaration of enumerator 'FSCONFIG_SET_PATH_EMPTY'
| 100 | FSCONFIG_SET_PATH_EMPTY = 4, / Set parameter, supplying an object by (empty) path /
| | ^~~~~~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/mount.h:102:9: error: redeclaration of enumerator 'FSCONFIG_CMD_CREATE'
| 102 | FSCONFIG_CMD_CREATE = 6, / Invoke superblock creation /
| | ^~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/mount.h:103:9: error: redeclaration of enumerator 'FSCONFIG_CMD_RECONFIGURE'
| 103 | FSCONFIG_CMD_RECONFIGURE = 7, / Invoke superblock reconfiguration /
| | ^~~~~~~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/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 /
| | ^~~~~~~~~~~~~~~~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/linux/mount.h:129:8: error: redefinition of 'struct mount_attr'
| 129 | struct mount_attr {
| | ^~~~~~~~~~
| /mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/hdparm/9.64-r0/recipe-sysroot/usr/include/sys/mount.h:161:8: note: originally defined here
| 161 | struct mount_attr
| | ^~~~~~~~~~

Discussion

  • Khem Raj

    Khem Raj - 2022-07-29

    proposed fix

     
  • Mark Lord

    Mark Lord - 2022-07-29

    Thanks. But doing this will break builds with older versions. Can you make it conditional upon the version of GCC ?

     
    • Timo Gurr

      Timo Gurr - 2022-08-04

      This shouldn't have anything to do with GCC(?). At least for my tests hdparm 9.64 with the patch applied compiled fine on two systems, one with glibc 2.35 and one with glibc 2.36 where it failed to build without the patch.

       
  • Dirk Mueller

    Dirk Mueller - 2022-08-09

    if at all this depends on the glibc version I think. the patch looks good to me. I have tested the following patch against glibc 2.19 and gcc 4.8, which is the oldest I still have around, and it compiles flawless.

    I have removed all linux/ includes as they should come via glibc (via sys/) instead:

    --- hdparm-9.64/hdparm.c
    +++ hdparm-9.64/hdparm.c
    @@ -24,9 +24,6 @@
     #include <sys/mount.h>
     #include <sys/mman.h>
     #include <sys/user.h>
    -#include <linux/types.h>
    -#include <linux/fs.h>
    -#include <linux/major.h>
     #include <endian.h>
     #include <asm/byteorder.h>
    
     
  • Dirk Mueller

    Dirk Mueller - 2022-08-09

    one option is to make an ifdef around the include of linux/fs.h:

    #ifndef FSCONFIG_SET_FLAG
    #include <linux/fs.h>
    #endif
    
     
  • Mark Lord

    Mark Lord - 2022-09-06
    • status: open --> closed-fixed
     
  • Mark Lord

    Mark Lord - 2022-09-06

    Okay, I'll put that #ifndef in place for v9.65 and hope that it does more good than harm.

    Thanks

     

Log in to post a comment.