Mouse Lock Implementation FAQ
- 1 Introduction
- 2 Questions
- 2.1 Why are we using github instead of Mozilla's Mercurial repo?
- 2.2 How do I build Firefox?
- 2.3 What's the difference between a DEBUG and RELEASE build?
- 2.4 How do I create a DEBUG build?
- 2.5 How do I get my build to go faster?
- 2.6 How do I resolve the windows line ending error when trying to build FireFox?
- 2.7 Greg: How do I resolve the error where CL cannot be found?
- 2.8 Greg: How do I resolve the atlbase.h being missing?
- 3 Discussion
This page is a catch-all for questions about the work to implement Mouse Lock. Ask or answer any questions below using the style already started. Questions relating to anything around this work are acceptable (development issues, build problems, source code questions, spec issues, etc.). Don't be afraid, just ask! Don't judge others, just answer!
Why are we using github instead of Mozilla's Mercurial repo?
So that we don't have to learn yet another version control system. We've already learned git and github, why switch now? Mozilla's Mercurial repo is mirrored on github, and our repo is a fork of this. The main github repo (e.g., https://github.com/doublec/mozilla-central) gets updated regularly, so you can pull from it to keep your fork in sync.
How do I build Firefox?
What's the difference between a DEBUG and RELEASE build?
With a DEBUG build you can attach a debugger or use various logging and instrumentation in order to see how your source code works. A RELEASE build removes this, and optimizes your code.
How do I create a DEBUG build?
You need to add info to your .mozconfig file, see https://developer.mozilla.org/en/Configuring_Build_Options
ac_add_options --disable-optimize ac_add_options --enable-debug
How do I get my build to go faster?
Use Linux if you can (faster I/O), use more RAM if you can. Make sure you enable parallel make jobs so you can take advantage of your CPU cores. In your .mozconfig, add a j value that is 2*cores+1 or at least 2:
How do I resolve the windows line ending error when trying to build FireFox?
For more information, this is the error I get.
client.mk:121: *** This source tree appears to have Windows-style line endings. To convert it to Unix-style line endings, run "python mozilla/build/win32/mozilla-dos2unix.py". Stop.
The python code will not work because it's trying to look for a CVS directory that does not exist in the mozilla-central folder.
Answer 1: We should file a bug on this and get the script + error message fixed. Ask on irc for tips on how to do this, or we can do on Tuesday.
Answer 2: This happens because the default setting for msys git on Windows is to checkout files with CRLF line endings. To fix this, you need to reinstall msys git and when you get to Configure the line ending conversions, choose option 2 Checkout as-is, commit Unix-style line endings here http://help.github.com/images/bootcamp/bootcamp_1_win_install_7.jpg. Once you've reinstalled msys git, you need to checkout the repository with the correct LF line endings with the following commands:
git ls-files -z | xargs -0 rm; git checkout .
Answer 3: Before cloning the repository, set the core.autocrlf to false by using the following line.
git config --global core.autocrlf false
Afterwards, you can freely clone the repository and the build should now work.
Greg: How do I resolve the error where CL cannot be found?
this is the error that comes up:
checking whether the C compiler (cl ) works... no configure: error: installation or configuration problem: C compiler cannot create executables. Fix above errors and then restart with "make -f client.mk build" make: *** [configure] Error 1 make: Leaving directory `/d/proj/mozilla' make: *** [/d/proj/mozilla/obj-i686-pc-mingw32/Makefile] Error 2
This error is due to the .bat file not being able to find the vcvars32 or 64 file. This is because when we run the wrong .bat file. When the file says -x64 after it, for example 'start-msvc9-x64' it is not necessarily saying this needs to be run in a 64 bit operating system but instead if you look inside the bat file you will see that this pretty much just means that it will be looking for the vcvars file in %VC9EXPRESSDIR%\bin\amd64\vcvars64.bat instead of Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat so make sure you are running the correct batch file and if you get this error check the path in the file to make sure it goes to the right place.
Greg: How do I resolve the atlbase.h being missing?
While running the make command, you get an error saying that atlbase.h file is missing!
Apparently this is a very much known issue because apparently VS 2008 express does not come with this file, while the Professional version does come with it. Mozilla gives the workaround of downloading the last version of of microsoft SDK which came with this file which is 2003. https://developer.mozilla.org/en/atlbase.h. After you install it close and open the bat file again and rerun the make file.
NorthWind87: With regard to the "windows line error" question, is it not enough to simply set core.autocrlf to false and core.eol to lf?
git config --unset core.autocrlf git config --global --unset core.autocrlf git config --global core.autocrlf false git config --unset core.eol git config --global --unset core.eol git config --global core.eol lf git ls-files -z | xargs -0 rm; git checkout .
That should be enough to avoid checking out crlf in the future and to checkout the repo again with lf line endings for all files.