Bug 1031340

Summary: qemu fails to build with GCC 7
Product: [openSUSE] openSUSE Tumbleweed Reporter: Martin Liška <martin.liska>
Component: KVMAssignee: Liang Yan <lyan>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: brogers, martin.liska
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 1030236    

Description Martin Liška 2017-03-28 12:34:37 UTC
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/qemu/standard/x86_64

[  528s] drivers/net/igbvf/igbvf_vf.c: In function 'igbvf_promisc_set_vf':
[  528s] drivers/net/igbvf/igbvf_vf.c:359:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
[  528s]    msgbuf |= E1000_VF_SET_PROMISC_MULTICAST;
[  528s] drivers/net/igbvf/igbvf_vf.c:360:2: note: here
[  528s]   case e1000_promisc_unicast:
[  528s]   ^~~~

Can be tested in openSUSE:Factory:Staging:Gcc7 project.
Comment 1 Liang Yan 2017-03-28 19:50:01 UTC
That is because GCC7 enables -Wimplicit-fallthrough now.

According to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

-Wimplicit-fallthrough

    -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.

There are usually two options to fix it:
1. add /* fall through*/ comment in source code, which follows level 3 rule.

2. add -Wno-implicit-fallthrough in Makefile cflags


Also found upstream pending patch followed option 2 above,
https://www.mail-archive.com/ipxe-devel@lists.ipxe.org/msg05329.html

I will try to work with upstream to see if they are gonna accept it or have other options.
Comment 2 Liang Yan 2017-04-06 18:29:25 UTC
Got patch from upstream to fix this.
https://git.ipxe.org/ipxe.git/patch/5f85cbb

I tested from my local environment, could build qemu package by GCC7.

BTW, something wrong with openSUSE:Factory:Rings:2-TestDVD, I branched qemu from there but could build through.

Will upload the patch to factory soon.
Comment 3 Liang Yan 2017-04-14 16:08:21 UTC
Hi, Martin

A fix(ipxe-build-Avoid-implicit-fallthrough-warnings-on-GCC-7.patch) is included in our repo: https://build.suse.de/package/show/Devel:Virt:SLE-12-SP3/qemu

Could you run a re-test based on the new update and let us know if could build through or not? Thanks.
Comment 4 Martin Liška 2017-04-20 07:27:45 UTC
(In reply to Liang Yan from comment #3)
> Hi, Martin
> 
> A fix(ipxe-build-Avoid-implicit-fallthrough-warnings-on-GCC-7.patch) is
> included in our repo:
> https://build.suse.de/package/show/Devel:Virt:SLE-12-SP3/qemu
> 
> Could you run a re-test based on the new update and let us know if could
> build through or not? Thanks.

Currently the OBS project seems broken due to a conflict, please notify me once it's fixed and I'll test that.
Comment 5 Bruce Rogers 2017-04-20 21:21:29 UTC
(In reply to Martin Liška from comment #4)
> (In reply to Liang Yan from comment #3)
> > Hi, Martin
> > 
> > A fix(ipxe-build-Avoid-implicit-fallthrough-warnings-on-GCC-7.patch) is
> > included in our repo:
> > https://build.suse.de/package/show/Devel:Virt:SLE-12-SP3/qemu
> > 
> > Could you run a re-test based on the new update and let us know if could
> > build through or not? Thanks.
> 
> Currently the OBS project seems broken due to a conflict, please notify me
> once it's fixed and I'll test that.

I fixed it.
Comment 6 Liang Yan 2017-05-14 16:06:19 UTC
Hi, Martin,

How is your test going? Do you mind if I close it if test goes well? Thanks.
Comment 7 Martin Liška 2017-05-15 09:05:42 UTC
Hi. I'll test that as soon as OBS will be working.
Comment 8 Martin Liška 2017-05-16 09:16:35 UTC
Can't test that as the Staging project does not provide probably all needs:

unresolvable: nothing provides SDL2-devel
      nothing provides brlapi-devel
      nothing provides glusterfs-devel
      nothing provides libfdt-devel
      nothing provides libiscsi-devel
      nothing provides libvdeplug3-devel
      nothing provides ovmf-tools
      nothing provides virglrenderer-devel >= 0.4.1
      nothing provides vte-devel
Comment 9 Liang Yan 2017-05-16 18:47:43 UTC
(In reply to Martin Liška from comment #7)
> Hi. I'll test that as soon as OBS will be working.

Hi, Martin, do you mind to point me a gcc7 environment? I can run some "make" command on source code directly. Thanks.
Comment 10 Martin Liška 2017-05-17 08:22:20 UTC
(In reply to Liang Yan from comment #9)
> (In reply to Martin Liška from comment #7)
> > Hi. I'll test that as soon as OBS will be working.
> 
> Hi, Martin, do you mind to point me a gcc7 environment? I can run some
> "make" command on source code directly. Thanks.

Adding following repository provides gcc7 as a default gcc compiler:
https://build.opensuse.org/project/show/devel:gcc
Comment 11 Liang Yan 2017-05-22 21:45:05 UTC
(In reply to Martin Liška from comment #10)
> (In reply to Liang Yan from comment #9)
> > (In reply to Martin Liška from comment #7)
> > > Hi. I'll test that as soon as OBS will be working.
> > 
> > Hi, Martin, do you mind to point me a gcc7 environment? I can run some
> > "make" command on source code directly. Thanks.
> 
> Adding following repository provides gcc7 as a default gcc compiler:
> https://build.opensuse.org/project/show/devel:gcc

Hi, Martin,

For current QEMU and current bug, I believe it is fixed, and there are a couple more bugs when I am trying to compile a newer QEMU(2.9.0), I create a new bug report:
https://bugzilla.suse.com/show_bug.cgi?id=1040228

so is it OK if we closed this bug here and move to 1040228?
Comment 12 Martin Liška 2017-05-29 09:32:01 UTC
Fixed.