chromiumninja

Failed to build chromium, ValueError: path is on mount '\\\\tab_group_types.mojom-webui.js'


I'm trying to compile chromium from its source on Windows. Everything seemed working until I got this error:

[22813/52631] ACTION //chrome/browser/ui/webui/tab_search:...indings_ts__generator(//build/toolchain/win:win_clang_x64)
FAILED: gen/chrome/browser/ui/webui/tab_search/tab_search.mojom-webui.ts
D:/depot_tools/bootstrap-2@3_11_6_chromium_30_bin/python3/bin/python3.exe ../../mojo/public/tools/bindings/mojom_bindings_generator.py --use_bundled_pylibs -o gen generate -d ../../ -I ../../ --bytecode_path gen/mojo/public/tools/bindings --filelist=__chrome_browser_ui_webui_tab_search_mojo_bindings_ts__generator___build_toolchain_win_win_clang_x64__rule..rsp -g typescript --scrambled_message_id_salt_path ../../chrome/VERSION
Traceback (most recent call last):
  File "d:\chromium\src\mojo\public\tools\bindings\mojom_bindings_generator.py", line 418, in <module>
    ret = main()
          ^^^^^^
  File "d:\chromium\src\mojo\public\tools\bindings\mojom_bindings_generator.py", line 413, in main
    return args.func(args, remaining_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\chromium\src\mojo\public\tools\bindings\mojom_bindings_generator.py", line 275, in _Generate
    processor._GenerateModule(
  File "d:\chromium\src\mojo\public\tools\bindings\mojom_bindings_generator.py", line 243, in _GenerateModule
    generator.GenerateFiles(filtered_args)
  File "d:\chromium\src\mojo\public\tools\bindings\generators\mojom_ts_generator.py", line 264, in GenerateFiles
    self.WriteWithComment(self._GenerateWebUiModule(),
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\chromium\src\mojo\public\tools\mojom\mojom\generate\template_expander.py", line 34, in GeneratorInternal
    parameters = generator(*args, **kwargs2)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\chromium\src\mojo\public\tools\bindings\generators\mojom_ts_generator.py", line 250, in _GenerateWebUiModule
    return self._GetParameters()
           ^^^^^^^^^^^^^^^^^^^^^
  File "d:\chromium\src\mojo\public\tools\bindings\generators\mojom_ts_generator.py", line 216, in _GetParameters
    self._GetJsModuleImports(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\chromium\src\mojo\public\tools\bindings\generators\mojom_ts_generator.py", line 617, in _GetJsModuleImports
    os.path.relpath(
  File "<frozen ntpath>", line 766, in relpath
ValueError: path is on mount '\\\\tab_group_types.mojom-webui.js', start on mount 'd:'
[22824/52627] CXX obj/v8/cppgc_base/compactor.obj
ninja: build stopped: subcommand failed.

I'm trying to build a specific tag of chromium, not main branch.

I tried to build it several times, searched the web but I don't have any idea what the problem is.


Solution

  • I had come across this same bug too. This bug is in this method:

    def _GetWebUiModulePath(module): 
    

    So, you will have to find that function in this file and modify it:

    src\mojo\public\tools\bindings\generators\mojom_ts_generator.py 
    

    Here's how I managed to fix it:

      # Existing code in that function
      path = module.metadata.get('webui_module_path')
    
      # Add the below lines
      if path == '':
        path = '/'
      if path is None or path == '/':
        return path
    
      # Existing code in that function
      if _IsAbsoluteChromeResourcesPath(path):
    

    Now, try rebuilding again. It should work