Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with building mozjs on Windows #25302

Closed
nipunG314 opened this issue Dec 16, 2019 · 5 comments
Closed

Problem with building mozjs on Windows #25302

nipunG314 opened this issue Dec 16, 2019 · 5 comments

Comments

@nipunG314
Copy link

@nipunG314 nipunG314 commented Dec 16, 2019

Hi, I have been trying to build Servo on Windows machine and I have run into a few problems. By directly following the instructions, I ran into the following problem:

Error running mach:

    ['build', '-d']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

WindowsError: [Error 2] The system cannot find the file specified

  File "C:\Users\Nipun\servo\python\servo\build_commands.py", line 248, in build
    env = self.build_env(target=target, is_build=True, uwp=uwp, features=features)
  File "C:\Users\Nipun\servo\python\servo\command_base.py", line 773, in build_env
    'git', 'rev-parse', '--short', 'HEAD'
  File "C:\Python27\lib\subprocess.py", line 213, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 391, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 641, in _execute_child
    startupinfo)

I fixed this problem by setting an additional parameter in the check_output function in the subprocess module. This is the git diff for the same:

diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 15ec195fd5..f5abd967e9 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -771,10 +771,10 @@ install them, let us know by filing a bug!")
         if os.path.isdir('.git') and is_build:
             git_sha = subprocess.check_output([
                 'git', 'rev-parse', '--short', 'HEAD'
-            ]).strip()
+            ], shell=True).strip()
             git_is_dirty = bool(subprocess.check_output([
                 'git', 'status', '--porcelain'
-            ]).strip())
+            ], shell=True).strip())
 
             git_info.append('')
             git_info.append(six.ensure_str(git_sha))

But now it has a different problem when building mozjs_sys, which can be seen here. The error output is similar to the problem referenced in #22737.

However, updating my llvm version to the latest didn't solve the problem. I'm currently building with llvm-9.0.0 and I'm getting the same error output. I have tried building with the nightly compiler and I have gotten the same problem.

Any suggestions on where I'm going wrong? Also, should I submit a PR for the subprocess module fix?

@nipunG314 nipunG314 changed the title Problem with building mozjs Problem with building mozjs on Windows Dec 16, 2019
@nox
Copy link
Member

@nox nox commented Dec 16, 2019

Why did you need the shell=True part in the first place?

@rasviitanen
Copy link
Contributor

@rasviitanen rasviitanen commented Dec 16, 2019

I think the LLVM version just recently got updated to llvm-9.0.0, you should probably try llvm 8. I had some troubles with llvm-9.0.0 a while back, but it worked with 8.

@pshaughn
Copy link
Member

@pshaughn pshaughn commented Dec 16, 2019

Is there a git.exe on your windows PATH?

@nipunG314
Copy link
Author

@nipunG314 nipunG314 commented Dec 16, 2019

Why did you need the shell=True part in the first place?

Is there a git.exe on your windows PATH?

I figured out what the problem was. In my git installation, there was the git.exe file and a git.bat file that redirected to the executable. The batch file was in my PATH but not the executable. That's why thought git.exe was in my PATH but actually wasn't. I'm not entirely sure why it was installed this way. Adding the executable itself to the PATH fixed the issue.

I think the LLVM version just recently got updated to llvm-9.0.0, you should probably try llvm 8. I had some troubles with llvm-9.0.0 a while back, but it worked with 8.

Alright, I'll try that. Thanks!

@nipunG314
Copy link
Author

@nipunG314 nipunG314 commented Dec 16, 2019

Yeah, downgrading LLVM to 8.1.0 worked. The build is successful and I can load webpages.

@nipunG314 nipunG314 closed this Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.