Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

FAQ de Compilação da Mozilla

Questões Gerais

Quais sistemas são suportados plataformas de compilação Mozilla?
Ver Supported build configurations.

Localizando erros

A Compilação falhou sem qualquer mensagem de erro, como eu posso encontrar o problema?
No seu diretório obj, vá para o diretório no qual de compilação falhou e o tipo make (ou gmake se necessario). Isso vai relançar a compilação para este pedaço de código específico, exibindo mensagens de erro mais detalhadas.

Questões específicas do Win32

Nota: Veja Windows Build Prerequisites para obter informações adicionais.
configure: error: installation or configuration problem: C compiler cannot create executables.
Look at the config.log in the obj... directory. Try checking to make sure your PATH variable includes all the necessary directories. If you are using mozilla-build, then you need to start ming32 with one of the start-msvc*.bat files. If your build environment has changed, you may need to delete your config.cache file (in your mozilla or object directory) and then build again.
xpt_link.exe: cannot find msvcr80d.dll.
This occurs with option --enable-optimize=-Od to disable any optimizations. The xpt_link.exe tool is also created using this -Od option. To fix this, copy obj-dir/xpcom/typelib/xpt/tools/xpt_link.exe.manifest to obj-dir/dist/bin. There is another manifest file there, for xpt_dump.exe. Copy that as well. This error will probably appear for any compiled tool that is used during the build process when -Od is specified. To copy all manifest files to the dist/bin directory, issue: find ./ -iname *.exe.manifest -print0 | xargs -0 -t -i cp {} dist/bin from the obj-dir
client.mk:121 *** This source tree appears to have Windows-style line endings.
This occurs when you are using git and do not have the proper line ending settings. The commands to set the proper line endings are:
git config core.autocrlf false
git config core.eof lf
git ls-files -z | xargs -0 rm
git checkout .

Mingw32-specific questions

  • If the configure or build fails due to a missing w32api, add the mingw32's /include directory to the end of your INCLUDE environment variable. Mingw32 libraries or binaries should not be needed, only the headers.

Unix-specific questions

How do I build on Solaris 10 x86?
See Solaris Build Prerequisites.

Mac-specific questions

 
It doesn't work
That's not a question :) For common Mac build errors and additional troubleshooting tips, see Troubleshooting in Mac OS X Build Prerequisites.  In particular, bootstrap.py can diagnose and suggest fixes for most common errors (wrong Xcode version, missing build dependencies).
curl https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py > bootstrap.py && python bootstrap.py
 
Can I build a Mozilla application as a Universal Binary?
Yes. See Mac OS X Universal Binaries for instructions.

Fazer Compilar mais rápido

Simply set the integer value after -j to the max number of parellel processes to use. For optimal builds, this should be around the number of processor cores in your system.

See also Incremental Build.
 
Windows builds using make are slow, is there any way to speed them up?

Yes! You should be using PyMake instead. PyMake recurses in a single process reducing the number of shell invocations, which are particularly expensive on Windows. PyMake also allows for parallel builds on Windows without deadlocks.

Do parallel (make -j) builds work for Mozilla?

Yes. See the GNU Make Parallel Execution manual entry for optimal usage.

On Windows you must use PyMake if doing parallel builds (see above - keep in mind this is done automatically if building with mach).

As of December 2012, running builds through mach or client.mk will result in the optimal values being passed to make automatically. If you would like to change the default values, add something like the following to your mozconfig file:

mk_add_options MOZ_MAKE_FLAGS=-j8
I have less than 4GB RAM, is there any way I can speed up linking?

Yes, disabling debugging symbols can speed up linking considerably. Add the following to your .mozconfig:

ac_add_options --disable-debug-symbols
How can I turn on distcc to help compilation?

In your .mozconfig file, add:

mk_add_options MOZ_MAKE_FLAGS="CC='distcc gcc' CXX='distcc g++' -jN"

See the notes for parallel builds.

Can I use ccache to speed up builds?

Yes. See the ccache page for more details. Use of ccache is highly encouraged to speed up builds.

Where else can I save cycles?
Redirecting stdout, rather than dumping it into a terminal, can save between 30 seconds and 5 minutes on a build. Displaying lots of text is slow!

Build configurations

Can I build multiple Mozilla-based projects from a single source tree?
Yes! Each project must be built in its own objdir.
What is a .mozconfig file?
It tells which Mozilla application to build and contains configuration options. See Using a .mozconfig configuration file.
What is an objdir?

An objdir build refers to the process of creating the output files in a different place than where the source lives. This is a standard feature of most configure-based projects. It allows you to build for multiple configurations, including multiple platforms if you use a network filesystem, from a single source tree. It also avoids tainting your source tree so that you know that the files in your tree have not been modified by the build process.

If you run configure by hand, you can use the standard method of creating an empty directory any place on the disk, changing to that directory and running /path/to/mozilla/configure from there.

mkdir obj-debug
cd obj-debug
../mozilla/configure

If you use client.mk to build, you can add the following to your mozconfig file:

mk_add_options MOZ_OBJDIR=/path/to/objdir
Can I cross-compile Mozilla?
Yes, see the Cross-Compiling Mozilla document for details.
How do I force the build system to pick up any of the changes made to my mozconfig file?
Touch any of the configure scripts in the tree. There is no explicit dependency upon the mozconfig file as the file can reside anywhere via the MOZCONFIG environment variable.
 

Implementation questions

What type of build system does Mozilla use?
Mozilla uses a thin GNU configure layer on top of a recursive makefile build system on all platforms. Like most configure-based projects, it uses GNU autoconf to generate the configure script. GNU make is used to drive the build process.
Why use GNU make?
GNU make has been ported to a lot of systems. This makes porting Mozilla to those systems a bit easier. Using only the subset of make features that are supported by the native make program on 10 different platforms would make the build system unnecessarily complicated.
Will any other version of make work?
No. The Mozilla makefiles use GNU make specific features which will only work with gnu make.
Why aren't you using automake?
Part of Netscape's legacy system involved using GNU make's -include feature to include a common set of rules from a handful of files in every Makefile that needed to use them. With this centralized rule system, one of the primary selling points of automake was made inconsequential. Also, at the time, Mozilla's method of building libraries did not mesh well with libtool.
What happened to the nmake and CodeWarrior build systems?
They no longer exist in the current tree. nmake build support was dropped during the Mozilla 1.2a release cycle. The Mac CFM build system was dropped along with OS 9 support shortly after the Mozilla 1.3 release.
Why not ant, tmake, scons or insert your favorite build system here?
Mainly, because no one has implemented these systems for Mozilla. When Mozilla was first open sourced, it only contained the legacy Netscape system. The autoconf layer was added on a branch and maintained in parallel for 6 months before it became the standard build system for the unix build. Several experimental ports to various systems have failed because of the size of the project. Because building Mozilla involves much more than just compiling, any port requires system investment in creating custom rules.
If I wanted to implement my favorite build system for Mozilla, would Mozilla start using it? I don't want to waste my time if you aren't going to use it.
There's no guarantee that any code written for Mozilla will be accepted into the default tree. Any build system that is implemented would have to show that it's better overall than the current build system. Speed, flexibility, portability and the ability for a large group of developers who have 3+ years experience with the current build system to easily transition to the new system would be the major factors in deciding to switch. If you are serious and willing to do lots of work, contact User:Benjamin Smedberg to discuss the details of your proposal.
Why doesn't Mozilla support autoconf 2.5x?

Simply put, autoconf 2.5x does not offer anything to make the upgrade worth the effort. Autoconf 2.5x is not backwards compatible with autoconf 2.13 and the additional restrictions made by the newer versions of autoconf would require a major rewrite of the Mozilla build system for questionable gain.

Some of the 2.13 features, such as the ability to pass additional arguments to sub-configures, are not available in 2.5x. People have asked repeated about those features on the autoconf mailing list without any favorable response. Rewriting the configures of the sub-projects of Mozilla (NSPR & LDAP) is not an acceptable tradeoff. The sub-projects are also standalone projects and forking an entire codebase because of a build system incompatiblity is silly.

Why doesn't NSS use autoconf?
The NSS project is also used outside of the Mozilla project and the NSS project members did not feel that moving to autoconf was worth the cost. See bug 52990 for details.

See also

Etiquetas do documento e colaboradores

 Colaboradores desta página: tfsthiago11121
 Última atualização por: tfsthiago11121,