Firefox 128.0 doesn't compile with flag -fexceptions (up to 127.0.2 it did)
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
People
(Reporter: andreas.thalhammer, Unassigned)
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Steps to reproduce:
I just wanted to report that up until Firefox 127.0.2 I was able to compile and use Firefox on Gentoo Linux with gcc and clang using "-fexceptions" in my global CFLAGS. Starting with Version 128.0 this no longer works.
I see the following lines in the build log (attached):
error: #error "STL code can only be used with -fno-exceptions"
| Reporter | ||
Comment 1•2 years ago
|
||
The only other bug I could find about -fexceptions is a very old one from Firefox 3.7, Bug #512190.
Comment 2•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Reporter | ||
Comment 3•2 years ago
|
||
All builds up until 127.0.2 were successful and I was using Firefox daily, with those global CFLAGS:
CFLAGS="-march=znver3 -O2 -pipe -fstack-protector-strong -fno-plt -fexceptions -fcf-protection"
| Reporter | ||
Comment 4•2 years ago
|
||
This is the buildlog of Firefox 128.0 with the -fexceptions CFLAG removed. As it was pointed out to me by Gentoo developers, setting -fexceptions globally wasn't a great idea to begin with. Still, I do find it noteworthy that Firefox was running stable and I was using it daily WITH this CFLAG for quite some time, and that 128.0 is the first version that doesn't compile.
I thought you should know.
Relevant Gentoo bug, where I reported my finding: https://bugs.gentoo.org/show_bug.cgi?id=925101
This Gentoo bug report is not about -fexceptions, but about the build failure with certain Mesa versions that I also experienced. My endeavour with 128.0 starts at comment #43.
Again, this Mozilla bug report is for your information only. I'm assuming that Mozilla doesn't support -fexceptions anyhow, so this is FYI that it used to work nonetheless until Firefox 127.0.2.
Comment 5•2 years ago
|
||
Not sure which component is that but not Widget/Gtk. Not sure if we should or should not pass global '-fexceptions' flag, I removed that from Fedora builds due to this error. I noticed that some Firefox parts have explicit '-fexceptions' / '-fno-exceptions' flag.
Mike, any insight here?
Thanks.
Comment 6•2 years ago
|
||
It sounds like -fexceptions ended up before -fno-exceptions and thus was cancelled out before, and that's not the case anymore. I'd say the current behavior is actually better, making you know your flags are not doing what you think they're doing.
Comment 7•2 years ago
|
||
No, actually -fno-exceptions was removed from wrapper.cpp so -fexceptions from system settings is used.
Comment 9•2 years ago
|
||
It can be reproduced with various code. There's one example:
3:22.73 /usr/bin/g++ -o Unified_cpp_js_src_debugger0.o -c -I/raid/CVS/firefox/firefox-128.0/objdir/dist/stl_wrappers -I/raid/CVS/firefox/firefox-128.0/objdir/dist/system_wrappers -include /raid/CVS/firefox/firefox-128.0/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 -DWASM_SUPPORTS_HUGE_MEMORY -DJS_HAS_CTYPES -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/raid/CVS/firefox/firefox-128.0/js/src/debugger -I/raid/CVS/firefox/firefox-128.0/objdir/js/src/debugger -I/raid/CVS/firefox/firefox-128.0/objdir/js/src -I/raid/CVS/firefox/firefox-128.0/js/src -I/raid/CVS/firefox/firefox-128.0/objdir/dist/include -I/usr/include/nspr4 -I/usr/include/nss3 -I/usr/include/nspr4 -I/raid/CVS/firefox/firefox-128.0/objdir/dist/include/nss -DWITH_GZFILEOP -I/usr/include/pixman-1 -DMOZILLA_CLIENT -include /raid/CVS/firefox/firefox-128.0/objdir/js/src/js-confdefs.h -fno-rtti -pthread -fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections -fno-math-errno -fno-exceptions -O2 -fexceptions -g1 -grecord-gcc-switches -pipe -Wno-complain-wrong-lang -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fpermissive -DNSS_PKCS11_3_0_STRICT -fPIC -O3 -fomit-frame-pointer -funwind-tables -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wno-invalid-offsetof -Wcomma-subscript -Wvolatile -Wno-deprecated-enum-enum-conversion -Wduplicated-cond -Wimplicit-fallthrough -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-multistatement-macros -Wno-error=class-memaccess -Wformat -Wformat-overflow=2 -Wno-psabi -Wno-error=builtin-macro-redefined -Werror=format -Wno-attributes -fno-strict-aliasing -ffp-contract=off -MD -MP -MF .deps/Unified_cpp_js_src_debugger0.o.pp Unified_cpp_js_src_debugger0.cpp
3:22.73 js/src/debugger/Unified_cpp_js_src_debugger1.o
3:22.76 gmake[4]: Leaving directory '/raid/CVS/firefox/firefox-128.0/objdir/image/encoders/png'
3:22.77 In file included from /usr/include/c++/14/stdlib.h:36,
3:22.77 from /raid/CVS/firefox/firefox-128.0/objdir/dist/system_wrappers/stdlib.h:3,
3:22.77 from /raid/CVS/firefox/firefox-128.0/objdir/dist/include/mozilla/Assertions.h:69,
3:22.77 from /raid/CVS/firefox/firefox-128.0/objdir/dist/include/mozilla/Casting.h:12,
3:22.77 from /raid/CVS/firefox/firefox-128.0/js/src/jstypes.h:24,
3:22.77 from /raid/CVS/firefox/firefox-128.0/js/src/debugger/DebugScript.h:14,
3:22.77 from /raid/CVS/firefox/firefox-128.0/js/src/debugger/DebugScript.cpp:7,
3:22.77 from Unified_cpp_js_src_debugger0.cpp:2:
3:22.77 /raid/CVS/firefox/firefox-128.0/objdir/dist/stl_wrappers/cstdlib:12:4: error: #error "STL code can only be used with -fno-exceptions"
3:22.77 12 | # error "STL code can only be used with -fno-exceptions"
3:22.77 | ^~~~~
Let's break it down.
This part comes from Mozilla build config:
3:22.73 /usr/bin/g++ -o Unified_cpp_js_src_debugger0.o -c -I/raid/CVS/firefox/firefox-128.0/objdir/dist/stl_wrappers -I/raid/CVS/firefox/firefox-128.0/objdir/dist/system_wrappers -include /raid/CVS/firefox/firefox-128.0/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 -DWASM_SUPPORTS_HUGE_MEMORY -DJS_HAS_CTYPES -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/raid/CVS/firefox/firefox-128.0/js/src/debugger -I/raid/CVS/firefox/firefox-128.0/objdir/js/src/debugger -I/raid/CVS/firefox/firefox-128.0/objdir/js/src -I/raid/CVS/firefox/firefox-128.0/js/src -I/raid/CVS/firefox/firefox-128.0/objdir/dist/include -I/usr/include/nspr4 -I/usr/include/nss3 -I/usr/include/nspr4 -I/raid/CVS/firefox/firefox-128.0/objdir/dist/include/nss -DWITH_GZFILEOP -I/usr/include/pixman-1 -DMOZILLA_CLIENT -include /raid/CVS/firefox/firefox-128.0/objdir/js/src/js-confdefs.h -fno-rtti -pthread -fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections -fno-math-errno -fno-exceptions
this comes from Fedora RPM build flags via CXXFLAGS:
-O2 -fexceptions -g1 -grecord-gcc-switches -pipe -Wno-complain-wrong-lang -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fpermissive -DNSS_PKCS11_3_0_STRICT
Mozilla build flags again:
-fPIC -O3 -fomit-frame-pointer -funwind-tables -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wno-invalid-offsetof -Wcomma-subscript -Wvolatile -Wno-deprecated-enum-enum-conversion -Wduplicated-cond -Wimplicit-fallthrough -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-multistatement-macros -Wno-error=class-memaccess -Wformat -Wformat-overflow=2 -Wno-psabi -Wno-error=builtin-macro-redefined -Werror=format -Wno-attributes -fno-strict-aliasing -ffp-contract=off -MD -MP -MF .deps/Unified_cpp_js_src_debugger0.o.pp Unified_cpp_js_src_debugger0.cpp
The difference between 127.0 and 128.0 is that second Mozilla build flags began with -fno-exceptions:
-fno-exceptions -fPIC -O3 -fomit-frame-pointer -funwind-tables ....
Comment 10•2 years ago
|
||
I can attach full build log if required. Fedora build flags are:
+ CFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '
+ export CFLAGS
+ CXXFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '
+ export CXXFLAGS
+ FFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules '
+ export FFLAGS
+ FCFLAGS='-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules '
+ export FCFLAGS
+ VALAFLAGS=-g
+ export VALAFLAGS
+ RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn'
+ export RUSTFLAGS
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 '
+ export LDFLAGS
+ LT_SYS_LIBRARY_PATH=/usr/lib64:
+ export LT_SYS_LIBRARY_PATH
+ CC=gcc
+ export CC
+ CXX=g++
+ export CXX
Comment 11•2 years ago
|
||
Looking at -DNSS_PKCS11_3_0_STRICT it may be possible that -fno-exceptions comes from system nss/nspr packages used by Fedora build.
| Reporter | ||
Comment 12•2 years ago
|
||
Just out of curiosity: what's the difference between a) the use of -fexceptions in the previous build system (of 127.0.2), where it is apparently removed and -fno-exceptions is used where needed, and b) not using -fexceptions in all code (like in 128.0)?
Comment 13•2 years ago
|
||
In 127.0.2, if you set CXXFLAGS=-fexceptions, config.status ends up with:
'OS_CXXFLAGS': [ '-fno-sized-deallocation',
'-fno-aligned-new',
'-fexceptions',
'-fno-exceptions',
'-fPIC',
'-fno-rtti',
'-ffunction-sections',
'-fdata-sections',
'-fno-exceptions',
'-fno-math-errno',
'-pthread'],
IOW, -fexceptions is not going to have any effect whatsoever. It's as if it weren't there.
In 128, it ends up with:
'OS_CXXFLAGS': [ '-fno-rtti',
'-pthread',
'-fno-sized-deallocation',
'-fno-aligned-new',
'-fno-math-errno',
'-fno-exceptions',
'-fexceptions',
'-fno-exceptions',
'-fPIC'],
which... ends up doing the same.
BUT. Things are different in js/src/config.status:
127.0.2:
'OS_CXXFLAGS': [ '-fno-sized-deallocation',
'-fno-aligned-new',
'-fexceptions',
'-fPIC',
'-fno-rtti',
'-fno-exceptions',
'-fno-math-errno',
'-pthread'],
128.0:
'OS_CXXFLAGS': [ '-fno-rtti',
'-pthread',
'-fno-sized-deallocation',
'-fno-aligned-new',
'-fno-math-errno',
'-fno-exceptions',
'-fexceptions',
'-fPIC'],
Note how -fexception comes after -fno-exceptions now. That's why you see failures in files containing the string js_src in their name.
So comment 6 appears correct, mostly.
Comment 14•2 years ago
|
||
Note that on mozilla-central, it ends up after in config.status too.
| Reporter | ||
Comment 15•2 years ago
|
||
Thanks for the clarification! So 128.0 actually uses -fexceptions for the first time and the build fails with it, as it would have been before, if it hadn't been cancelled out.
Who is even using -fexceptions globally (besides me)? If this is something that should be addressed, maybe a warning and then removing this CFLAG would be a doable compromise. Or, you want people to see that using this globally is a very very bad idea anyway, so leave it and have them see their mistake.
Description
•