I want to build Brave from source and I get struck while running npm run build...
(“building”). I am totally new to building apps from source. Please help.
What I did
-
Cloned the repo https://github.com/brave/brave-browser.git
git clone https://github.com/brave/brave-browser.git
-
Checked out the tag v1.49.132
git checkout v1.49.132
-
(Not important) Switched it to a branch
building-from-source
git switch building-from-source
-
Followed this video
-
npm run init -- --target_os=windows --target_arch=windows
This one worked out without any errors but the next step produces the error
-
npm run build Release -- --target_os=windows --target_arch=windows
-
The Error Message
PS E:\Users\Admin\Code\brave-browser> npm run build Release
> [email protected] build
> cd src/brave && npm run build -- Release
> [email protected] build
> node ./build/commands/scripts/commands.js build Release
touch original files overridden by chromium_src...
touch original vector icon files overridden by brave/vector_icons...
update branding...
Recursing through GRD to find GRDP files...
Done recursing through GRD to find GRDP files.
building native redirect_cc...
-------------------------------------------------------------------------------------------------------------------------------------------------
E:\Users\Admin\Code\brave-browser\src
> gn gen E:\Users\Admin\Code\brave-browser\src\out\redirect_cc --args="import(\"//brave/tools/redirect_cc/args.gni\") use_goma=false goma_dir=\"E:\Users\Admin\Code\brave-browser\src\brave\vendor\depot_tools\.cipd_bin\" real_gomacc=\"E:\Users\Admin\Code\brave-browser\src\brave\vendor\depot_tools\.cipd_bin\gomacc\" is_component_build=true "
Traceback (most recent call last):
File "E:/Users/Admin/Code/brave-browser/src/build/toolchain/win/setup_toolchain.py", line 314, in <module>
main()
File "E:/Users/Admin/Code/brave-browser/src/build/toolchain/win/setup_toolchain.py", line 272, in main
env = _LoadToolchainEnv(cpu, toolchain_root, win_sdk_path, target_store)
File "E:/Users/Admin/Code/brave-browser/src/build/toolchain/win/setup_toolchain.py", line 172, in _LoadToolchainEnv
raise Exception('%s is missing - make sure VC++ tools are installed.' %
Exception: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcvarsall.bat is missing - make sure VC++ tools are installed.
ERROR at //build/toolchain/win/toolchain.gni:545:24: Script returned non-zero exit code.
win_toolchain_data = exec_script("//build/toolchain/win/setup_toolchain.py",
^----------
Current dir: E:/Users/Admin/Code/brave-browser/src/out/redirect_cc/
Command: E:/Users/Admin/Code/brave-browser/src/brave/vendor/depot_tools/bootstrap-2@3_8_10_chromium_26_bin/python3/bin/python3.exe E:/Users/Admin/Code/brave-browser/src/build/toolchain/win/setup_toolchain.py "C:\Program Files/Microsoft Visual Studio/2022/Community" "C:\Program Files (x86)\Wiam Files (x86)\Windows Kits\10" "C:\Windows\System32;C:\Windows\SysWOW64;Arm64Unused" win x86 environment.x86
Returned 1.
See //build/toolchain/win/BUILD.gn:34:3: whence it was called.
win_toolchains("x86") {
^----------------------
See //BUILD.gn:83:1: which caused the file to be included.
group("gn_all") {
^----------------
null
null
It says VC++ tools are missing (Visual C++) but I installed them and I have them.
What do I do?
System Information
- Edition Windows 10 Pro
- Version 22H2
- Installed on 20-08-2022
- OS build 19045.2728
- Experience Windows Feature Experience Pack 120.2212.4190.0
- Processor Intel(R) Core™ i5-2400S CPU @ 2.50GHz 2.50 GHz
- Installed RAM 8.00 GBSystem type 64-bit operating system, x64-based processor
- Windows SDK version 10.0.20348.0
Update on this issue
I re-installed the required and did
npm run build Release
and got this error message.
E:\Users\Admin\Code\brave-browser>npm run build Release
> [email protected] build
> cd src/brave && npm run build -- Release
> [email protected] build
> node ./build/commands/scripts/commands.js build Release
touch original files overridden by chromium_src...
touch original vector icon files overridden by brave/vector_icons...
update branding...
Recursing through GRD to find GRDP files...
Done recursing through GRD to find GRDP files.
generating ninja files...
update omaha midl files...
Widevine cdm host verification is disabled
----------------------------------------------------------------------------------------------------------------------------------
E:\Users\Admin\Code\brave-browser\src
> gn gen E:\Users\Admin\Code\brave-browser\src\out\Release --args="sardine_client_id=\"\" sardine_client_secret=\"\" is_asan=falseull_stack_frames_for_profiling=false v8_enable_verify_heap=false disable_fieldtrial_testing_config=true safe_browsing_mode=1 brave_key=\"\" root_extra_deps=[\"//brave\"] is_component_build=false is_universal_binary=false proprietary_codecs=true ffmpeg_branding\" branding_path_component=\"brave\" branding_path_product=\"brave\" enable_nacl=false enable_widevine=true target_cpu=\"x64\" is_build=true is_debug=false dcheck_always_on=false brave_channel=\"\" brave_google_api_key=\"AIzaSyAREPLACEWITHYOUROWNGOOGLEAPIKEY2Qgoogle_api_endpoint=\"https://www.googleapis.com/geolocation/v1/geolocate?key=\" google_default_client_id=\"\" google_default_clie=\"\" brave_infura_project_id=\"\" bitflyer_client_id=\"\" bitflyer_client_secret=\"\" bitflyer_staging_client_id=\"\" bitflyer_stent_secret=\"\" bitflyer_staging_url=\"\" gemini_api_url=\"\" gemini_api_staging_url=\"\" gemini_oauth_url=\"\" gemini_oauth_stagi\" gemini_wallet_client_id=\"\" gemini_wallet_client_secret=\"\" gemini_wallet_staging_client_id=\"\" gemini_wallet_staging_client"\" uphold_client_id=\"\" uphold_client_secret=\"\" uphold_staging_client_id=\"\" uphold_staging_client_secret=\"\" brave_version_\" brave_version_minor=\"49\" brave_version_build=\"132\" chrome_version_string=\"111.0.5563.147\" brave_sync_endpoint=\"\" safebri_endpoint=\"\" brave_variations_server_url=\"\" updater_prod_endpoint=\"\" updater_dev_endpoint=\"\" webcompat_report_api_endpoin://webcompat.brave.com/1/webcompat\" rewards_grant_dev_endpoint=\"\" rewards_grant_staging_endpoint=\"\" rewards_grant_prod_endpoirave_stats_api_key=\"\" brave_stats_updater_url=\"\" enable_hangout_services_extension=true enable_cdm_host_verification=false enaolocales=false skip_signing=true sparkle_dsa_private_key_file=\"\" sparkle_eddsa_private_key=\"\" sparkle_eddsa_public_key=\"\" uslse use_libfuzzer=false enable_updater=true enable_update_notifications=true chrome_pgo_phase=0 cc_wrapper=\"E:\Users\Admin\Code\brave-browser\src\out\redirect_cc\redirect_cc\" enable_brave_page_graph=true enable_brave_page_graph_webapi_probes=true "
ERROR at //brave/components/constants/BUILD.gn:16:3: Assertion failed.
assert(brave_services_key != "")
^-----
See //brave/components/update_client/sources.gni:6:41: which caused the file to be included.
brave_components_update_client_deps = [ "//brave/components/constants" ]
^-----------------------------
null
null
As this person on reddit said to do
npm run build Static
I did so and got a different error message.
I am sharing it as an image due to the limit in the length of text.