servo / servo

Servo, the embeddable, independent, memory-safe, modular, parallel web rendering engine

Home Page:https://servo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error building `mozjs_sys` on windows

teymour-aldridge opened this issue · comments

Running ./mach check (Windows 10, Intel x86_64 CPU) results in:

error: failed to run custom build command for `mozjs_sys v0.68.2 (https://github.com/servo/mozjs?rev=de147f0cf52da9c84fa95edf09c5f9f84695088c#de147f0c)`

Caused by:
  process didn't exit successfully: `C:\Users\p2c2e\Desktop\code\servo\target\debug\build\mozjs_sys-38b0f3cc97c850df\build-script-build` (exit code: 
101)
  --- stdout
  cargo:outdir=C:\Users\p2c2e\Desktop\code\servo\target\debug\build\mozjs_sys-b31d306cd726057c\out\build
  [[ 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure -ot 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure.in ]] && touch 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure || true
  [[ 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure -ot 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure.in ]] && touch 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure || true
  ! [[ 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure.in -ot 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure ]] && touch 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure || true
  ! [[ 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure.in -ot 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure ]] && touch 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure || true
  if [[ 'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure -nt config.status ]] ; then \
    PYTHON="C:\Users\p2c2e\AppData\Local\Programs\Python\Python39\python.exe" MOZ_TOOLS="/" \
    CC="clang-cl.exe" CFLAGS="-MD" \
    CPP="" CPPFLAGS="-IC:/Users/p2c2e/.cargo/registry/src/github.com-1ecc6299db9ec823/encoding_c_mem-0.2.6/include " \
    CXX="clang-cl.exe" CXXFLAGS="-MD" \
    AS="" AR="" \
    STLPORT_LIBS="" \
    'C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure --disable-jemalloc --disable-js-shell --disable-tests --disable-export-js --disable-shared-js --build-backends=RecursiveMake --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32 || (cat config.log && exit 1) ; \
  fi

  --- stderr
   - Cannot opencat: config.log: No such file or directory
  mozmake: *** [C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\makefile.cargo:194: maybe-configure] Error 1
  thread 'main' panicked at 'assertion failed: result.success()', C:\Users\p2c2e\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\build.rs:172:5  
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

What happens if you set PYTHON3 to C:\Users\p2c2e\AppData\Local\Programs\Python\Python39\python.exe?

I'm having the same issue.
@jdm you mean setting PYTHON3 as a variable in PATH? I tried so and it solved nothing

I mean setting the PYTHON3 environment variable to point to a python3 binary.

exactly what i've done, this didn't solve the issue:

image

Thanks for your fast response!

by running

$env:RUST_BACKTRACE='1';$env:PYTHON3='C:\Users\Tawfik\AppData\Local\Programs\Python\Python39\python.exe'; ./mach.bat build -d

i get

error: failed to run custom build command for `mozjs_sys v0.68.2 (https://github.com/servo/mozjs?rev=de147f0cf52da9c84fa95edf09c5f9f84695088c#de147f0c)`

Caused by:
  process didn't exit successfully: `D:\dev\servo\target\debug\build\mozjs_sys-38b0f3cc97c850df\build-script-build` (exit code: 101)
  --- stdout
  cargo:outdir=D:\dev\servo\target\debug\build\mozjs_sys-b31d306cd726057c\out\build
  [[ 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure -ot 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure.in ]] && touch 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure || true
  [[ 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure -ot 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure.in ]] && touch 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure || true
  ! [[ 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure.in -ot 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure ]] && touch 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure || true
  ! [[ 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure.in -ot 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure ]] && touch 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/old-configure || true
  if [[ 'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure -nt config.status ]] ; then \
    PYTHON="C:\Users\Tawfik\AppData\Local\Programs\Python\Python39\python.exe" MOZ_TOOLS="/" \
    CC="clang-cl.exe" CFLAGS="-MD" \
    CPP="" CPPFLAGS="-IC:/Users/Tawfik/.cargo/registry/src/github.com-1ecc6299db9ec823/encoding_c_mem-0.2.6/include " \
    CXX="clang-cl.exe" CXXFLAGS="-MD" \
    AS="" AR="" \
    STLPORT_LIBS="" \
    'C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs'/js/src/configure --disable-jemalloc --disable-js-shell --disable-tests --disable-export-js --disable-shared-js --build-backends=RecursiveMake --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32 || (cat config.log && exit 1) ; \
  fi
  Creating Python 3 environment
  created virtual environment CPython3.9.6.final.0-64 in 5195ms
    creator CPython3Windows(dest=D:\Dev\servo\target\debug\build\mozjs_sys-b31d306cd726057c\out\build\_virtualenvs\init_py3, clear=False, no_vcs_ignore=False, global=False)
    seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\Tawfik\AppData\Local\pypa\virtualenv)
      added seed packages: pip==20.3.1, setuptools==57.0.0, wheel==0.36.2
    activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
  Error processing command. Ignoring because optional. (optional:packages.txt:comm/build/virtualenv_packages.txt)
  Traceback (most recent call last):
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 774, in <module>
      manager.populate()
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 466, in populate
      handle_package(package)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 381, in handle_package
      submanager.populate(sitecustomize=sitecustomize)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 466, in populate
      handle_package(package)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 398, in handle_package
      f.write("%s\n" % os.path.relpath(path, python_lib))
    File "C:\Users\Tawfik\AppData\Local\Programs\Python\Python39\lib\ntpath.py", line 703, in relpath
      raise ValueError("path is on mount %r, start on mount %r" % (
  ValueError: path is on mount 'C:', start on mount 'D:'
  DEBUG: python3: running with pid 17156
  DEBUG: python3: sys.executable: 'c:\\Users\\Tawfik\\AppData\\Local\\Programs\\Python\\Python39\\python.exe'
  DEBUG: python3: executable from configuration: 'C:\\Users\\Tawfik\\AppData\\Local\\Programs\\Python\\Python39\\python.exe'
  DEBUG: python3: found executable: 'C:/Users/Tawfik/AppData/Local/Programs/Python/Python39/python.exe'
  INFO: Creating Python 3 environment
  INFO: created virtual environment CPython3.9.6.final.0-64 in 5195ms
  INFO:   creator CPython3Windows(dest=D:\Dev\servo\target\debug\build\mozjs_sys-b31d306cd726057c\out\build\_virtualenvs\init_py3, clear=False, no_vcs_ignore=False, global=False)
  INFO:   seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\Tawfik\AppData\Local\pypa\virtualenv)
  INFO:     added seed packages: pip==20.3.1, setuptools==57.0.0, wheel==0.36.2
  INFO:   activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
  INFO: Error processing command. Ignoring because optional. (optional:packages.txt:comm/build/virtualenv_packages.txt)
  INFO: Traceback (most recent call last):
  INFO:   File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 774, in <module>
  INFO:     manager.populate()
  INFO:   File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 466, in populate
  INFO:     handle_package(package)
  INFO:   File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 381, in handle_package
  INFO:     submanager.populate(sitecustomize=sitecustomize)
  INFO:   File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 466, in populate
  INFO:     handle_package(package)
  INFO:   File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 398, in handle_package
  INFO:     f.write("%s\n" % os.path.relpath(path, python_lib))
  INFO:   File "C:\Users\Tawfik\AppData\Local\Programs\Python\Python39\lib\ntpath.py", line 703, in relpath
  INFO:     raise ValueError("path is on mount %r, start on mount %r" % (
  INFO: ValueError: path is on mount 'C:', start on mount 'D:'

  --- stderr
  Traceback (most recent call last):
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\configure.py", line 231, in <module>
      sys.exit(main(sys.argv))
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\configure.py", line 55, in main
      sandbox.run(os.path.join(os.path.dirname(__file__), "moz.configure"))
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 502, in run
      self.include_file(path)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 493, in include_file
      exec_(code, self)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\util.py", line 55, in exec_
      exec(object, globals, locals)
    File "C:/Users/Tawfik/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/de147f0/mozjs/moz.configure", line 7, in <module>
      include("build/moz.configure/init.configure")
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 853, in include_impl
      self.include_file(what)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 493, in include_file
      exec_(code, self)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\util.py", line 55, in exec_
      exec(object, globals, locals)
    File "C:/Users/Tawfik/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/de147f0/mozjs/build/moz.configure/init.configure", line 241, in <module>
      def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help):
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 836, in decorator
      depends = DependsFunction(self, func, dependencies, when=when)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 137, in __init__
      sandbox._value_for(self)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 614, in _value_for
      return self._value_for_depends(obj)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\util.py", line 1049, in method_call
      cache[args] = self.func(instance, *args)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 623, in _value_for_depends
      value = obj.result()
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\util.py", line 1049, in method_call
      cache[args] = self.func(instance, *args)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 162, in result
      return self._func(*resolved_args)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\configure\__init__.py", line 1298, in wrapped
      return new_func(*args, **kwargs)
    File "C:/Users/Tawfik/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/de147f0/mozjs/build/moz.configure/init.configure", line 354, in virtualenv_python3
      manager.build(python)
    File "C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\mozjs\python\mozbuild\mozbuild\virtualenv.py", line 554, in build
      raise Exception("Error populating virtualenv.")
  Exception: Error populating virtualenv.
  mozmake: *** [C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\makefile.cargo:194: maybe-configure] Error 1
  thread 'main' panicked at 'assertion failed: result.success()', C:\Users\Tawfik\.cargo\git\checkouts\mozjs-fa11ffc7d4f1cc2d\de147f0\build.rs:172:5
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/3e99439f4dacc8ba0d2ca48d221694362d587927\/library\std\src\panicking.rs:515
     1: core::panicking::panic_fmt
               at /rustc/3e99439f4dacc8ba0d2ca48d221694362d587927\/library\core\src\panicking.rs:92
     2: core::panicking::panic
               at /rustc/3e99439f4dacc8ba0d2ca48d221694362d587927\/library\core\src\panicking.rs:50
     3: build_script_build::build_jsapi
               at .\build.rs:172
     4: build_script_build::main
               at .\build.rs:57
     5: core::ops::function::FnOnce::call_once<fn(),tuple<>>
               at /rustc/3e99439f4dacc8ba0d2ca48d221694362d587927\library\core\src\ops\function.rs:227
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
war

@tawfik741 That happens when your CARGO_HOME is in a different drive than your Servo repository. You either need to move your Servo repository to your C: drive or run the build with CARGO_HOME pointing at a directory in your D: drive.

@jdm I'm having the same problem (cargo in C: and Servo in D:), don't really have space left to move Servo to C: and would like to leave cargo there. Is there any other way? Or did I misunderstand what you mean by "CARGO_HOME pointing at a directory in your D: drive"?
Thank you.
If wanted I can add the knowledge gained here if I get it to work.

The only way is to either move Servo to the drive where your default CARGO_HOME lives, or build servo with an independent CARGO_HOME value. It won't affect your existing one, just duplicate any cloned crates that are already present in the original.

@jdm thank you!
Notes at me later:

Edit:
works now, my .vsconfig for VS Build Tools 2019 now looks like this:

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.CoreBuildTools",
    "Microsoft.VisualStudio.Workload.MSBuildTools",
    "Microsoft.VisualStudio.Component.Windows10SDK",
    "Microsoft.VisualStudio.Component.VC.CoreBuildTools",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.Component.VC.ATL",
    "Microsoft.VisualStudio.Component.VC.ATLMFC",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.Workload.VCTools"
  ]
}

I still wonder if some of these could be omitted, but for now this seems okay.