Closed Bug 1601590 Opened 4 years ago Closed 4 years ago

Can't use --enable-warnings-as-errors on Fedora 30

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(firefox73 fixed)

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: sg, Assigned: sg)

Details

(Keywords: in-triage)

Attachments

(1 file)

When I try to use a mozconfig with

ac_add_options --enable-optimize="-Og"
ac_add_options --enable-warnings-as-errors

I get an error:

 0:01.76 /usr/include/features.h:382:4: error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]

Maybe it is possible to let --enable-warnings-as-errors set _FORTIFY_SOURCE only if --enable-optimize has a compatible settings?

I wasn't able to re-produce this on my machine, can you provide more info about your clang/sysroot or other mozconfig options you might have?

I tried various variants, and I now found that with this mozconfig (nothing else in there):

ac_add_options --enable-optimize="-O2"                                          
ac_add_options --enable-linker=lld                                              
ac_add_options --enable-warnings-as-errors 

doesn't work either, with the same error:

 0:35.28 In file included from /home/simon/work/refactor/memory/replace/dmd/test/SmokeDMD.cpp:16:
 0:35.28 In file included from /home/simon/work/refactor/obj-x86_64-pc-linux-gnu/dist/system_wrappers/errno.h:3:
 0:35.28 In file included from /usr/include/errno.h:25:
 0:35.28 In file included from /home/simon/work/refactor/obj-x86_64-pc-linux-gnu/dist/system_wrappers/features.h:3:
 0:35.28 /usr/include/features.h:382:4: error: _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror,-W#warnings]
 0:35.28 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
 0:35.28    ^

I am on Fedora 30, the clang is the one from .mozbuild, currently clang version 9.0.0. /usr/include/features.h is from glibc-headers-2.29-27.fc30.

SmokeDMD.cpp is force-built with -O0 per memory/replace/dmd/test/moz.build. The check in features.h is kind of controversial, actually, as it has caused multiple problems. You found one more. It was removed in Debian, but stays in Fedora. I guess we could work around with #undef _FORTIFY_SOURCE at the beginning of SmokeDMD.cpp. It's not like it matters in that file.

Summary: Can't use -Og with --enable-warnings-as-errors → Can't use --enable-warnings-as-errors on Fedora 30

Adding #undef _FORTIFY_SOURCE fixes the issue, and since you say this doesn't matter I will submit a patch to add that.

This is required on some systems such as Fedora to allow
building with -O0 together with --warnings-as-errors due to

a check in /usr/include/features.h

Assignee: nobody → sgiesecke
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3dc9cd6dfb53
Undef _FORTIFY_SOURCE to fix build with --warnings-on-errors. r=glandium
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: