Bug #3598


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

Added by laforge over 5 years ago. Updated over 4 years ago.

Target version:
Start date:
Due date:
% Done:


Spec Reference:
Actions #1

Updated by laforge over 5 years 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

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

For the full example, see,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.

Actions #2

Updated by osmith about 5 years 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 to enforce having the same standard everywhere.

See also:
Actions #3

Updated by osmith over 4 years ago

I ran into a similar problem, and proposed to set the dialect in CFLAGS and CXXFLAGS for all projects:

Actions #4

Updated by osmith over 4 years ago

  • % Done changed from 20 to 90
Actions #5

Updated by osmith over 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 90 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)