Bug 1039538

Summary: Virtualbox fails to build with gcc7
Product: [openSUSE] openSUSE Tumbleweed Reporter: Dominique Leuenberger <dimstar>
Component: Virtualization:OtherAssignee: Larry Finger <Larry.Finger>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P2 - High CC: dimstar
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 Dominique Leuenberger 2017-05-17 14:39:43 UTC
Reference log: https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:C:DVD/virtualbox/standard/x86_64

openSUSE is in progress to migrate to GCC7 as the default compiler - this is supposedly happening very soon.

Virtualbox is one of the remaining ring packages that fails to build in this setup:

[   91s] Checking for gcc: 
[   91s]   ** gcc version 7.0 found, expected gcc 4.x, gcc 5.x or gcc 6.x!
[   91s] Check /home/abuild/rpmbuild/BUILD/VirtualBox-5.1.22/configure.log for details
[   91s] error: Bad exit status from /var/tmp/rpm-tmp.mo22p3 (%build)
Comment 1 Larry Finger 2017-05-17 15:40:28 UTC
I think I have a fix for the problem. What "osc build" magic should I use to test locally?
Comment 2 Dominique Leuenberger 2017-05-17 16:02:33 UTC
(In reply to Larry Finger from comment #1)
> I think I have a fix for the problem. What "osc build" magic should I use to
> test locally?

You can do:

> osc build --alternative-project=openSUSE:Factory:Staging:C:DVD standard x86_64 virtualbox.spec

while being in the directory of the checked out / fixed package
Comment 3 Larry Finger 2017-05-17 21:50:03 UTC
Thanks for the command for osc. Logging it here so as to have a place to find it again. The command was

osc build --clean --alternative-project=openSUSE:Factory:Staging:C:DVD standard x86_64 virtualbox.spec

It took a couple of simple changes, but now VB builds with gcc 7.x. Besides the configure error you found, there was one non-void function that ended with a jump. The new gcc required a "return 0" even though it would never be executed. There are a lot of new warnings, but no more errors.

I have committed the gcc 7 change along with a small revision in the VNC build, with created request id 495753.