Sunday, June 14, 2020

Building Firefox on Windows 10

Building Firefox

The build tools linked here https://firefox-source-docs.mozilla.org/setup/windows_build.html do not like spaces in their paths.

For example, ./mach build step will fail with an error: "ERROR: GetShortPathName returned a long path name for C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64\cl.exe" or something like that. A number of solutions suggested here, https://bugzilla.mozilla.org/show_bug.cgi?id=1323381.

This is discussed here https://bugzilla.mozilla.org/show_bug.cgi?id=1323381 I personally do not like enable short names using fsutil because it will slow down directory enumeration. Here is what worked for me,
  • Create a link, a directory junction https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc753194(v=ws.11). The link will obviously have a shorter name with no spaces, for example Mklink /j C:\VS2019 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community The paths as shown in the example is what worked for me

  • Add a new environment path VC_PATH with value C:\VS2019\VC\Tools\MSVC\14.26.28801 make sure the value is actually a valid directory and update it to the latest if necessary.

  • Run (or rerun) ./mach configure. You may have to delete the config.cache file. (There is probably a command to clear a config)

  • Run ./mach build. My build was successful


Summary

  • Mklink /j C:\VS2019 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
  • set VC_PATH=C:\VS2019\VC\Tools\MSVC\14.26.28801 or add it throw the GUI to persist it
  • ./mach configure (you have to delete the existing config.cache
  • ./mach build

Links


Saturday, April 11, 2020

Configure NuGet Cache Directories

Powershell snippets to change where nuget caches packages. As they are, these lines will add a machine-wide environment variable.

[System.Environment]::SetEnvironmentVariable('NUGET_PACKAGES', 'D:\nuget\packages', [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('NUGET_HTTP_CACHE_PATH', 'D:\nuget\v3-cache', [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('NUGET_PLUGINS_CACHE_PATH', 'D:\nuget\plugins-cache', [System.EnvironmentVariableTarget]::Machine)
For more https://docs.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders