Project

General

Profile

Bug #3598

jenkins "master" jobs use different compile flags than "gerrit" build verification

Added by laforge 4 months ago. Updated about 1 month ago.

Status:
In Progress
Priority:
Normal
Assignee:
Target version:
-
Start date:
09/25/2018
Due date:
% Done:

20%

Spec Reference:

History

#1 Updated by laforge 4 months ago

  • Status changed from In Progress to New
  • Assignee set to osmith

I recently merged Change-Id I61997a3668cc3a40d12ca023272f6d782e6fbefe which adds code that uses constructs like "for (int i = 0; i < foo; i++)". Our gerrit build verification jobs had no problem with that, the patch got V+1 and I merged it.

Now the "master" jobs are failing like this:

osmo-config-merge.c: In function 'file_read':
osmo-config-merge.c:148:4: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    for (int i = 0; i < cur_indent - indent; i++) {
    ^
osmo-config-merge.c:148:4: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your
code

so somehow the C standard / compiler flags between gerrit and master builds appear to be different.

For the full example, see https://jenkins.osmocom.org/jenkins/job/master-osmo-sgsn/IU=--enable-iu,a2=default,a3=default,label=osmocom-master-debian9/5782/display/redirect [dead link, already cleaned up]

We should fix this to ensure nothing passes gerrit build verification but later fails after being merged to master.

#2 Updated by osmith about 1 month ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 20

libosmocore is not built inside Docker (unlike some other Osmocom projects). So the buildbot's host GCC is used.

We have Debian 8 (jessie) and 9 (stretch) based build bots. Looking at the gcc versions:

  • jessie (8) has GCC 4.x
  • stretch (9) has GCC 6.x

In GCC-5, the default value for -std changed:

GCC defaults to -std=gnu11 instead of -std=gnu89.

So as I understand, in gerrit, your patches were compiled by chance with GCC-6.x on Debian stretch, and then in master with GCC-4.x where it complained about using C99 syntax.

We can probably set -std=... somewhere in the Makefiles.am to enforce having the same standard everywhere.

See also:

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)