Bug #3598
closedjenkins "master" jobs use different compile flags than "gerrit" build verification
100%
Updated by laforge about 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 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.
Updated by osmith almost 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 Makefiles.am to enforce having the same standard everywhere.
See also:Updated by osmith about 4 years ago
I ran into a similar problem, and proposed to set the dialect in CFLAGS and CXXFLAGS for all projects:
https://lists.osmocom.org/pipermail/openbsc/2019-September/013030.html
Updated by osmith about 4 years ago
- % Done changed from 20 to 90
This will be resolved with: https://gerrit.osmocom.org/c/osmo-ci/+/15584/7
Updated by osmith about 4 years ago
- Status changed from In Progress to Resolved
- % Done changed from 90 to 100