Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FLAGS to compile Firefox 7 on Ubuntu Natty 64 bits

122 views
Skip to first unread message

Simón ツ

unread,
Sep 24, 2011, 9:32:55 PM9/24/11
to
I have searched In Internet about compilation Firefox with PGO and
with all that info I have built Firefox 7 with PGO for my system:
Ubuntu Natty 64 bits.
But I have doubts about CFLAGS/CXXFLAGS, LDFLAGS and
"ac_add_options".
My gcc version is "gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"

I have used this CFLAGS/CXXFLAGS and LDFLAGS:

export CFLAGS="-O3 -march=native -mtune=native -mfpmath=both -fforce-
addr -ftree-loop-linear -ftree-loop-ivcanon -ftree-loop-im -fivopts -
pipe -w -fomit-frame-pointer -ftree-vectorize -fpermissive -funroll-
loops -fstack-protector --param=ssp-buffer-size=4"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-
style=gnu"

And these "ac_add_options":

ac_add_options --with-system-zlib
ac_add_options --with-system-bz2 --with-system-jpeg
ac_add_options --with-system-libvpx --with-system-libevent
ac_add_options --enable-system-lcms
ac_add_options --with-pthreads --enable-libxul
ac_add_options --enable-ipc --disable-static
ac_add_options --disable-installer --disable-updater
ac_add_options --disable-pedantic --enable-jemalloc --enable-xterm-
updates
ac_add_options --enable-optimize --disable-debug --disable-tests
ac_add_options --disable-mochitest --enable-profile-guided-
optimization
ac_add_options --disable-crashreporter --enable-strip --enable-install-
strip
ac_add_options --disable-debug-modules --disable-debugger-info-modules
ac_add_options --enable-official-branding --disable-startup-
notification
ac_add_options --disable-parental-controls --disable-java-xpcom
ac_add_options --disable-xprint --enable-gconf --enable-gnomevfs
ac_add_options --enable-extensions=default --enable-printing
ac_add_options --enable-pango --enable-canvas --enable-canvas3d --
enable-svg
ac_add_options --enable-smil --enable-shared-js --enable-url-
classifier
ac_add_options --enable-places --enable-gio --enable-libnotify
ac_add_options --disable-safe-browsing
ac_add_options --disable-accessibility --disable-composer
ac_add_options --disable-freetypetest --disable-glibtest
ac_add_options --disable-ldap --disable-libIDLtest
ac_add_options --disable-logging --disable-mailnews
ac_add_options --disable-necko-wifi --disable-profilesharing
ac_add_options --enable-dbus --enable-faststart
ac_add_options --enable-gnomeui --enable-raw
ac_add_options --enable-svg --enable-universalchardet
ac_add_options --enable-threads=posix
ac_add_options --enable-ui-locale=es-ES
ac_add_options --with-l10n-base=..

Do you see something wrong or excessive?
Do you think that this configuration is optimal? Could I optimize
more? Or maybe should I delete some flags?

I appreciate every help or advise.
(sorry for my bad english!)
Regards.

Benjamin Smedberg

unread,
Sep 25, 2011, 10:12:22 AM9/25/11
to Simón ツ, dev-b...@lists.mozilla.org
On 9/24/2011 9:32 PM, Simón ツ wrote:
> I have searched In Internet about compilation Firefox with PGO and
> with all that info I have built Firefox 7 with PGO for my system:
> Ubuntu Natty 64 bits.
> But I have doubts about CFLAGS/CXXFLAGS, LDFLAGS and
> "ac_add_options".
> My gcc version is "gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"
>
> I have used this CFLAGS/CXXFLAGS and LDFLAGS:
>
> export CFLAGS="-O3 -march=native -mtune=native -mfpmath=both -fforce-
> addr -ftree-loop-linear -ftree-loop-ivcanon -ftree-loop-im -fivopts -
> pipe -w -fomit-frame-pointer -ftree-vectorize -fpermissive -funroll-
> loops -fstack-protector --param=ssp-buffer-size=4"
> export CXXFLAGS="$CFLAGS"
> export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-
> style=gnu"
>
> And these "ac_add_options":
It is likely that many of the configure options you have chosen are
incorrect, don't work, or do something you don't expect. In order to do
PGO you'll need a special setup that I'm hoping Ted or Mike Hommey can
describe (building Firefox twice and running the first one to generate
the profile data for the second pass), but pretty much all of the other
flags are incorrect:

> ac_add_options --with-pthreads --enable-libxul
> ac_add_options --enable-ipc --disable-static
> ac_add_options --disable-installer --disable-updater
> ac_add_options --disable-pedantic --enable-jemalloc --enable-xterm-
> updates
> ac_add_options --enable-optimize --disable-debug

All of these flags are either useless or the default, so please don't
use them.

> --disable-startup-
> notification
Why?
> ac_add_options --disable-parental-controls
This is meaningless on LInux where the OS doesn't have builtin parental
control support, but I'm pretty sure it would break your windows build?
Why bother specifying it?
> --disable-java-xpcom
Default.


> ac_add_options --disable-xprint --enable-gconf --enable-gnomevfs
> ac_add_options --enable-extensions=default --enable-printing
> ac_add_options --enable-pango --enable-canvas --enable-canvas3d --
> enable-svg
> ac_add_options --enable-smil --enable-shared-js --enable-url-
> classifier
> ac_add_options --enable-places --enable-gio --enable-libnotify
> ac_add_options --disable-safe-browsing
> ac_add_options --disable-accessibility --disable-composer
> ac_add_options --disable-freetypetest --disable-glibtest
> ac_add_options --disable-ldap --disable-libIDLtest
> ac_add_options --disable-logging --disable-mailnews
> ac_add_options --disable-necko-wifi --disable-profilesharing
> ac_add_options --enable-dbus --enable-faststart
> ac_add_options --enable-gnomeui --enable-raw
> ac_add_options --enable-svg --enable-universalchardet
> ac_add_options --enable-threads=posix

Why are you specifying any of these? Just let the defaults do their work.

--BDS

Simón ツ

unread,
Sep 25, 2011, 3:20:04 PM9/25/11
to
On 25 sep, 16:12, Benjamin Smedberg <benja...@smedbergs.us> wrote:
> On 9/24/2011 9:32 PM, Simón ツ wrote:
>
> > I have searched In Internet about compilation Firefox with PGO and
> > with all that info I have built Firefox 7 with PGO for my system:
> > Ubuntu Natty 64 bits.
> > But I have doubts about CFLAGS/CXXFLAGS,  LDFLAGS and
> > "ac_add_options".
> > My gcc version is "gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"
>
> > I have used this CFLAGS/CXXFLAGS and LDFLAGS:
>
> > export CFLAGS="-O3 -march=native -mtune=native -mfpmath=both -fforce-
> > addr -ftree-loop-linear -ftree-loop-ivcanon -ftree-loop-im -fivopts -
> > pipe -w -fomit-frame-pointer -ftree-vectorize -fpermissive -funroll-
> > loops -fstack-protector --param=ssp-buffer-size=4"
> > export CXXFLAGS="$CFLAGS"
> > export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-
> > style=gnu"
>
> > And these "ac_add_options":
>
> It is likely that many of the configure options you have chosen are
> incorrect, don't work, or do something you don't expect. In order to do
> PGO you'll need a special setup that I'm hoping Ted or Mike Hommey can
> describe (building Firefox twice and running the first one to generate
> the profile data for the second pass), but pretty much all of the other
> flags are incorrect:

What are the wrong parameters?

In any case this is only a part of my mozconfig file. I know that the
PGO process are 2 steps.
The rest of my mozconfig file:
....
mk_add_options MOZ_MAKE_FLAGS="-j8 -s"
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/
pgo/profileserver.py'
mk_add_options PYTHONPATH='$(OBJDIR)/_profile/pgo'
mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZILLA_OFFICIAL=1

And the compilation (with PGO) is done with:
.....
make -f client.mk everything
LD_PRELOAD="" /usr/bin/Xvfb -nolisten tcp -extension GLX -terminate :
99 &
LD_PRELOAD="" DISPLAY=:99 make -f client.mk profiledbuild
sudo make -f client.mk install
.....

Is incorrect?

>
> > ac_add_options --with-pthreads --enable-libxul
> > ac_add_options --enable-ipc --disable-static
> > ac_add_options --disable-installer --disable-updater
> > ac_add_options --disable-pedantic --enable-jemalloc --enable-xterm-
> > updates
> > ac_add_options --enable-optimize --disable-debug
>
> All of these flags are either useless or the default, so please don't
> use them.

All these flags are in MDN Docs info: https://developer.mozilla.org/en/Configuring_Build_Options
Which are the defaults flags?
The default flags depend on the environment in which is compiled, no?

>
> > --disable-startup-
> > notification
> Why?

I see now, in "configure --help", that this option is disabled by
default.

> > ac_add_options --disable-parental-controls
>
> This is meaningless on LInux where the OS doesn't have builtin parental
> control support, but I'm pretty sure it would break your windows build?
> Why bother specifying it?

As I said I'm compiling for Ubuntu, I don't use Windows.
To this I referred in my previous mail, the documentation about these
flags is poor.

>
> >   --disable-java-xpcom
> Default.
> > ac_add_options --disable-xprint --enable-gconf --enable-gnomevfs
> > ac_add_options --enable-extensions=default --enable-printing
> > ac_add_options --enable-pango --enable-canvas --enable-canvas3d --
> > enable-svg
> > ac_add_options --enable-smil --enable-shared-js --enable-url-
> > classifier
> > ac_add_options --enable-places --enable-gio --enable-libnotify
> > ac_add_options --disable-safe-browsing
> > ac_add_options --disable-accessibility --disable-composer
> > ac_add_options --disable-freetypetest --disable-glibtest
> > ac_add_options --disable-ldap --disable-libIDLtest
> > ac_add_options --disable-logging --disable-mailnews
> > ac_add_options --disable-necko-wifi --disable-profilesharing
> > ac_add_options --enable-dbus --enable-faststart
> > ac_add_options --enable-gnomeui --enable-raw
> > ac_add_options --enable-svg --enable-universalchardet
> > ac_add_options --enable-threads=posix
>
> Why are you specifying any of these? Just let the defaults do their work.

Why? Some of these flags are incorrect? Which are the defaults flags?

>
> --BDS

Ted Mielczarek

unread,
Sep 26, 2011, 8:54:12 AM9/26/11
to Simón ツ, dev-b...@lists.mozilla.org
On Sun, Sep 25, 2011 at 3:20 PM, Simón ツ <si...@simonbcn.net> wrote:
> Why? Some of these flags are incorrect? Which are the defaults flags?

Our configure script has a lot of options that are very old and not
well-maintained. Every option you specify increases the possibility
that your build will not complete properly. In general, you should
start with an empty mozconfig, and only add options if you find it
necessary. Just because an option *looks* like something you would
want doesn't mean that it will do anything useful. Here's the
mozconfig that I'd suggest you start with, if you'd like to do a PGO
build:

--------
# Build Firefox
ac_add_options --enable-application=browser
# Enable PGO compilation
mk_add_options MOZ_PGO=1
# Use the default PGO profiling script
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON)
@MOZ_OBJDIR@/_profile/pgo/profileserver.py'
# If you have a multi-core system, use parallel make
mk_add_options MOZ_MAKE_FLAGS="-j4"
--------

Then simply use `make -f client.mk` and you should wind up with a
Firefox build in a "obj-x86_64-unknown-linux-gnu" directory.

-Ted

Simón ツ

unread,
Sep 26, 2011, 12:05:38 PM9/26/11
to
In my PC this fails. I have to do a normal compile and then I
recompile it with PGO:
"make -f client.mk everything || exit 1
LD_PRELOAD="" /usr/bin/Xvfb -nolisten tcp -extension GLX -terminate :
99 &
LD_PRELOAD="" DISPLAY=:99 make -f client.mk profiledbuild || exit 1"

I have seen the "configure --help" and I've rewritten my mozconfig. I
have disabled some options that it seems enabled by default because I
don't need them. I try to build a light and fast Firefox.
---------------------------------------------
ac_add_options --enable-application=browser

ac_add_options --disable-accessibility
ac_add_options --disable-crashreporter
ac_add_options --disable-debug
ac_add_options --disable-freetypetest
ac_add_options --disable-glibtest
ac_add_options --disable-installer
ac_add_options --disable-jsd
ac_add_options --disable-libIDLtest
ac_add_options --disable-logging
ac_add_options --disable-necko-wifi
ac_add_options --disable-parental-controls
ac_add_options --disable-pedantic
ac_add_options --disable-safe-browsing
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --disable-url-classifier
ac_add_options --enable-chrome-format=omni
ac_add_options --enable-install-strip
ac_add_options --enable-jemalloc
ac_add_options --enable-official-branding
ac_add_options --enable-optimize="${CFLAGS}"
ac_add_options --enable-shared-js
ac_add_options --enable-strip
ac_add_options --enable-ui-locale=es-ES
ac_add_options --quiet
ac_add_options --with-arch=native
ac_add_options --with-l10n-base=..

mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON)@MOZ_OBJDIR@/_profile/pgo/
profileserver.py'

mk_add_options MOZ_MAKE_FLAGS="${MAKEFLAGS}"
---------------------------------------------

Regards

Simón ツ

unread,
Sep 27, 2011, 5:36:54 AM9/27/11
to
On 26 sep, 14:54, Ted Mielczarek <t...@mielczarek.org> wrote:
Ok, finally I can do this like you said. The problem was in gcc
version of Ubuntu Natty 64 bits. I have downloaded and compiled gcc
v4.5.3 and now it works.
With buggy Ubuntu's gcc, I compiled with "make -f client.mk
everything" and then "make -f client.mk profiledbuild", is this way
valid to compile with PGO?
Regards.

Ted Mielczarek

unread,
Sep 27, 2011, 8:09:09 AM9/27/11
to Simón ツ, dev-b...@lists.mozilla.org
On Tue, Sep 27, 2011 at 5:36 AM, Simón ツ <si...@simonbcn.net> wrote:
> Ok, finally I can do this like you said. The problem was in gcc
> version of Ubuntu Natty 64 bits. I have downloaded and compiled  gcc
> v4.5.3 and now it works.
> With buggy Ubuntu's gcc, I compiled with "make -f client.mk
> everything" and then "make -f client.mk profiledbuild", is this way
> valid to compile with PGO?

I don't know where you got the "make -f client.mk everything" from.
That's not necessary. For a PGO build you should only need to "make -f
client.mk profiledbuild" (or, if you have mk_add_options MOZ_PGO=1 in
your mozconfig, just "make -f client.mk".)

-Ted

Simón ツ

unread,
Sep 27, 2011, 9:26:40 AM9/27/11
to
Yes, you've already said it before but, I repeat, with Ubuntu's gcc
(4.5.2) if I compile directly with "make -f client.mk profiledbuild"
or with '...MOZ_PGO=1 in your mozconfig, just "make -f client.mk"',
the compilation fails with error "jsemit.cpp internal compiler error
floating point exception". However if I compile (with Ubuntu's gcc
4.5.2) first with "make -f client.mk everything" (or "build") and then
"make -f client.mk profiledbuild", it works well! Then my doubt is:
is this way valid to compile with PGO? The Firefox compiled in this
way is really PGO?

Anyway, yesterday I have downloaded and compiled gcc v4.5.3 and now
it works like you said, simply with '...MOZ_PGO=1 in your mozconfig,
just "make -f client.mk"'.
Thanks. Regards.

Simón ツ

unread,
Sep 27, 2011, 9:30:15 AM9/27/11
to
On 27 sep, 14:09, Ted Mielczarek <t...@mielczarek.org> wrote:
Another question: How I install the navigator? I use "sudo make -f
client.mk install", is this correct?

Simón ツ

unread,
Sep 27, 2011, 9:36:53 AM9/27/11
to
On 27 sep, 14:09, Ted Mielczarek <t...@mielczarek.org> wrote:
> On Tue, Sep 27, 2011 at 5:36 AM, Simón ツ <si...@simonbcn.net> wrote:
> > Ok, finally I can do this like you said. The problem was in gcc
> > version of Ubuntu Natty 64 bits. I have downloaded and compiled  gcc
> > v4.5.3 and now it works.
> > With buggy Ubuntu's gcc, I compiled with "make -f client.mk
> > everything" and then "make -f client.mk profiledbuild", is this way
> > valid to compile with PGO?
>
> I don't know where you got the "make -f client.mk everything" from.
> That's not necessary.
>
> -Ted

I had read this thread:
http://www.linuxquestions.org/questions/linux-software-2/building-firefox-3-6-a-profile-guided-optimization-pgo-automated-build-script-784164/
and the PKGBUILD of this Arch Linux package:
http://aur.archlinux.org/packages/fi/firefox-pgo/PKGBUILD

Ted Mielczarek

unread,
Sep 27, 2011, 10:50:39 AM9/27/11
to Simón ツ, dev-b...@lists.mozilla.org
On Tue, Sep 27, 2011 at 9:26 AM, Simón ツ <si...@simonbcn.net> wrote:
> Yes, you've already said it before but, I repeat, with Ubuntu's gcc
> (4.5.2) if I compile directly with "make -f client.mk profiledbuild"
> or with '...MOZ_PGO=1 in your mozconfig, just "make -f client.mk"',
> the compilation fails with error "jsemit.cpp internal compiler error
> floating point exception". However if I compile (with Ubuntu's gcc
> 4.5.2) first with "make -f client.mk everything" (or "build") and then
> "make -f client.mk profiledbuild", it works well! Then my doubt is:
> is this way valid to compile with PGO? The Firefox compiled in this
> way is really PGO?

Sounds like you need to get a non-broken compiler then. I do not think
what you're doing is a valid way to build PGO. If you're not hitting
the same error, then clearly you're not compiling things the same way!

-Ted

Chris Coulson

unread,
Sep 27, 2011, 10:54:24 AM9/27/11
to dev-b...@lists.mozilla.org
On 27/09/11 15:50, Ted Mielczarek wrote:
> On Tue, Sep 27, 2011 at 9:26 AM, Simón ツ<si...@simonbcn.net> wrote:
>> Yes, you've already said it before but, I repeat, with Ubuntu's gcc
>> (4.5.2) if I compile directly with "make -f client.mk profiledbuild"
>> or with '...MOZ_PGO=1 in your mozconfig, just "make -f client.mk"',
>> the compilation fails with error "jsemit.cpp internal compiler error
>> floating point exception". However if I compile (with Ubuntu's gcc
>> 4.5.2) first with "make -f client.mk everything" (or "build") and then
>> "make -f client.mk profiledbuild", it works well! Then my doubt is:
>> is this way valid to compile with PGO? The Firefox compiled in this
>> way is really PGO?
> Sounds like you need to get a non-broken compiler then. I do not think
> what you're doing is a valid way to build PGO. If you're not hitting
> the same error, then clearly you're not compiling things the same way!
>
> -Ted
> _______________________________________________
> dev-builds mailing list
> dev-b...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-builds
I got a compiler crash the last time I tried to do a PGO build with our
gcc too, which is one reason our builds aren't yet built with PGO.

Regards
Chris

Simón ツ

unread,
Sep 28, 2011, 1:02:42 PM9/28/11
to
On 27 sep, 16:54, Chris Coulson <chrisccoul...@ubuntu.com> wrote:
> On 27/09/11 15:50, Ted Mielczarek wrote:
>
>
>
>
>
>
>
> > On Tue, Sep 27, 2011 at 9:26 AM, Simón ツ<si...@simonbcn.net>  wrote:
> >> Yes, you've already said it before but, I repeat, with Ubuntu's gcc
> >> (4.5.2) if I compile directly with "make -f client.mk profiledbuild"
> >> or with '...MOZ_PGO=1 in your mozconfig, just "make -f client.mk"',
> >> the compilation fails with error "jsemit.cpp internal compiler error
> >> floating point exception". However if I compile (with Ubuntu's gcc
> >> 4.5.2) first with "make -f client.mk everything" (or "build") and then
> >> "make -f client.mk profiledbuild", it works well! Then my doubt is:
> >> is this way valid to compile with PGO? The Firefox compiled in this
> >> way is really PGO?
> > Sounds like you need to get a non-broken compiler then. I do not think
> > what you're doing is a valid way to build PGO. If you're not hitting
> > the same error, then clearly you're not compiling things the same way!
>
> > -Ted
> > _______________________________________________
> > dev-builds mailing list
> > dev-bui...@lists.mozilla.org
> >https://lists.mozilla.org/listinfo/dev-builds
>
> I got a compiler crash the last time I tried to do a PGO build with our
> gcc too, which is one reason our builds aren't yet built with PGO.
>
> Regards
> Chris

But my question is: same compiler and environment.
If I compile directly with "make -f client.mk profiledbuild" it fails.
If I compile first with "make -f client.mk build", then "make -f
client.mk profiledbuild" and it works.
Is the build compiled with the second method (it's the only that it
works with Ubuntu gcc) a valid PGO?
This method (in two steps) is used in some scripts that I found with
Google and in AUR Arch Linux packages.

Ted Mielczarek

unread,
Sep 28, 2011, 1:29:02 PM9/28/11
to Simón ツ, dev-b...@lists.mozilla.org
On Wed, Sep 28, 2011 at 1:02 PM, Simón ツ <si...@simonbcn.net> wrote:
> But my question is: same compiler and environment.
> If I compile directly with "make -f client.mk profiledbuild" it fails.
> If I compile first with "make -f client.mk build", then "make -f
> client.mk profiledbuild" and it works.
> Is the build compiled with the second method (it's the only that it
> works with Ubuntu gcc) a valid PGO?

No, it's not.

-Ted
0 new messages