Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 617882 - www-client/firefox-53.0 failed startup cache generation
Summary: www-client/firefox-53.0 failed startup cache generation
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
: 620116 620194 622474 626762 (view as bug list)
Depends on:
Blocks: gcc-7
  Show dependency tree
 
Reported: 2017-05-08 18:23 UTC by josef.95
Modified: 2017-08-30 10:23 UTC (History)
17 users (show)

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


Attachments
emerge --info (emerge--info.txt,6.55 KB, text/plain)
2017-05-08 18:23 UTC, josef.95
Details
full firefox-53.0/temp/build.log (xz compressed) (build.log.xz,190.84 KB, application/x-xz)
2017-05-08 23:51 UTC, josef.95
Details
Firefox Screenshot. (2017-05-25_17-38-15.png,169.13 KB, image/png)
2017-05-26 00:41 UTC, Aric Belsito
Details
Work around the default optimization level of -Os (gcc7-workaround-mozilla.patch,745 bytes, patch)
2017-05-31 20:14 UTC, Jory A. Pratt
Details | Diff
Work around the default optimization level of -Os ver.2 (0001-eclass-mozcoreconf-v5-Work-around-the-default-optimi.patch,1.06 KB, patch)
2017-05-31 20:53 UTC, Jory A. Pratt
Details | Diff
Workaround to disable cachegen (firefox-52.0.1-disable_cachegen.patch,968 bytes, patch)
2017-06-17 17:36 UTC, Steve Arnold
Details | Diff
gcc-7.1.0-PR80706.patch (gcc-7.1.0-PR80706.patch,3.23 KB, patch)
2017-07-24 02:04 UTC, Jory A. Pratt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description josef.95 2017-05-08 18:23:50 UTC
Created attachment 472010 [details]
emerge --info

Hello,
www-client/firefox-53.0 build with gcc-7.1.0 failed here on install phase.


make[1]: Leaving directory '/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff'
>>> Source compiled.
>>> Test phase [not enabled]: www-client/firefox-53.0

>>> Install firefox-53.0 into /var/tmp/portage/www-client/firefox-53.0/image/ category www-client
 * PT_PAX marking -m /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/dist/bin/xpcshell with scanelf
 * XATTR_PAX marking -me /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/dist/bin/xpcshell with setfattr
 * Adding prefs from mozconfig to /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/dist/bin/browser/defaults/preferences/all-gentoo.js
make -j6 -l8 DESTDIR=/var/tmp/portage/www-client/firefox-53.0/image/ install 
make[1]: Entering directory '/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/browser/installer'
OMNIJAR_NAME=omni.ja \
NO_PKG_FILES="core bsdecho js js-config jscpucfg nsinstall viewer TestGtkEmbed elf-dynstr-gc mangle* maptsv* mfc* msdump* msmap* nm2tsv* nsinstall* res/samples res/throbber shlibsign* certutil* pk12util* BadCertServer* OCSPStaplingServer* GenerateOCSPResponse* chrome/chrome.rdf chrome/app-chrome.manifest chrome/overlayinfo components/compreg.dat components/xpti.dat content_unit_tests necko_unit_tests *.dSYM " \
/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/_virtualenv/bin/python /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/toolkit/mozapps/installer/packager.py -DMOZ_APP_NAME=firefox -DPREF_DIR=defaults/preferences -DMOZ_GTK=1 -DMOZ_GTK3=1 -DMOZ_SYSTEM_NSPR=1 -DMOZ_SYSTEM_NSS=1 -DJAREXT= -DMOZ_CHILD_PROCESS_NAME=plugin-container -DDLL_PREFIX=lib -DDLL_SUFFIX=.so -DBIN_SUFFIX= -DDIR_MACOS= -DDIR_RESOURCES= -DBINPATH=bin -DRESPATH=bin -DLPROJ_ROOT=en -DMOZ_ICU_VERSION=58 -DMOZ_SYSTEM_ICU -DMOZ_ICU_DBG_SUFFIX= -DICU_DATA_FILE=icudt58l.dat -DENABLE_MARIONETTE=1 -DA11Y_LOG=1 -DACCESSIBILITY=1 -DATK_MAJOR_VERSION=2 -DATK_MINOR_VERSION=22 -DATK_REV_VERSION=0 -DBUILD_CTYPES=1 -DCROSS_COMPILE='' -DD_INO=d_ino -DENABLE_INTL_API=1 -DENABLE_SYSTEM_EXTENSION_DIRS=1 -DEXPOSE_INTL_API=1 -DFIREFOX_VERSION=53.0 -DFORCE_PR_LOG=1 -DFUNCPROTO=15 -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DGL_PROVIDER_GLX=1 -DHAVE_64BIT_BUILD=1 -DHAVE_ALLOCA_H=1 -DHAVE_BYTESWAP_H=1 -DHAVE_CLOCK_MONOTONIC=1 -DHAVE_CPUID_H=1 -DHAVE_DIRENT_H=1 -DHAVE_DLADDR=1 -DHAVE_DLOPEN=1 -DHAVE_FONTCONFIG_FCFREETYPE_H=1 -DHAVE_FT_BITMAP_SIZE_Y_PPEM=1 -DHAVE_FT_GLYPHSLOT_EMBOLDEN=1 -DHAVE_FT_LOAD_SFNT_TABLE=1 -DHAVE_GETOPT_H=1 -DHAVE_GMTIME_R=1 -DHAVE_I18N_LC_MESSAGES=1 -DHAVE_INTTYPES_H=1 -DHAVE_LANGINFO_CODESET=1 -DHAVE_LCHOWN=1 -DHAVE_LIBPNG=1 -DHAVE_LIBVPX=1 -DHAVE_LIBXSS=1 -DHAVE_LINUX_IF_ADDR_H=1 -DHAVE_LINUX_PERF_EVENT_H=1 -DHAVE_LINUX_QUOTA_H=1 -DHAVE_LINUX_RTNETLINK_H=1 -DHAVE_LOCALECONV=1 -DHAVE_LOCALTIME_R=1 -DHAVE_LSTAT64=1 -DHAVE_MALLINFO=1 -DHAVE_MALLOC_H=1 -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MEMALIGN=1 -DHAVE_MEMMEM=1 -DHAVE_NETINET_IN_H=1 -DHAVE_NL_TYPES_H=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_PTHREAD_H=1 -DHAVE_RES_NINIT=1 -DHAVE_SETPRIORITY=1 -DHAVE_STAT64=1 -DHAVE_STDINT_H=1 -DHAVE_STRERROR=1 -DHAVE_STRNDUP=1 -DHAVE_SYSCALL=1 -DHAVE_SYS_QUEUE_H=1 -DHAVE_SYS_QUOTA_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_THREAD_TLS_KEYWORD=1 -DHAVE_TRUNCATE64=1 -DHAVE_UNISTD_H=1 -DHAVE_VALLOC=1 -DHAVE_VA_COPY=1 -DHAVE_VA_LIST_AS_ARRAY=1 -DHAVE_VISIBILITY_ATTRIBUTE=1 -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -DHAVE__UNWIND_BACKTRACE=1 -DHAVE___CXA_DEMANGLE=1 -DJS_DEFAULT_JITREPORT_GRANULARITY=3 -DMALLOC_H='<malloc.h>' -DMALLOC_USABLE_SIZE_CONST_PTR='' -DMOZILLA_UAVERSION='"53.0"' -DMOZILLA_VERSION='"53.0"' -DMOZILLA_VERSION_U=53.0 -DMOZ_ACCESSIBILITY_ATK=1 -DMOZ_ADDON_SIGNING=1 -DMOZ_APP_UA_NAME='""' -DMOZ_APP_UA_VERSION='"53.0"' -DMOZ_B2G_OS_NAME='""' -DMOZ_B2G_VERSION='"1.0.0"' -DMOZ_BUILD_APP=browser -DMOZ_BUNDLED_FONTS=1 -DMOZ_CRASHREPORTER_ENABLE_PERCENT=100 -DMOZ_DATA_REPORTING=1 -DMOZ_DEFAULT_MOZILLA_FIVE_HOME='"/usr/lib64/firefox"' -DMOZ_DISTRIBUTION_ID='"org.mozilla"' -DMOZ_DLL_SUFFIX='".so"' -DMOZ_ENABLE_DBUS=1 -DMOZ_ENABLE_GIO=1 -DMOZ_ENABLE_MASK_AS_SHORTHAND=1 -DMOZ_ENABLE_PROFILER_SPS=1 -DMOZ_ENABLE_SIGNMAR=1 -DMOZ_ENABLE_SKIA=1 -DMOZ_ENABLE_STARTUP_NOTIFICATION=1 -DMOZ_ENABLE_XREMOTE=1 -DMOZ_FEEDS=1 -DMOZ_FFMPEG=1 -DMOZ_FFVPX=1 -DMOZ_FMP4=1 -DMOZ_GLUE_IN_PROGRAM=1 -DMOZ_GMP_SANDBOX=1 -DMOZ_INSTRUMENT_EVENT_LOOP=1 -DMOZ_JEMALLOC4=1 -DMOZ_JSDOWNLOADS=1 -DMOZ_LIBAV_FFT=1 -DMOZ_LOGGING=1 -DMOZ_MACBUNDLE_ID=org.mozilla.firefox -DMOZ_MEMORY=1 -DMOZ_OFFICIAL_BRANDING=1 -DMOZ_PEERCONNECTION=1 -DMOZ_PERMISSIONS=1 -DMOZ_PHOENIX=1 -DMOZ_PLACES=1 -DMOZ_PULSEAUDIO=1 -DMOZ_RAW=1 -DMOZ_REPLACE_MALLOC=1 -DMOZ_RUST_MP4PARSE=1 -DMOZ_SAMPLE_TYPE_FLOAT32=1 -DMOZ_SANDBOX=1 -DMOZ_SCTP=1 -DMOZ_SECUREELEMENT=1 -DMOZ_SERVICES_HEALTHREPORT=1 -DMOZ_SRTP=1 -DMOZ_STATIC_JS=1 -DMOZ_TREE_CAIRO=1 -DMOZ_TREE_PIXMAN=1 -DMOZ_UPDATE_CHANNEL=default -DMOZ_USER_DIR='".mozilla"' -DMOZ_VORBIS=1 -DMOZ_VPX_NO_MEM_REPORTING=1 -DMOZ_WEBGL_CONFORMANT=1 -DMOZ_WEBM_ENCODER=1 -DMOZ_WEBRTC=1 -DMOZ_WEBRTC_ASSERT_ALWAYS=1 -DMOZ_WEBRTC_SIGNALING=1 -DMOZ_WEBSPEECH=1 -DMOZ_WEBSPEECH_TEST_BACKEND=1 -DMOZ_WIDGET_GTK=3 -DMOZ_X11=1 -DMOZ_XUL=1 -DNO_NSPR_10_SUPPORT=1 -DNS_PRINTING=1 -DNS_PRINT_PREVIEW=1 -DRELEASE_OR_BETA=1 -DSTATIC_JS_API=1 -DSTDC_HEADERS=1 -DTARGET_XPCOM_ABI='"x86_64-gcc3"' -DUSE_SKIA=1 -DUSE_SKIA_GPU=1 -DU_USING_ICU_NAMESPACE=0 -DVA_COPY=va_copy -DXP_LINUX=1 -DXP_UNIX=1 -D_REENTRANT=1 -DAB_CD=en-US \
        --format omni \
        --removals /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/browser/installer/removed-files.in \
        --ignore-errors \
         \
         \
         \
        --optimizejars \
         \
         \
        /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/browser/installer/package-manifest.in ../../dist ../../dist/firefox \

Executing /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/dist/bin/xpcshell -g /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/dist/bin/ -a /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/dist/bin/ -f /var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/toolkit/mozapps/installer/precompile_cache.js -e precompile_startupcache("resource://gre/");
Traceback (most recent call last):
  File "/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/toolkit/mozapps/installer/packager.py", line 415, in <module>
    main()
  File "/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/toolkit/mozapps/installer/packager.py", line 409, in main
    args.source, gre_path, base)
  File "/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/toolkit/mozapps/installer/packager.py", line 166, in precompile_cache
    errors.fatal('Error while running startup cache precompilation')
  File "/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/python/mozbuild/mozpack/errors.py", line 103, in fatal
    self._handle(self.FATAL, msg)
  File "/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/python/mozbuild/mozpack/errors.py", line 98, in _handle
    raise ErrorMessage(msg)
mozpack.errors.ErrorMessage: Error: Error while running startup cache precompilation
make[1]: *** [/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/toolkit/mozapps/installer/packager.mk:41: stage-package] Error 1
make[1]: Leaving directory '/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/ff/browser/installer'
make: *** [/var/tmp/portage/www-client/firefox-53.0/work/firefox-53.0/browser/build.mk:18: install] Error 2
 * ERROR: www-client/firefox-53.0::gentoo failed (install phase):
 *   emake failed
 *

emerge -pqv '=www-client/firefox-53.0::gentoo'
[ebuild   R   ] www-client/firefox-53.0  USE="custom-cflags custom-optimization dbus gmp-autoupdate hwaccel jemalloc pulseaudio rust startup-notification system-harfbuzz system-icu system-jpeg system-libevent system-libvpx -bindist -debug -hardened -jack (-neon) -nsplugin -pgo (-selinux) (-system-cairo) -system-sqlite {-test} -wifi" L10N="de -ach -af -an -ar -as -ast -az -bg -bn-BD -bn-IN -br -bs -ca -cak -cs -cy -da -dsb -el -en-GB -en-ZA -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mai -mk -ml -mr -ms -nb -nl -nn -or -pa -pl -pt-BR -pt-PT -rm -ro -ru -si -sk -sl -son -sq -sr -sv -ta -te -th -tr -uk -uz -vi -xh -zh-CN -zh-TW"

With gcc-5.4.0-r3 and gcc-6.3.0 it builds and installs fine.
Comment 1 Bruce Hill 2017-05-08 18:35:56 UTC
Could you give a more descriptive title? Would not have looked at this bug if:

www-client/firefox-53.0 build with gcc-7.1.0 failed here on install phase
Comment 2 Cănărău Constantin 2017-05-08 19:58:37 UTC
Probably duplicate of Bug 580726
Comment 3 josef.95 2017-05-08 23:51:30 UTC
Created attachment 472030 [details]
full firefox-53.0/temp/build.log (xz compressed)

Added full build.log
Comment 4 octoploid 2017-05-09 09:53:50 UTC
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1324202

It is a Firefox bug. Tons of undefined behavior due to misaligned stores and loads.
Comment 5 josef.95 2017-05-21 15:11:25 UTC
CXXFLAGS="${CXXFLAGS} -mno-avx" emerge -av1 =firefox-53.0-r1::gentoo
builds and installs fine with gcc-7.1.0-r1

(thanks holgersson! from freenode IRC :)
Comment 6 Jory A. Pratt gentoo-dev 2017-05-22 21:14:48 UTC
There is no issue with gcc-7.1.0 I just built with it even on a hardened musl system. I will dig into the build.log in a few days.
Comment 7 josef.95 2017-05-23 06:02:37 UTC
(In reply to Jory A. Pratt from comment #6)
> There is no issue with gcc-7.1.0 [..]

Sorry, I have the issue *only with gcc-7*
with gcc-5 builds fine
with gcc-6 builds fine
with gcc-7 segfaults on startup cache generation
Comment 8 Roy Bamford gentoo-dev 2017-05-23 17:55:21 UTC
I can reproduce the original problem with firefox-53.0 and firefox-53.0-r1
However ... 

[ 1724.815940] xpcshell invoked oom-killer: gfp_mask=0x14280ca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), nodemask=(null),  order=0, oom_score_adj=0
[ 1724.815944] xpcshell cpuset=/ mems_allowed=0
[ 1724.815949] CPU: 5 PID: 24597 Comm: xpcshell Tainted: G           O    4.11.0-gentoo #1
[ 1724.815950] Hardware name: System manufacturer System Product Name/M4A78T-E, BIOS 3406    08/20/2010
[ 1724.815951] Call Trace:
[ 1724.815957]  ? dump_stack+0x46/0x62
[ 1724.815959]  ? dump_header+0x8f/0x222
[ 1724.815962]  ? get_page_from_freelist+0x5c3/0x8f0
[ 1724.815963]  ? oom_kill_process+0x27d/0x440
[ 1724.815964]  ? oom_badness.part.11+0x11b/0x190
[ 1724.815965]  ? out_of_memory+0x1b3/0x290
[ 1724.815966]  ? __alloc_pages_slowpath+0x861/0xb30
[ 1724.815968]  ? __alloc_pages_nodemask+0x18a/0x1a0
[ 1724.815970]  ? __handle_mm_fault+0x9ed/0xd50
[ 1724.815971]  ? handle_mm_fault+0xb7/0x210
[ 1724.815973]  ? __do_page_fault+0x177/0x460
[ 1724.815975]  ? page_fault+0x1f/0x30
[ 1724.815976] Mem-Info:
[ 1724.815979] active_anon:3679589 inactive_anon:306767 isolated_anon:0
[ 1724.815979]  active_file:53 inactive_file:64 isolated_file:0
[ 1724.815979]  unevictable:1949 dirty:0 writeback:18811 unstable:0
[ 1724.815979]  slab_reclaimable:19063 slab_unreclaimable:39825
[ 1724.815979]  mapped:21311 shmem:147291 pagetables:9547 bounce:0
[ 1724.815979]  free:33520 free_pcp:4 free_cma:0
[ 1724.815982] Node 0 active_anon:14718356kB inactive_anon:1227068kB active_file:212kB inactive_file:256kB unevictable:7796kB isolated(anon):0kB isolated(file):0kB mapped:85244kB dirty:0kB writeback:75244kB shmem:589164kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 8261632kB writeback_tmp:0kB unstable:0kB pages_scanned:243 all_unreclaimable? no
[ 1724.815985] DMA free:15860kB min:64kB low:80kB high:96kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15988kB managed:15904kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:44kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[ 1724.815986] lowmem_reserve[]: 0 3158 15933 15933
[ 1724.815989] DMA32 free:64124kB min:13380kB low:16724kB high:20068kB active_anon:3246684kB inactive_anon:0kB active_file:100kB inactive_file:0kB unevictable:0kB writepending:0kB present:3390016kB managed:3311020kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:16kB kernel_stack:0kB pagetables:8kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[ 1724.815990] lowmem_reserve[]: 0 0 12774 12774
[ 1724.815993] Normal free:54096kB min:54132kB low:67664kB high:81196kB active_anon:11471504kB inactive_anon:1227508kB active_file:128kB inactive_file:0kB unevictable:7796kB writepending:75660kB present:13369344kB managed:13081716kB mlocked:7796kB slab_reclaimable:76252kB slab_unreclaimable:159240kB kernel_stack:6224kB pagetables:38180kB bounce:0kB free_pcp:16kB local_pcp:0kB free_cma:0kB
[ 1724.815994] lowmem_reserve[]: 0 0 0 0
[ 1724.815995] DMA: 1*4kB (U) 0*8kB 1*16kB (U) 1*32kB (U) 1*64kB (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15860kB
[ 1724.816001] DMA32: 26*4kB (UM) 9*8kB (UM) 9*16kB (U) 7*32kB (UM) 3*64kB (UM) 2*128kB (UM) 1*256kB (U) 3*512kB (M) 2*1024kB (UM) 1*2048kB (U) 14*4096kB (M) = 64224kB
[ 1724.816007] Normal: 503*4kB (UMEH) 315*8kB (UMEH) 409*16kB (UMEH) 182*32kB (UMEH) 84*64kB (UME) 36*128kB (UE) 24*256kB (UE) 8*512kB (UE) 17*1024kB (ME) 0*2048kB 0*4096kB = 54532kB
[ 1724.816014] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
[ 1724.816015] 170183 total pagecache pages
[ 1724.816017] 21057 pages in swap cache
[ 1724.816017] Swap cache stats: add 522178, delete 501121, find 27/52
[ 1724.816018] Free swap  = 0kB
[ 1724.816018] Total swap = 2088432kB
[ 1724.816019] 4193837 pages RAM
[ 1724.816019] 0 pages HighMem/MovableOnly
[ 1724.816019] 91677 pages reserved

With 16G RAM, /var/tmp/portage is in RAM at the default 50% RAM for /dev/shm.
xpcshell being what's running to install firefox. 

With CXXFLAGS="${CXXFLAGS} -mno-avx" emerge -av1 =firefox-53.0-r1::gentoo the install completes but my Phenom II does not have avx so that should be a nop.
# cpuid2cpuflags
CPU_FLAGS_X86: 3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a

Swap is still full, even after the build with  CXXFLAGS="${CXXFLAGS} -mno-avx" emerge -av1 =firefox-53.0-r1::gentoo completes, which looks like a memory leak, since the OOM could not reclaim leaked memory. 

The -mno-avx build completed after failures with firefox-53.0 and firefox-53.0-r1 both showing the same symptoms and the OOM killing xpcshell.
It appears that -mno-avx wakes a difference, even if the system does not have avx hardware.
Comment 9 Roy Bamford gentoo-dev 2017-05-24 15:32:23 UTC
I still don't believe what I posted above, so I've repeated the test under better controlled conditions.

emerge -av1 =firefox-53.0-r1 fails with the OOM killing xpcshell.
Subsequently
cd /var/tmp/portage/www-client/firefox-53.0-r1/work/firefox-53.0/ff
make -j1 DESTDIR=/var/tmp/portage/www-client/firefox-53.0-r1/image/ install
fails with the same thing. That's -j1 rather than -j8

Removing the junk rm -rf /var/tmp/portage/* then running 
CXXFLAGS="${CXXFLAGS} -mno-avx" emerge -av1 =firefox-53.0-r1
With the default -j8 works.  On a system that does not have avx anyway. 

# emerge --info
Portage 2.3.6 (python 3.4.6-final-0, default/linux/amd64/13.0/no-multilib, gcc-7.1.0, glibc-2.24-r1, 4.11.0-gentoo x86_64)
=================================================================
System uname: Linux-4.11.0-gentoo-x86_64-AMD_Phenom-tm-_II_X6_1090T_Processor-with-gentoo-2.3
KiB Mem:    16408640 total,  14210308 free
KiB Swap:    2088432 total,   2088276 free
Timestamp of repository gentoo: Tue, 23 May 2017 01:45:01 +0000
sh bash 4.4_p12
ld GNU gold (Gentoo 2.27 p1.0 2.27) 1.12
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo, 6.3.0::gentoo, 7.1.0-r1::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://192.168.10.119/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: --exclude=metadata/cache

gentoo_static
    location: /usr/local/gentoo-static
    masters: gentoo
    priority: 0

static_overlay
    location: /usr/local/portage
    masters: gentoo
    priority: 1

palemoon
    location: /var/lib/layman/palemoon
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10.1 AdobeFlash-10.3 AdobeFlash-11.x FraunhoferFDK Google-TOS Oracle-BCLA-JavaSE PUEL dlj-1.1 googleearth teamspeak3"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.heanet.ie/pub/gentoo/                 http://mirror.mdfnet.se/gentoo                 http://mirrors.163.com/gentoo/                 http://gentoo.mirror.web4u.cz/                  http://64.50.236.52/                  http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/                  http://gentoo.mneisen.org/                  http://gentoo.mirror.pw.edu.pl/                  http://gentoo.prz.rzeszow.pl                  http://mirror.mdfnet.se/mirror/gentoo                  http://ftp.gentoo.bg/                  http://distfiles.gentoo.bg/                  http://mirrors.ludost.net/gentoo/                  http://mirror.hamakor.org.il/pub/mirrors/gentoo/                  http://ftp.dei.uc.pt/pub/linux/gentoo/"
INSTALL_MASK=" /usr/lib/systemd *.la"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude=metadata/cache"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="3dnow 3dnowext X a52 acl alsa amd64 amr ao apng berkdb bluray bzip2 cairo caps cdda cddb cdio cdparanoia cli cracklib crypt cups curl cxx device-mapper dri drm dvd dvdnav dvdr egl encode fdk ffmpeg flac fontconfig fortran fuse gbm gdbm gegl geoip gif gimp gles2 gpg gpm graphite gtk guidexml iconv icu introspection ipv6 jpeg jpeg2k ladspa lock lzma lzo mad minizip mmx mmxext modules mp3 mplayer mtp ncurses nfs nls nptl nsplugin odf ogg olde-gentoo opengl openmp pam pcre pcre16 pdf png popcnt postproc postscript python raw readline sdl seccomp session smpeg spell sse sse2 sse3 sse4a ssl startup-notification svg sysfs tcpd theora threads thunar tiff tools truetype twolame unicode usb v4l vaapi vdpau video vorbis wav wavpack x264 xattr xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="mouse keyboard" KERNEL="linux" L10N="en en-GB en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="pdfimport presenter-console presenter-minimizer" LINGUAS="en en_GB en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="i386 x86_64 ppc64 sparc sparc64 arm aarch64" QEMU_USER_TARGETS="i386 x86_64 ppc64 sparc sparc64 arm aarch64" RUBY_TARGETS="ruby21 ruby22" SANE_BACKENDS="epson epson2" USERLAND="GNU" VIDEO_CARDS="fbdev vesa nv nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON
Comment 10 Wikky Kerr 2017-05-25 11:38:27 UTC
I'm also affected by this bug, but the suggested workaround doesn't work for me.

amd64 hardened musl, Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz, sys-devel/gcc-7.1.0-r1::musl, both firefox 52.1.0-r1 and 53.0-r1, USE="custom-cflags custom-optimization hardened hwaccel system-harfbuzz system-icu system-jpeg (system-libevent) system-libvpx system-sqlite"
Comment 11 Wikky Kerr 2017-05-25 12:19:19 UTC
(In reply to Wiktor W Brodlo from comment #10)
> sys-devel/gcc-7.1.0-r1::musl

Update: builds fine with sys-devel/gcc-6.3.0::musl.
Comment 12 Aric Belsito 2017-05-25 22:29:04 UTC
Same issue here.

There seems to be some kind of issue with gcc-7.1.0 that's causing this problem -- "-mno-avx" doesn't work on my end, but I'm using a haswell machine with "-march=native". I'll probably try "-march=x86-64 -mtune=generic" next.

I'm using sys-devel/gcc-7.1.0-r1::musl, but I don't think it's a result of the few musl patches, especially because others here seem to be running into it.
Comment 13 Aric Belsito 2017-05-26 00:41:16 UTC
Created attachment 474336 [details]
Firefox Screenshot.
Comment 14 Aric Belsito 2017-05-26 00:43:42 UTC
Built with GCC-7.1.0 and `-march=westmere`, it looks like there's definitely a problem with AVX/2 codegen, because i didn't get a OOM crash this time around in the install phase. Going to build with `march=x86-64` now to see if it's also an issue with SSE.

I'll also probably test `march=native` and custom-optimization so firefox doesn't use `-O3` and `-Os`.
Comment 15 Aric Belsito 2017-05-27 00:56:06 UTC
No dice.
I tried forcing 'fno-strict-aliasing' for the whole build as well, but it didn't work. Something in libxul is broken.

AVX/2 seems to cause undefined behaviour in the javascript engine, but I'm not sure what's breaking rendering of the browser.
Comment 16 josef.95 2017-05-27 07:56:37 UTC
(In reply to Aric Belsito from comment #15)
[...]
> AVX/2 seems to cause undefined behaviour in the javascript engine, but I'm
> not sure what's breaking rendering of the browser.

Hm, I think the rendering issue is https://bugzilla.mozilla.org/show_bug.cgi?id=1342344
Comment 17 Manuel Lauss 2017-05-27 09:02:01 UTC
I also see this only with gcc-7.1.
-march=sandybridge  works, -march=ivybridge or newer breaks xpcshell.

gcc-6.3 and -march=haswell works fine.
Comment 18 Roy Bamford gentoo-dev 2017-05-28 16:09:19 UTC
What works for me with gcc-7.1.0

CXXFLAGS="${CXXFLAGS} -mno-avx"  USE=custom-optimization emerge -av1 =firefox-53.0-r1::gentoo

The -mno-avx avoids xpcshell being killed by the OOM. 
The CPU does not have avx anyway ...
This allows firefox to build and install but rendering artefacts make it unusable.  

The  USE=custom-optimization allows the -O2 from make.conf to be used in place of firefoxs' internal -O3.  This allows firefox-53  to render properly.
Comment 19 Ian Stakenvicius (RETIRED) gentoo-dev 2017-05-28 17:17:08 UTC
Has anybody tried -O2 without -mno-avx yet?  I'm wondering if it might. It be the abc in gcc7 but rather how it is optimized at O3...
Comment 20 Ian Stakenvicius (RETIRED) gentoo-dev 2017-05-29 02:09:41 UTC
(In reply to Ian Stakenvicius from comment #19)
> Has anybody tried -O2 without -mno-avx yet?  I'm wondering if it might. It
> be the abc in gcc7 but rather how it is optimized at O3...

Wow, autocorrect tore that one to shreds...

I'm wondering if the failure with xpcshell might be related to what gcc-7.1 does with some avx code with -O3, rather than the avx code itself.  Of course it is a bit concerning that avx is being included when there isn't support for it in the first place...
Comment 21 Roy Bamford gentoo-dev 2017-05-29 09:48:35 UTC
For completeness

USE=custom-optimization emerge -av1 =firefox-53.0-r1::gentoo

ends in tears with 

[64882.870277] Out of memory: Kill process 28187 (xpcshell) score 777 or sacrifice child
[64882.870314] Killed process 28187 (xpcshell) total-vm:26545764kB, anon-rss:14767488kB, file-rss:1816kB, shmem-rss:24120kB
Comment 22 Jory A. Pratt gentoo-dev 2017-05-29 18:19:40 UTC
*** Bug 620116 has been marked as a duplicate of this bug. ***
Comment 23 Jory A. Pratt gentoo-dev 2017-05-30 14:57:17 UTC
*** Bug 620194 has been marked as a duplicate of this bug. ***
Comment 24 Jory A. Pratt gentoo-dev 2017-05-30 15:03:39 UTC
Maybe you fellas can add some insight as to why avx is being passed on archs that do not even support it.
Comment 25 Roy Bamford gentoo-dev 2017-05-30 16:32:18 UTC
(In reply to Jory A. Pratt from comment #24)
> Maybe you fellas can add some insight as to why avx is being passed on archs
> that do not even support it.

I don't think avx is being passed. Failing to pass -no-avx may not be the same thing though.

For my Phenom II, 
gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )//g'
shows 
-march=amdfam10 -mmmx -m3dnow -msse -msse2 -msse3 -mno-ssse3 -msse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mpopcnt -mabm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=amdfam10

which correctly shows -mno-avx

However, building with -march=native does not pass the -mno flags. They are all defaulted.  As as emerge -e @world with gcc-7.1 does not lead to any Illegal Instruction exceptions, it looks like gcc-7.1 is doing the right thing with respect to avx, for the rest of my install anyway.  If its not gcc-7.1
that leaves firefox itself.

My conclusion is that something in firefox is assuming avx unless its explicitly told -mno-avx.  Even then, its not actually executing any avx instructions or I would be reporting illegal instruction exceptions rather than build success.

I suspect and need to test on amd64, that thunderbird will do the same thing.
That's from seeing different build issues on arm64 with gcc-7.1 in the same place in both firefox and thunderbird.
Comment 26 Roy Bamford gentoo-dev 2017-05-30 20:03:31 UTC
I've repeated the four build tests with gcc-7.1.0 and firefox-53.0.3.
With the same results as above.

I've also tested  gcc-7.1.0 with thunderbird-52.1.1 which gives similar issues for the same four test cases.

The common theme here is the Mozilla codebase.  In particular, both use xpcshell in the course of the install.  

Both respond CXXFLAGS="${CXXFLAGS} -mno-avx" USE=custom-optimization emerge ...
When -O2 is set.
Comment 27 Jory A. Pratt gentoo-dev 2017-05-31 20:14:54 UTC
Created attachment 474882 [details, diff]
Work around the default optimization level of -Os

Upstream is aware of a problem when building with -Os which is the default for Mozilla products. We can work around it for the time being until we can debug GCC to see what change is the culprit for the breakage.
Comment 28 Jory A. Pratt gentoo-dev 2017-05-31 20:53:32 UTC
Created attachment 474896 [details, diff]
Work around the default optimization level of -Os ver.2

Was unhappy with the previous patch so reworked it. I have committed the patch to Mozilla overlay for anyone that is wanting to test before we push it to the tree.
Comment 29 Eugene Shalygin 2017-06-01 17:12:09 UTC
www-client/firefox-53.0.3::mozilla fails in the very same way on my system: xpcshell eats all the available memory.
Comment 30 octoploid 2017-06-02 10:41:40 UTC
To repeat myself: Firefox is invoking undefined behavior.
The compiler is allowed to do anything in this case.
Different compiler flags cannot fix the issue.

Here is a recent list of UB in Firefox trunk: https://bugzilla.mozilla.org/show_bug.cgi?id=1367146

All issues in this list have to be fixed, before anyone can possibly blame gcc.
Comment 31 Nils Freydank 2017-06-05 11:20:17 UTC
It seems as I can build only if I pass CXXFLAGS via commandline, not via package.env, even though -mno-avx is everywhere in the failing build.log. Can anyone confirm this?

I tested -march=native and the similiar, but manually set CXXFLAGS and got same results.

The building way on a hardened system with Intel i5-4300U has these emerge --info:

Portage 2.3.6 (python 3.4.6-final-0, hardened/linux/amd64/no-multilib/selinux, gcc-7.1.0, glibc-2.23-r3, 4.11.3 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.11.3-x86_64-Intel-R-_Core-TM-_i5-4300U_CPU_@_1.90GHz-with-gentoo-2.3
KiB Mem:     8102796 total,   4615916 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 04 Jun 2017 18:02:23 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.1-r2::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            6.3.0::gentoo, 7.1.0-r1::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /var/portage/tree
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    sync-git-clone-extra-opts: --branch master

local
    location: /usr/local/portage
    masters: gentoo
    priority: 0

holgersson-overlay
    location: /var/layman/holgersson-overlay
    sync-type: laymansync
    sync-uri: https://git.holgersson.xyz/holgersson-overlay
    masters: gentoo
    priority: 50

imaging
    location: /var/layman/imaging
    sync-type: laymansync
    sync-uri: https://github.com/gerddie/gentoo-imaging.git
    masters: gentoo
    priority: 50

kde
    location: /var/layman/kde
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo
    priority: 50

perl-experimental
    location: /var/layman/perl-experimental
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/perl-overlay.git
    masters: gentoo
    priority: 50

Installed sets: @custom_KDE, @games
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build --autounmask=n --binpkg-respect-use=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news nodoc noinfo parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://mirror.netcologne.de/gentoo/ https://tux.rainside.sk/gentoo/ https://www.mirrorservice.org/sites/distfiles.gentoo.org/"
LANG="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5 -l5"
PKGDIR="/var/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-6 -T4"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 audit bash-completion berkdb bluetooth branding bzip2 caps cdda cgroups cli colord cracklib crypt cryptsetup cups cxx dbus djvu dri dts dvd dvdr egl encode exif fam firefox flac fontconfig gif git glamor gles gpg gpm graphicsmagick gstreamer hardened hunspell iconv icu int64 ipv6 jit jpeg justify kipi lcms ldap libnotify lzma mng modules mp3 mp4 mpeg ncurses nftables nls nptl offensive ogg open_perms opengl openmp openmpi openmpi2 opus pam pax_kernel pcre pdf phonon pic pie pkcs11 plasma png policykit postscript pulseaudio qml qt5 quvi raw readline rtmp samba sasl sdl seccomp selinux semantic-desktop session smp sound spell ssh ssl ssp startup-notification svg systemd tcpd theora threads tiff truetype udev udisks unicode upower urandom usb v4l vaapi video vim-syntax vorbis vpx wavpack wayland x264 x265 xattr xcb xcomposite xkb xtpax xv xvid zlib zsh-completion" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics wacom" KERNEL="linux" L10N="de de_DE ru ru_RU" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de de_DE ru ru_RU" LLVM_TARGETS="BPF X86" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

www-client/firefox-53.0.3::gentoo was built with the following:
USE="custom-cflags custom-optimization dbus hardened hwaccel jemalloc pulseaudio rust (selinux) startup-notification system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-sqlite -bindist -debug (-gmp-autoupdate) -jack (-neon) -nsplugin -pgo (-system-cairo) -test -wifi" L10N="de ru -ach -af -an -ar -as -ast -az -bg -bn-BD -bn-IN -br -bs -ca -cak -cs -cy -da -dsb -el -en-GB -en-ZA -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mai -mk -ml -mr -ms -nb -nl -nn -or -pa -pl -pt-BR -pt-PT -rm -ro -si -sk -sl -son -sq -sr -sv -ta -te -th -tr -uk -uz -vi -xh -zh-CN -zh-TW"
CFLAGS="-pipe -march=haswell -mcx16 -msahf -mabm -mlzcnt -mfxsr -mxsave -mxsaveopt --param=l1-cache-size=32 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072"
CXXFLAGS="-mno-avx -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-rpath=/usr/lib64/firefox,--enable-new-dtags -Wl,-z,relro,-z,now"
Comment 32 Gabriel 2017-06-05 22:16:10 UTC
(In reply to Nils from comment #31)
> It seems as I can build only if I pass CXXFLAGS via commandline, not via
> package.env, even though -mno-avx is everywhere in the failing build.log.
> Can anyone confirm this?

Yeah, package.env is useless in this case, still eats all the memory and fails the install phase. I hadn't tried passing CXXFLAGS via commandline until i saw your post, but now i did and it built and installed successfully.
Comment 33 Steve Arnold archtester gentoo-dev 2017-06-17 17:36:04 UTC
Created attachment 476758 [details, diff]
Workaround to disable cachegen
Comment 34 Jory A. Pratt gentoo-dev 2017-06-22 22:18:27 UTC
*** Bug 622474 has been marked as a duplicate of this bug. ***
Comment 35 Steffen Hau 2017-07-08 11:11:42 UTC
(In reply to Steve Arnold from comment #33)
> Created attachment 476758 [details, diff] [details, diff]
> Workaround to disable cachegen

I copied the patch to /etc/portage/patches/www-client/firefox but that didn't solve the problem. I got it working by adding a file in /etc/portage/env with EXTRA_ECONF="--disable-startupcache". This worked for both www-client/firefox-54 and mail-client/thunderbird-52.2.0.
Comment 36 Steffen Hau 2017-07-10 09:56:08 UTC
(In reply to Steffen Hau from comment #35)
> I copied the patch to /etc/portage/patches/www-client/firefox but that
> didn't solve the problem. I got it working by adding a file in
> /etc/portage/env with EXTRA_ECONF="--disable-startupcache". This worked for
> both www-client/firefox-54 and mail-client/thunderbird-52.2.0.

Just a short update: FF and TB compiled fine, but won't start. Both are consuming all available memory until OOM comes into place and kills them. I've now temporarily installed gcc-6.3 in order to get a working FF and TB.
Comment 37 Jory A. Pratt gentoo-dev 2017-07-24 01:44:40 UTC
If someone wants to test patch for gcc and give an update would help in getting this fixed in gentoo.
Comment 38 Jory A. Pratt gentoo-dev 2017-07-24 02:04:31 UTC
Created attachment 486660 [details, diff]
gcc-7.1.0-PR80706.patch

Make it easy for you all to test the appropriate patch.
Comment 39 Steffen Hau 2017-07-24 12:53:15 UTC
(In reply to Jory A. Pratt from comment #37)
> If someone wants to test patch for gcc and give an update would help in
> getting this fixed in gentoo.

The bug reports mentions i686, the reporter of the duplicate used "-m32". Did you test that patch for 64 bit builds of FF/TB?
Comment 40 josef.95 2017-07-24 19:31:53 UTC
(In reply to Jory A. Pratt from comment #38)
> Created attachment 486660 [details, diff] [details, diff]
> gcc-7.1.0-PR80706.patch
> 
> Make it easy for you all to test the appropriate patch.

Thanks,
with this gcc-7.1 Patch builds and installs firefox now fine, the startup cache generation issue is gone.
But, firefox hangs here now on start, it pulls ~16 GB RAM, and hangs with 100% CPU load.
I have this tested with firefox-55.0_beta10 and firefox-55.0_beta11 from mozilla overlay, with a clean fresh ~/.mozilla profile.

The build via the workaround
CXXFLAGS="${CXXFLAGS} -mno-avx" emerge -av1 firefox
works for me.
Comment 41 josef.95 2017-07-31 03:08:53 UTC
I have from my local overlay build a current sys-devel/gcc-7.2.0_pre9999
With this gcc builds and works current firefox-55.0_beta13 fine.

Probably this Bug should fixed with the next coming GCC 7.2.0 release :)
Comment 42 Jory A. Pratt gentoo-dev 2017-08-01 12:24:35 UTC
*** Bug 626762 has been marked as a duplicate of this bug. ***
Comment 43 George L. Emigh 2017-08-19 23:17:44 UTC
https://www.phoronix.com/scan.php?page=news_item&px=GCC-7.2-Released

firefox and thunderbird both build and install fine using GCC 7.2.

So GCC 7.2 fixes the startup cache generation problem.

This bug should depend on GCC 7.2 being made available in portage.

Thank you.
Comment 44 Jory A. Pratt gentoo-dev 2017-08-26 17:56:37 UTC
If you feel I have closed your bug and it is still a current issue, please reopen and update it completely. We will not work bugs that have no ebuild in tree any longer or can not be reproduced with a current system.

Thank You for your support and understanding
The Mozilla Team
Comment 45 Steffen Hau 2017-08-30 10:23:47 UTC
I can confirm that FF-55.0.2/TB-52.3.0 compiled with GCC 7.2.0 does not show the issue.