Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 839753 - www-client/firefox doesn't compile with USE="-clang"
Summary: www-client/firefox doesn't compile with USE="-clang"
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-20 21:30 UTC by Bartek Stalewski
Modified: 2022-04-23 07:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info + build.log, bzipped. (bug_data.txt.bz2,333.15 KB, application/x-bzip2)
2022-04-20 21:30 UTC, Bartek Stalewski
Details
build.log without -fno-delete-null-pointer-checks -fno-lifetime-dse flags (build-with-new-cflags.txt.bz2,341.93 KB, application/x-bzip2)
2022-04-21 13:35 UTC, Bartek Stalewski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bartek Stalewski 2022-04-20 21:30:18 UTC
Created attachment 772202 [details]
emerge --info + build.log, bzipped.

I'm trying to compile firefox with only gcc and it fails. The build.log doesn't really gives me a clue, why. I was also told on IRC it should go there. Build log and emerge --info output attached.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-20 21:48:17 UTC
 8:12.95 In file included from Unified_cpp_dom_base10.cpp:74:
 8:12.95 /var/tmp/portage/www-client/firefox-99.0.1/work/firefox-99.0.1/dom/base/nsTreeSanitizer.cpp:635:20: error: non-constant condition for static assertion
 8:12.95   635 | static_assert(AllOf(std::begin(kURLAttributesSVG), std::end(kURLAttributesSVG),
 8:12.95       |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 8:12.95   636 |                     [](auto aURLAttributeSVG) {
 8:12.95       |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 8:12.96   637 |                       return AnyOf(std::begin(kAttributesSVG),
 8:12.96       |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 8:12.96   638 |                                    std::end(kAttributesSVG),
 8:12.96       |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~
 8:12.96   639 |                                    [&](auto aAttributeSVG) {
 8:12.96       |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~
 8:12.96   640 |                                      return aAttributeSVG == aURLAttributeSVG;
 8:12.96       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 8:12.97   641 |                                    });
 8:12.97       |                                    ~~~
 8:12.97   642 |                     }));
 8:12.97       |                     ~~
 8:12.97 /var/tmp/portage/www-client/firefox-99.0.1/work/firefox-99.0.1/dom/base/nsTreeSanitizer.cpp:635:20:   in 'constexpr' expansion of 'mozilla::AllOf<const nsStaticAtom* const*, <lambda(auto:30)> >(std::begin<const nsStaticAtom* const, 2>(kURLAttributesSVG), std::end<const nsStaticAtom* const, 2>(kURLAttributesSVG), (<lambda closure object><lambda(auto:30)>{}, <lambda(auto:30)>()))'
 8:12.97 /var/tmp/portage/www-client/firefox-99.0.1/work/firefox_build/dist/include/mozilla/Algorithm.h:24:15:   in 'constexpr' expansion of 'aPred.<lambda(auto:30)>(((const nsStaticAtom*)(* aFirst)))'
 8:12.97 /var/tmp/portage/www-client/firefox-99.0.1/work/firefox-99.0.1/dom/base/nsTreeSanitizer.cpp:637:35:   in 'constexpr' expansion of 'mozilla::AnyOf<const nsStaticAtom* const*, <lambda(auto:30)>::<lambda(auto:31)> >(std::begin<const nsStaticAtom* const, 182>(kAttributesSVG), std::end<const nsStaticAtom* const, 182>(kAttributesSVG), <lambda closure object><lambda(auto:30)>::<lambda(auto:31)>{aURLAttributeSVG})'
 8:12.97 /var/tmp/portage/www-client/firefox-99.0.1/work/firefox-99.0.1/dom/base/nsTreeSanitizer.cpp:640:59: error: '((& mozilla::detail::gGkAtoms.mozilla::detail::GkAtoms::mAtoms[1553]) == 0)' is not a constant expression
 8:12.98   640 |                                      return aAttributeSVG == aURLAttributeSVG;
 8:12.98       |                                             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-20 21:49:27 UTC
>CFLAGS="-march=native -O2 -pipe -fno-delete-null-pointer-checks -fno-lifetime-dse"

Out of interest, and I don't think it should make a difference, what happens if you drop the latter two flags?
Comment 4 Joonas Niilola gentoo-dev 2022-04-21 07:11:15 UTC
I can't really pinpoint the exact error either. Try again, then try with clean CFLAGs, then with -system-libvpx and/or -system-av1 as they're often causing some troubles etc. 

You seem to have these rather uncommon flags system-wide so I imagine some dependency might be acting weirdly.
Comment 5 Bartek Stalewski 2022-04-21 13:34:18 UTC
(In reply to Sam James from comment #2)
> >CFLAGS="-march=native -O2 -pipe -fno-delete-null-pointer-checks -fno-lifetime-dse"
> 
> Out of interest, and I don't think it should make a difference, what happens
> if you drop the latter two flags?

I've did it and it still failing, but with different error. I can't post a link, I will try to attach new build.log.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-21 13:35:16 UTC
(In reply to Joonas Niilola from comment #4)
> I can't really pinpoint the exact error either. Try again, then try with
> clean CFLAGs, then with -system-libvpx and/or -system-av1 as they're often
> causing some troubles etc. 

Exact error is in my paste (took a while to find) but not sure why it's only happening for them.
Comment 7 Bartek Stalewski 2022-04-21 13:35:51 UTC
Created attachment 772628 [details]
build.log without  -fno-delete-null-pointer-checks -fno-lifetime-dse flags
Comment 8 Joonas Niilola gentoo-dev 2022-04-21 13:45:08 UTC
(In reply to Sam James from comment #6)
> (In reply to Joonas Niilola from comment #4)
> > I can't really pinpoint the exact error either. Try again, then try with
> > clean CFLAGs, then with -system-libvpx and/or -system-av1 as they're often
> > causing some troubles etc. 
> 
> Exact error is in my paste (took a while to find) but not sure why it's only
> happening for them.

I mean yes I found the error but I can't say exactly what's causing it :) sometimes it's clear (often not though)

(In reply to Bartek Stalewski from comment #7)
> Created attachment 772628 [details]
> build.log without  -fno-delete-null-pointer-checks -fno-lifetime-dse flags

12:44.21 x86_64-pc-linux-gnu-g++: fatal error: Killed signal terminated program cc1plus
12:44.21 compilation terminated.

This most often means you're running out of memory, or other kind of hardware issues. Check your system log (dmesg, journalctl, /var/log/messages)

Try lowering your MAKEOPTS to first 6, then maybe 4 if it still fails?
Comment 9 Bartek Stalewski 2022-04-21 14:06:59 UTC
> 12:44.21 x86_64-pc-linux-gnu-g++: fatal error: Killed signal terminated
> program cc1plus
> 12:44.21 compilation terminated.
> 
> This most often means you're running out of memory, or other kind of
> hardware issues. Check your system log (dmesg, journalctl, /var/log/messages)
> 
> Try lowering your MAKEOPTS to first 6, then maybe 4 if it still fails?

I don't know how I missed OOM... ;-) Running with -j6 now, we will see.
Comment 10 Bartek Stalewski 2022-04-21 16:45:20 UTC
I was able to build with USE="-clang" when I deleted '-fno-delete-null-pointer-checks -fno-lifetime-dse' from my CFLAGS.

So, was this my fault all the time and this bug should be closed as invalid? ;-)
Comment 11 Joonas Niilola gentoo-dev 2022-04-23 07:46:30 UTC
Well maybe we could guard against flags known to break the compilation, but... that's gonna be an endless cycle. 

Thanks for the update though!

FYI I used to build firefox with pretty wild CFLAGS but of course it broke down each release so just sticking with the "vanilla" flags for now.

$ cat /etc/portage/env/firefox.conf 
CFLAGS="-march=native -O3 -pipe -fno-sized-deallocation -fno-aligned-new -fno-strict-aliasing -fPIC -fno-math-errno -fno-exceptions"

$ cat /etc/portage/env/firefox2.conf 
# these don't work with clang/lld:
#  -fdata-sec (configure doesn't recognize it),
#  -Wl,-  plugin-opt=-import-instr-limit=10 (dies in linking phase).
CFLAGS="-march=native -O3 -pipe -flto=thin -fexperimental-new-pass-manager -Wl,--gc-sections -Wl,-plugin-opt=new-pass-manager -Wl,-plugin-opt=-import-hot-multiplier=30 -ffunction-sections"
#CFLAGS="-march=native -O3 -pipe -fno-sized-deallocation -fno-aligned-new -fno-strict-aliasing -fPIC -fno-math-errno -fno-exceptions"