View previous topic :: View next topic |
Author |
Message |
keivan n00b
Joined: 22 Nov 2010 Posts: 42
|
Posted: Fri Dec 19, 2014 5:02 pm Post subject: Firefox do not compile with my CFLAGS? |
|
|
Hi
Recently, I managed to turn on Link Time Optimization (LTO) and some other optimizations on my Gentoo and recompile the world several times. According to some benchmarks, I have about 10% improvement in the system speed.
I expect to see the same trend in firefox also. However, comparing the firefox, which is compiled locally, with firefox-bin, which is not compiled by me, I see about 8% reduction in speed!!!!!!!!!!!!!!!!!!
Looking at the build.log of firefox, I see that non of my optimization CFLAGS are present in compile time. Firefox is compiling with -Os instead of -O2 and some other flags.
Do you have any suggestion, what might be wrong? |
|
Back to top |
|
|
hdcg Tux's lil' helper
Joined: 07 Apr 2013 Posts: 120
|
Posted: Fri Dec 19, 2014 9:06 pm Post subject: |
|
|
Hi,
what USE flags do you use?
The following ones should be of interest for you:
Quote: |
- - custom-cflags : Build with user-specified CFLAGS (unsupported)
- - custom-optimization : Fine-tune custom compiler optimizations (-Os, -O0, -O1, -O2, -O3)
|
|
|
Back to top |
|
|
keivan n00b
Joined: 22 Nov 2010 Posts: 42
|
Posted: Sat Dec 20, 2014 4:03 pm Post subject: |
|
|
Thank you I didn't know about those USE flags. Using both of them now, I see more than 8% improvement over firefox-bin in peacekeeper.futuremark.com benchmark, which might be due to profile guided optimizations, and these CFLAGS: "-march=native -O2 -fomit-frame-pointer -fno-stack-protector". These are the benchmark values if anybody interested.
firefox compiled without "custom-cflags" and "custom-optimization" use flags = 5550
firefox-bin = 6000
firefox with the abovementioned optimizations = 6550
by the way, firefox failed to compile with -fLTO. |
|
Back to top |
|
|
Deathwing00 Bodhisattva
Joined: 13 Jun 2003 Posts: 4087 Location: Dresden, Germany
|
Posted: Sat Dec 27, 2014 4:27 pm Post subject: |
|
|
Moved from Installing Gentoo to Portage & Programming. |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3625
|
Posted: Tue Jun 02, 2015 9:59 pm Post subject: |
|
|
Hi,
Latest current stable Firefox-31.7 compiles here with: Code: | CFLAGS="${CFLAGS_GCC_BASE} -O2 -pipe -fgraphite -flto=4 -fopenmp"
GRAPHITE="-fgraphite-identity -floop-block -floop-interchange -floop-parallelize-all -floop-strip-mine -ftree-loop-distribution -ftree-loop-linear"
CFLAGS="${CFLAGS} ${GRAPHITE} -ftree-vectorize -ffat-lto-objects"
LDFLAGS="-O2 -Wl,-O1 -Wl,--enable-new-dtags -Wl,--as-needed -Wl,--sort-common -s -flto=4 -ffat-lto-objects" | where is required to avoid compiling breakage. For the record, unrequired for thunderbird
Size results: Code: | du -sh /usr/lib64/firefox
73M /usr/lib64/firefox | Detailed Code: | ls -l /usr/lib64/firefox
total 65804
-rw-r--r-- 1 root root 439 2 juin 21:19 application.ini
lrwxrwxrwx 1 root root 18 2 juin 23:57 bin -> /usr/lib64/firefox
drwxr-xr-x 7 root root 4096 2 juin 23:57 browser
-rw-r--r-- 1 root root 40 2 juin 23:54 chrome.manifest
drwxr-xr-x 2 root root 4096 2 juin 23:57 components
drwxr-xr-x 3 root root 4096 5 mars 22:15 defaults
-rw-r--r-- 1 root root 25 2 juin 23:53 dependentlibs.list
drwxr-xr-x 2 root root 4096 2 juin 23:57 dictionaries
-rwxr-xr-x 1 root root 117800 2 juin 23:55 firefox
-rwxr-xr-x 1 root root 117800 2 juin 23:55 firefox-bin
-rwxr-xr-x 1 root root 10232 2 juin 22:30 libmozalloc.so
-rwxr-xr-x 1 root root 61097336 2 juin 23:52 libxul.so
-rwxr-xr-x 1 root root 117912 2 juin 22:35 mozilla-xremote-client
-rw-r--r-- 1 root root 5615525 2 juin 23:54 omni.ja
-rw-r--r-- 1 root root 48 2 juin 22:36 platform.ini
-rwxr-xr-x 1 root root 109352 2 juin 23:55 plugin-container
-rw-r--r-- 1 root root 682 2 juin 23:54 removed-files
-rwxr-xr-x 1 root root 8915 5 mai 05:53 run-mozilla.sh
drwxr-xr-x 2 root root 4096 2 juin 23:57 webapprt
-rwxr-xr-x 1 root root 126072 2 juin 23:53 webapprt-stub
-rw-r--r-- 1 root root 1222 2 juin 21:19 xpcom-config.h | gcc-4.8.4, with no stack protector activated.
16 Gb seems required to avoid inflating compile duration due to intensive swap use.
Ie with 8 Gb laptop, hyperthreaded 1.8Ghz dual core I3 we have: Code: | genlop -t firefox
* www-client/firefox
Wed Jun 3 00:01:27 2015 >>> www-client/firefox-31.7.0
merge time: 2 hours, 44 minutes and 27 seconds. | Thks 4 ur attention, interest & support |
|
Back to top |
|
|
ryszardzonk Apprentice
Joined: 18 Dec 2003 Posts: 225 Location: Rzeszów, POLAND
|
Posted: Thu Jan 07, 2016 12:16 pm Post subject: |
|
|
@CaptainBlood
It has been ages since I tried to optimize some application and installed only quite conservative systems, but I gave a shot trying your flags with Firefox as your post looked promising however compiling Firefox-43 with GCC 5.3 have failed with them. Have You run into same issue and changed it somewhat for new versions of software?
PS Have you have taken into account other optimization results into account? Example http://hubicka.blogspot.com/2014/04/linktime-optimization-in-gcc-2-firefox.html
Code: | [...]/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/libav53/include/libavcodec/avcodec.h:4544:47: note: the first difference of corresponding definitions is field 'parser_init'
int (*parser_init)(AVCodecParserContext *s);
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/libav54/include/libavcodec/avcodec.h:3857:47: note: a field of same name but different type is defined in another translation unit
int (*parser_init)(AVCodecParserContext *s);
^
lto1: note: type mismatch in parameter 1
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/libav53/include/libavcodec/avcodec.h:4539:3: note: type 'struct AVCodecParserContext' should match type 'struct AVCodecParserContext' that itself violate one definition rule
} AVCodecParserContext;
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/libav54/include/libavcodec/avcodec.h:3852:3: note: the incompatible type is defined here
} AVCodecParserContext;
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h:18:0: warning: type 'struct FFmpegDecoderModule' violates one definition rule [-Wodr]
class FFmpegDecoderModule : public PlatformDecoderModule
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp:28:24: note: a type with different bases is defined in another translation unit
template <int V> class FFmpegDecoderModule
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h:18:0: warning: type 'struct FFmpegDecoderModule' violates one definition rule [-Wodr]
class FFmpegDecoderModule : public PlatformDecoderModule
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp:28:24: note: a type with different bases is defined in another translation unit
template <int V> class FFmpegDecoderModule
^
./glslang_lex.cpp:1033:8: warning: type 'struct yyguts_t' violates one definition rule [-Wodr]
./Tokenizer.cpp:591:8: note: a different type is defined in another translation unit
./glslang_lex.cpp:1037:19: note: the first difference of corresponding definitions is field 'yyextra_r'
./Tokenizer.cpp:595:19: note: a field of same name but different type is defined in another translation unit
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/gfx/angle/src/compiler/translator/ParseContext.h:27:0: note: type name 'TParseContext' should match type name 'pp::Tokenizer::Context'
struct TParseContext {
^
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/gfx/angle/src/compiler/preprocessor/Tokenizer.h:22:12: note: the incompatible type is defined here
struct Context
^
/usr/include/netinet/in.h:227:0: warning: type of 'in6addr_any' does not match original declaration
extern const struct in6_addr in6addr_any; /* :: */
^
/usr/include/netinet/in.h:227:30: note: previously declared here
extern const struct in6_addr in6addr_any; /* :: */
^
In function 'strncpy',
inlined from 'nr_transport_addr_fmt_ifname_addr_string.constprop' at /var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/media/mtransport/third_party/nICEr/src/net/transport_addr.c:101:0:
/usr/include/bits/string3.h:126:0: warning: call to __builtin___strncpy_chk will always overflow destination buffer
return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
^
test "$(nm -g libxul.so | grep _NSModule$ | grep -vw refptr | sort | sed -n 's/^.* _*\([^ ]*\)$/\1/;1p;$p' | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0 ; test "$(readelf -l libxul.so | awk 'libxul.so == "LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
nm: libxul.so: no symbols
NSModules are not ordered appropriately
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/rules.mk:826: recipe for target 'libxul.so' failed
make[4]: *** [libxul.so] Error 1
make[4]: *** Deleting file 'libxul.so'
make[4]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff/toolkit/library'
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/recurse.mk:71: recipe for target 'toolkit/library/target' failed
make[3]: *** [toolkit/library/target] Error 2
make[3]: Leaving directory '//var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff'
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/recurse.mk:32: recipe for target 'compile' failed
make[2]: *** [compile] Error 2
make[2]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff'
/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/config/rules.mk:549: recipe for target 'default' failed
make[1]: *** [default] Error 2
make[1]: Leaving directory '/var/tmp/portage/www-client/firefox-43.0/work/firefox-43.0/ff'
client.mk:396: recipe for target 'realbuild' failed
make: *** [realbuild] Error 2
* ERROR: www-client/firefox-43.0::gentoo failed (compile phase):
* emake failed
*
* If you need support, post the output of `emerge --info '=www-client/firefox-43.0::gentoo'`,
* the complete build log and the output of `emerge -pqv '=www-client/firefox-43.0::gentoo'`.
* The complete build log is located at '/var/portage-ondisk/logs/portage/www-client/firefox-43.0/temp/build.log'.
* The ebuild environment file is located at '/var/portage-ondisk/logs/portage/www-client/firefox-43.0/temp/environment'.
* Working directory: '/var/portage-ondisk/logs/portage/www-client/firefox-43.0/work/firefox-43.0'
* S: '/var/portage-ondisk/logs/portage/www-client/firefox-43.0/work/firefox-43.0' |
EDIT: It all works. It turns out that the problem was in the linker flag not related to FLTO nor gpraphite. On my systems since it appeared I used "-Wl,--hash-style=both" and your LDFLAGS config has "-Wl,--enable-new-dtags". Once I changed that to what I have system wide than it all compiled just fine. I would have to do some reading as of the differences between the two
EDIT2: On the side note compile with those cflags and use system libraries use flags on the i7-6700K with 16GB DDDR4 RAM takes only minutes O.O
* www-client/firefox
Fri Jan 8 21:46:53 2016 >>> www-client/firefox-43.0
merge time: 15 minutes and 20 seconds. _________________ Sky is not the limit... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|