[LU-12822] gcc9 support Created: 30/Sep/19  Updated: 19/Apr/23

Status: Reopened
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.14.0

Type: Bug Priority: Trivial
Reporter: Alex Zhuravlev Assignee: Alex Zhuravlev
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

gcc9 introduced new checks:

  • address-of-packed-member
  • missing-attributes
    it's easier to disable those for a while..


 Comments   
Comment by Gerrit Updater [ 30/Sep/19 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36321
Subject: LU-12822 build: disable couple checks with gcc9
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 3818d9446e691fb634ee7fa03b5592a21f3088bb

Comment by James A Simmons [ 16/Nov/19 ]

I also ran into this problem and have fixes for it. The problem is in the UAPI headers which means even if lustre works around this issue with gcc flags external applications like robin hood could end up being unbuildable. I have worked out fixes for most things. Since I see this on Ubuntu 19.10 I also see issues with statx which breaks the tree but you might not see that.

Comment by Gerrit Updater [ 19/Nov/19 ]

James Simmons (jsimmons@infradead.org) uploaded a new patch: https://review.whamcloud.com/36798
Subject: LU-12822 uapi: properly pack data structures
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: d56fd0c98b338dfe51220f0ad6b8cb0fd1bbcc6a

Comment by Gerrit Updater [ 28/Jan/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36798/
Subject: LU-12822 uapi: properly pack data structures
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 4751e4a951975e7fa5fa8de893224f9cc03f4165

Comment by James A Simmons [ 28/Jan/20 ]

The patch landed but we should keep a eye out for any additonal breakage since working with gcc 9 is uncommon.

Comment by Alex Zhuravlev [ 29/Jan/20 ]

I do all my local testing on Fedora 30 which is gcc9-based, so will report any issue.

Comment by Alex Zhuravlev [ 29/Jan/20 ]

OK, I've just tried w/o the original (silly) patch dropped, here is a small snippet:

In file included from /home/alexey/head2/ldiskfs/super.c:20:
include/linux/module.h:132:6: error: ‘init_module’ specifies less restrictive attribute than its target ‘ldiskfs_init_fs’: ‘cold’ [-Werror=missing-attributes]
  132 |  int init_module(void) __attribute__((alias(#initfn)));
      |      ^~~~~~~~~~~
/home/alexey/head2/ldiskfs/super.c:6003:1: note: in expansion of macro ‘module_init’
 6003 | module_init(ldiskfs_init_fs)
      | ^~~~~~~~~~~
/home/alexey/head2/ldiskfs/super.c:5930:19: note: ‘init_module’ target declared here
 5930 | static int __init ldiskfs_init_fs(void)
      |                   ^~~~~~~~~~~~~~~
Comment by Alex Zhuravlev [ 29/Jan/20 ]

so I'm back with that patch

Comment by Peter Jones [ 09/Sep/20 ]

simmonsja bzzz is there still work needed here? I don't see any unlanded patches...

Comment by Alex Zhuravlev [ 09/Sep/20 ]

well, I still can't build master with gcc9

Comment by James A Simmons [ 09/Sep/20 ]

I wonder what the default flags are for fedora. I'm using 

gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)

What are the build failures you are still seeing?

Comment by Alex Zhuravlev [ 09/Sep/20 ]

here is example:

In file included from /home/alexey/head1/ldiskfs/super.c:20:
include/linux/module.h:132:6: error: ‘init_module’ specifies less restrictive attribute than its target ‘ldiskfs_init_fs’: ‘cold’ [-Werror=missing-attributes]
  132 |  int init_module(void) __attribute__((alias(#initfn)));
      |      ^~~~~~~~~~~
/home/alexey/head1/ldiskfs/super.c:6003:1: note: in expansion of macro ‘module_init’
 6003 | module_init(ldiskfs_init_fs)
      | ^~~~~~~~~~~
/home/alexey/head1/ldiskfs/super.c:5930:19: note: ‘init_module’ target declared here
 5930 | static int __init ldiskfs_init_fs(void)
      |                   ^~~~~~~~~~~~~~~
In file included from /home/alexey/head1/ldiskfs/super.c:20:
Comment by James A Simmons [ 09/Sep/20 ]

Is it only ldiskfs? Also what ldiskfs series is being use on Fedora?

Comment by James A Simmons [ 11/Apr/23 ]

We just ran into this issue with the lustre test module kinode.c. It appears to be related to https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b999ae3614d09d97a1575936bcee884f912b10e

Also MOFED doesn't seem to build with gcc 9 as well

Comment by Jian Yu [ 19/Apr/23 ]

Building master branch with gcc 9.2.1 on RHEL 8.6 failed as follows:

# gcc --version | head -1
gcc (GCC) 9.2.1 20191120 (Red Hat 9.2.1-2)
# git clone git://git.whamcloud.com/fs/lustre-release.git
# cd lustre-release/
# sh autogen.sh
# ./configure --disable-server --with-linux=/usr/src/kernels/4.18.0-372.32.1.el8_6.x86_64
# make -j $(nproc)
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c: In function ‘kiblnd_unpack_rd’:
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:147:13: error: taking address of packed member of ‘struct kib_rdma_desc’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  147 |   __swab32s(&rd->rd_key);
      |             ^~~~~~~~~~~
<~snip~>
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c: In function ‘kiblnd_unpack_msg’:
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:264:13: error: taking address of packed member of ‘struct kib_msg’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  264 |   __swab64s(&msg->ibm_srcnid);
      |             ^~~~~~~~~~~~~~~~
<~snip~>
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c: At top level:
/usr/src/kernels/4.18.0-372.32.1.el8_6.x86_64/include/linux/module.h:129:6: error: ‘init_module’ specifies less restrictive attribute than its target ‘ko2iblnd_init’: ‘cold’ [-Werror=missing-attributes]
  129 |  int init_module(void) __attribute__((alias(#initfn)));
      |      ^~~~~~~~~~~
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:3908:1: note: in expansion of macro ‘module_init’
 3908 | module_init(ko2iblnd_init);
      | ^~~~~~~~~~~
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:3888:19: note: ‘init_module’ target declared here
 3888 | static int __init ko2iblnd_init(void)
      |                   ^~~~~~~~~~~~~
<~snip~>
                 from /root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:38:
/usr/src/kernels/4.18.0-372.32.1.el8_6.x86_64/include/linux/module.h:135:7: error: ‘cleanup_module’ specifies less restrictive attribute than its target ‘ko2iblnd_exit’: ‘cold’ [-Werror=missing-attributes]
  135 |  void cleanup_module(void) __attribute__((alias(#exitfn)));
      |       ^~~~~~~~~~~~~~
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:3909:1: note: in expansion of macro ‘module_exit’
 3909 | module_exit(ko2iblnd_exit);
      | ^~~~~~~~~~~
/root/lustre-release/lnet/klnds/o2iblnd/o2iblnd.c:3883:20: note: ‘cleanup_module’ target declared here
 3883 | static void __exit ko2iblnd_exit(void)
      |                    ^~~~~~~~~~~~~
<~snip~>
  CC [M]  /root/lustre-release/libcfs/libcfs/module.o
  CC [M]  /root/lustre-release/libcfs/libcfs/tracefile.o
In file included from /root/lustre-release/libcfs/libcfs/module.c:32:
include/linux/module.h:129:6: error: ‘init_module’ specifies less restrictive attribute than its target ‘libcfs_init’: ‘cold’ [-Werror=missing-attributes]
  129 |  int init_module(void) __attribute__((alias(#initfn)));
      |      ^~~~~~~~~~~
/root/lustre-release/libcfs/libcfs/module.c:962:1: note: in expansion of macro ‘module_init’
  962 | module_init(libcfs_init);
      | ^~~~~~~~~~~
/root/lustre-release/libcfs/libcfs/module.c:847:19: note: ‘init_module’ target declared here
  847 | static int __init libcfs_init(void)
      |                   ^~~~~~~~~~~
In file included from /root/lustre-release/libcfs/libcfs/module.c:32:
include/linux/module.h:135:7: error: ‘cleanup_module’ specifies less restrictive attribute than its target ‘libcfs_exit’: ‘cold’ [-Werror=missing-attributes]
  135 |  void cleanup_module(void) __attribute__((alias(#exitfn)));
      |       ^~~~~~~~~~~~~~
/root/lustre-release/libcfs/libcfs/module.c:963:1: note: in expansion of macro ‘module_exit’
  963 | module_exit(libcfs_exit);
      | ^~~~~~~~~~~
/root/lustre-release/libcfs/libcfs/module.c:918:20: note: ‘cleanup_module’ target declared here
  918 | static void __exit libcfs_exit(void)
      |                    ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:317: /root/lustre-release/libcfs/libcfs/module.o] Error 1

 

Comment by Jian Yu [ 19/Apr/23 ]

Building the same codes with gcc 9.4.0 on Ubuntu 20.04.5 with kernel 5.4.0-135-generic passed.

Comment by Jian Yu [ 19/Apr/23 ]

I'm trying to build and install gcc 9.4.0 on RHEL 8.6 to see how the Lustre client build goes.

Comment by Jian Yu [ 19/Apr/23 ]

Hit the same failures with gcc 9.4.0 on RHEL 8.6 with kernel 4.18.0-372.32.1.el8_6.

Comment by Jian Yu [ 19/Apr/23 ]

It appears to be related to https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b999ae3614d09d97a1575936bcee884f912b10e

So the -Werror=missing-attributes issue was fixed in kernel v5.0-rc7.

Generated at Sat Feb 10 02:55:57 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.