Opened 2 years ago

Last modified 2 years ago

#6474 closed defect

[macOS] Spidermonkey fails to build - part 2 — at Version 4

Reported by: Langbart Owned by:
Priority: Should Have Milestone: Alpha 26
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by Langbart)

to reproduce

  • Try to build Spidermonkey
  • Error
    AttributeError: module 'distutils' has no attribute 'sysconfig'
    ERROR: Error building spidermonkey
    

Around 2 weeks ago a different issue was solved (#6447), between now and then nothing was changed for the patch.sh file.
Why could I build SM 2 weeks ago and now it fails?

Two players (kumikumi and minohaka) have also reported this issue.

07:31 < kumikumi> I spent some time today trying to build the latest release on M1, with not particularly high expectations. I had to upgrade some dependencies and I tried to do something with python and virtualenv, now I'm stuck at "AttributeError: module 'distutils' has no attribute 'sysconfig'"
07:31 < kumikumi> but I think there may still be some bigger obstacles ahead
15:05 < minohaka> I got an m1 mac and python v3.10.0 installed through pyenv
15:06 < minohaka> whenever I try to build the libs I get this error: AttributeError: module 'distutils' has no attribute 'sysconfig'. Did you mean: 'config'?
15:07 <@Stan> Hey minohaka

Both players also tested the special wraitii/0ad/tree/esr91-0AD branch from wraitii and the issue did not occur there.

Traceback

Traceback (most recent call last):
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/../js/src/../../configure.py", line 181, in <module>
    sys.exit(main(sys.argv))
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/../js/src/../../configure.py", line 52, in main
    sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure'))
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 445, in run
    self.include_file(path)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 436, in include_file
    exec_(code, self)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/util.py", line 53, in exec_
    exec(object, globals, locals)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/moz.configure", line 7, in <module>
    include('build/moz.configure/init.configure')
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 773, in include_impl
    self.include_file(what)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 436, in include_file
    exec_(code, self)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/util.py", line 53, in exec_
    exec(object, globals, locals)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/build/moz.configure/init.configure", line 254, in <module>
    def virtualenv_python3(env_python, build_env, mozconfig, help):
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 756, in decorator
    depends = DependsFunction(self, func, dependencies, when=when)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 129, in __init__
    sandbox._value_for(self)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 542, in _value_for
    return self._value_for_depends(obj)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/util.py", line 1018, in method_call
    cache[args] = self.func(instance, *args)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 551, in _value_for_depends
    value = obj.result()
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/util.py", line 1018, in method_call
    cache[args] = self.func(instance, *args)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 155, in result
    return self._func(*resolved_args)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/python/mozbuild/mozbuild/configure/__init__.py", line 1161, in wrapped
    return new_func(*args, **kwargs)
  File "/Users/paria/0ad/libraries/source/spidermonkey/mozjs-78.6.0/build/moz.configure/init.configure", line 378, in virtualenv_python3
    if not distutils.sysconfig.get_python_lib():
AttributeError: module 'distutils' has no attribute 'sysconfig'
ERROR: Error building spidermonkey

possible workaround

Adding the following lines to FixMacBuild.diff solved the problem for me and made it possible to build Spidermonkey.

--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -375,9 +375,6 @@
         sys.exit(subprocess.call([python] + sys.argv))
 
     # We are now in the virtualenv
-    if not distutils.sysconfig.get_python_lib():
-        die('Could not determine python site packages directory')
-
     str_version = '.'.join(str(v) for v in version)
 
     return namespace(

The lines were also removed by mhentges (Mitchell Hentges) with diff D129863 - Bug 1730712: Use consistent Python version throughout configure. Wacky way for the time being to build Spidermonkey until wraitii moves 0 A.D. to SM91.

Change History (4)

comment:1 by Freagarach, 2 years ago

Was your python updated in the meantime?

comment:2 by Langbart, 2 years ago

Description: modified (diff)

Adding the Traceback to the description.

Replying to Freagarach:

Was your python updated in the meantime?

I am testing it with the same Python 3.9.10.

Last edited 2 years ago by Langbart (previous) (diff)

comment:3 by Langbart, 2 years ago

Description: modified (diff)

possible workaround

comment:4 by Langbart, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.