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

mach build fails #2

Closed
kenz-gelsoft opened this issue Apr 6, 2023 · 12 comments
Closed

mach build fails #2

kenz-gelsoft opened this issue Apr 6, 2023 · 12 comments

Comments

@kenz-gelsoft
Copy link
Owner

~/src/firefox-102.9.0> ./mach build
created virtual environment CPython3.9.16.final.0-64 in 280ms
  creator CPython3Posix(dest=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build, clear=False, no_vcs_ignore=False, global=False)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
Error running mach:

    ['build']

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 build| 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:

FileNotFoundError: [Errno -2147459069] No such file or directory: '/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/lib/python3.9/site-packages/mach.pth'

  File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/base.py", line 859, in activate_virtualenv
    self.virtualenv_manager.activate()
  File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 591, in activate
    self.ensure()
  File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 562, in ensure
    _create_venv_with_pthfile(
  File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 1189, in _create_venv_with_pthfile
    with open(os.path.join(platlib_site_packages_dir, PTH_FILENAME), "w") as f:
@kenz-gelsoft
Copy link
Owner Author

worked around virtualenv misbehavior

~/src/firefox-102.9.0> git diff python/mach/mach/site.py
diff --git a/python/mach/mach/site.py b/python/mach/mach/site.py
index 7065f60020..af1343dd27 100644
--- a/python/mach/mach/site.py
+++ b/python/mach/mach/site.py
@@ -756,7 +756,7 @@ class PythonVirtualenv:
             self.bin_path = os.path.join(prefix, "Scripts")
             self.python_path = os.path.join(self.bin_path, "python.exe")
         else:
-            self.bin_path = os.path.join(prefix, "bin")
+            self.bin_path = os.path.join(prefix, 'non-packaged', "bin")
             self.python_path = os.path.join(self.bin_path, "python")
         self.prefix = prefix
 
@@ -779,7 +779,7 @@ class PythonVirtualenv:
 
         normalized_venv_root = os.path.normpath(self.prefix)
         # Path to virtualenv's "site-packages" directory for provided sysconfig path
-        return os.path.join(normalized_venv_root, relative_path)
+        return os.path.join(normalized_venv_root, 'non-packaged', relative_path)
 
     def site_packages_dirs(self):
         dirs = []

I have no idea why Haiku's virtualenv copys python and site-pacakges inside non-packaged subdir.

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Apr 8, 2023

Start failing on created virtualenv

~/src/firefox-102.9.0> ./mach build
created virtual environment CPython3.9.16.final.0-64 in 229ms
  creator CPython3Posix(dest=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build, clear=False, no_vcs_ignore=False, global=False)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
 0:04.12 Clobber not needed.
 Config object not found by mach.
 0:06.25 Using Python 3.9.16 from /boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python
 0:06.25 Traceback (most recent call last):
 0:06.26   File "/boot/home/src/firefox-102.9.0/configure.py", line 349, in <module>
 0:06.27     sys.exit(main(sys.argv))
 0:06.28   File "/boot/home/src/firefox-102.9.0/configure.py", line 120, in main
 0:06.29     _activate_build_virtualenv()
 0:06.29   File "/boot/home/src/firefox-102.9.0/configure.py", line 343, in _activate_build_virtualenv
 0:06.31     if not build_site.ensure():
 0:06.32   File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 562, in ensure
 0:06.32     _create_venv_with_pthfile(
 0:06.33   File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 1176, in _create_venv_with_pthfile
 0:06.33     subprocess.check_call(
 0:06.34   File "/packages/python3.9-3.9.16-1/.self/lib/python3.9/subprocess.py", line 368, in check_call
 0:06.34     retcode = call(*popenargs, **kwargs)
 0:06.35   File "/packages/python3.9-3.9.16-1/.self/lib/python3.9/subprocess.py", line 349, in call
 0:06.35     with Popen(*popenargs, **kwargs) as p:
 0:06.36   File "/packages/python3.9-3.9.16-1/.self/lib/python3.9/subprocess.py", line 951, in __init__
 0:06.37     self._execute_child(args, executable, preexec_fn, close_fds,
 0:06.37   File "/packages/python3.9-3.9.16-1/.self/lib/python3.9/subprocess.py", line 1823, in _execute_child
 0:06.38     raise child_exception_type(errno_num, err_msg, err_filename)
 0:06.38 FileNotFoundError: [Errno -2147459069] No such file or directory: '/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python'
*** Fix above errors and then restart with "./mach build"

indeed, this time python executable didn't copied into anywhere in the virtualenv subdir.

this output has something to do with this:

 0:04.12 Clobber not needed.
 Config object not found by mach.

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Apr 8, 2023

sys.prefix doesn't work well. working around this

diff --git a/configure.py b/configure.py
index dd12c8f432..7bd11bb637 100644
--- a/configure.py
+++ b/configure.py
@@ -314,7 +314,7 @@ def _activate_build_virtualenv():
     print(f"Using Python {version} from {sys.executable}")
 
     active_site = MozSiteMetadata.from_runtime()
-    if active_site and active_site.site_name == "build":
+    if active_site and active_site.site_name == "build" or '/build/' in sys.executable :
         # We're already running within the "build" virtualenv, no additional work is
         # needed.
         return

Now, next failure

~/src/firefox-102.9.0> ./mach build
 0:02.37 Clobber not needed.
 Config object not found by mach.
 0:03.76 Using Python 3.9.16 from /boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python
 0:03.76 checking for vcs source checkout... git
 0:04.21 checking for a shell... Traceback (most recent call last):
 0:04.21   File "/boot/home/src/firefox-102.9.0/configure.py", line 349, in <module>
 0:04.21     sys.exit(main(sys.argv))
 0:04.21   File "/boot/home/src/firefox-102.9.0/configure.py", line 131, in main
 0:04.22     sandbox.run(os.path.join(os.path.dirname(__file__), "moz.configure"))
 0:04.22   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 506, in run
 0:04.22     self.include_file(path)
 0:04.22   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 497, in include_file
 0:04.24     exec_(code, self)
 0:04.24   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 57, in exec_
 0:04.25     exec(object, globals, locals)
 0:04.26   File "/boot/home/src/firefox-102.9.0/moz.configure", line 219, in <module>
 0:04.27     include("build/moz.configure/toolchain.configure", when="--enable-compile-environment")
 0:04.27   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 866, in include_impl
 0:04.28     self.include_file(what)
 0:04.29   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 497, in include_file
 0:04.29     exec_(code, self)
 0:04.30   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 57, in exec_
 0:04.32     exec(object, globals, locals)
 0:04.33   File "/boot/home/src/firefox-102.9.0/build/moz.configure/toolchain.configure", line 44, in <module>
 0:04.33     include("android-ndk.configure", when=compiling_android)
 0:04.33   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 866, in include_impl
 0:04.35     self.include_file(what)
 0:04.35   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 497, in include_file
 0:04.36     exec_(code, self)
 0:04.37   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 57, in exec_
 0:04.37     exec(object, globals, locals)
 0:04.38   File "/boot/home/src/firefox-102.9.0/build/moz.configure/android-ndk.configure", line 11, in <module>
 0:04.38     def default_android_ndk_root(toolchains_base_dir, _):
 0:04.39   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 849, in decorator
 0:04.39     depends = DependsFunction(self, func, dependencies, when=when)
 0:04.40   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 137, in __init__
 0:04.40     sandbox._value_for(self)
 0:04.41   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.41     return self._value_for_depends(obj)
 0:04.42   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.42     cache[args] = self.func(instance, *args)
 0:04.42   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.42     value = obj.result()
 0:04.43   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.43     cache[args] = self.func(instance, *args)
 0:04.43   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 158, in result
 0:04.43     if self.when and not self.sandbox._value_for(self.when):
 0:04.44   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.44     return self._value_for_depends(obj)
 0:04.45   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.45     cache[args] = self.func(instance, *args)
 0:04.45   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.46     value = obj.result()
 0:04.46   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.47     cache[args] = self.func(instance, *args)
 0:04.47   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 236, in result
 0:04.48     return self._func(resolved_args)
 0:04.48   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 235, in <genexpr>
 0:04.48     resolved_args = (self.sandbox._value_for(d) for d in self.dependencies)
 0:04.48   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.48     return self._value_for_depends(obj)
 0:04.48   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.49     cache[args] = self.func(instance, *args)
 0:04.49   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.50     value = obj.result()
 0:04.53   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.53     cache[args] = self.func(instance, *args)
 0:04.54   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 162, in result
 0:04.54     resolved_args = [self.sandbox._value_for(d) for d in self.dependencies]
 0:04.55   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 162, in <listcomp>
 0:04.55     resolved_args = [self.sandbox._value_for(d) for d in self.dependencies]
 0:04.56   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.56     return self._value_for_depends(obj)
 0:04.57   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.57     cache[args] = self.func(instance, *args)
 0:04.57   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.57     value = obj.result()
 0:04.57   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.57     cache[args] = self.func(instance, *args)
 0:04.57   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 236, in result
 0:04.58     return self._func(resolved_args)
 0:04.58   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 184, in or_impl
 0:04.58     for i in iterable:
 0:04.58   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 235, in <genexpr>
 0:04.58     resolved_args = (self.sandbox._value_for(d) for d in self.dependencies)
 0:04.58   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.58     return self._value_for_depends(obj)
 0:04.58   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.58     cache[args] = self.func(instance, *args)
 0:04.59   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.59     value = obj.result()
 0:04.59   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.59     cache[args] = self.func(instance, *args)
 0:04.59   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 162, in result
 0:04.59     resolved_args = [self.sandbox._value_for(d) for d in self.dependencies]
 0:04.59   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 162, in <listcomp>
 0:04.59     resolved_args = [self.sandbox._value_for(d) for d in self.dependencies]
 0:04.59   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.59     return self._value_for_depends(obj)
 0:04.60   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.60     cache[args] = self.func(instance, *args)
 0:04.60   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.60     value = obj.result()
 0:04.60   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.60     cache[args] = self.func(instance, *args)
 0:04.60   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 162, in result
 0:04.60     resolved_args = [self.sandbox._value_for(d) for d in self.dependencies]
 0:04.61   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 162, in <listcomp>
 0:04.64     resolved_args = [self.sandbox._value_for(d) for d in self.dependencies]
 0:04.65   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.65     return self._value_for_depends(obj)
 0:04.66   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.66     cache[args] = self.func(instance, *args)
 0:04.66   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.66     value = obj.result()
 0:04.66   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.67     cache[args] = self.func(instance, *args)
 0:04.67   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 236, in result
 0:04.68     return self._func(resolved_args)
 0:04.68   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 184, in or_impl
 0:04.68     for i in iterable:
 0:04.68   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 235, in <genexpr>
 0:04.68     resolved_args = (self.sandbox._value_for(d) for d in self.dependencies)
 0:04.68   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:04.68     return self._value_for_depends(obj)
 0:04.68   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.69     cache[args] = self.func(instance, *args)
 0:04.69   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:04.69     value = obj.result()
 0:04.69   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:04.69     cache[args] = self.func(instance, *args)
 0:04.69   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 163, in result
 0:04.69     return self._func(*resolved_args)
 0:04.69   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1310, in wrapped
 0:04.70     return new_func(*args, **kwargs)
 0:04.70   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 910, in wrapper
 0:04.70     ret = template(*args, **kwargs)
 0:04.70   File "/boot/home/src/firefox-102.9.0/build/moz.configure/checks.configure", line 59, in wrapped
 0:04.70     ret = func(*args, **kwargs)
 0:04.70   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1310, in wrapped
 0:04.70     return new_func(*args, **kwargs)
 0:04.70   File "/boot/home/src/firefox-102.9.0/build/moz.configure/init.configure", line 119, in shell
 0:04.71     return find_program(shell)
 0:04.71   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1309, in wrapped
 0:04.71     self._apply_imports(func, glob)
 0:04.71   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 971, in _apply_imports
 0:04.71     self._get_one_import(_from, _import, _as, glob)
 0:04.71   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1107, in _get_one_import
 0:04.71     exec_(import_line, {}, glob)
 0:04.71   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 57, in exec_
 0:04.71     exec(object, globals, locals)
 0:04.71   File "<string>", line 1, in <module>
 0:04.72 ModuleNotFoundError: No module named 'mozfile'
*** Fix above errors and then restart with "./mach build"

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Apr 8, 2023

Installing mozfile from pip proceed build

~/src/firefox-102.9.0> pip install mozfile
Collecting mozfile
  Downloading mozfile-3.0.0-py2.py3-none-any.whl (8.2 kB)
Collecting six>=1.13.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, mozfile
Successfully installed mozfile-3.0.0 six-1.16.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
~/src/firefox-102.9.0> ./mach build
 0:02.48 Clobber not needed.
 Config object not found by mach.
 0:03.90 Using Python 3.9.16 from /boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python
 0:03.90 checking for vcs source checkout... git
 0:04.36 checking for a shell... /bin/sh
 0:04.80 checking for host system type... x86_64-unknown-haiku
 0:04.81 checking for target system type... x86_64-unknown-haiku
 0:09.29 checking whether cross compiling... no
 0:11.03 checking for Python 3... /boot/system/non-packaged/bin/python (3.9.16)
 0:11.05 checking for git... /bin/git
 0:11.11 checking for Git version... 2.37.3
 0:11.12 Traceback (most recent call last):
 0:11.12   File "/boot/home/src/firefox-102.9.0/configure.py", line 349, in <module>
 0:11.12     sys.exit(main(sys.argv))
 0:11.12   File "/boot/home/src/firefox-102.9.0/configure.py", line 131, in main
 0:11.13     sandbox.run(os.path.join(os.path.dirname(__file__), "moz.configure"))
 0:11.13   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 567, in run
 0:11.13     func(*args)
 0:11.14   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 618, in _value_for
 0:11.15     return self._value_for_depends(obj)
 0:11.16   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:11.16     cache[args] = self.func(instance, *args)
 0:11.17   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 627, in _value_for_depends
 0:11.17     value = obj.result()
 0:11.17   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 1061, in method_call
 0:11.18     cache[args] = self.func(instance, *args)
 0:11.18   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 163, in result
 0:11.19     return self._func(*resolved_args)
 0:11.19   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1309, in wrapped
 0:11.19     self._apply_imports(func, glob)
 0:11.19   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 971, in _apply_imports
 0:11.19     self._get_one_import(_from, _import, _as, glob)
 0:11.19   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1107, in _get_one_import
 0:11.19     exec_(import_line, {}, glob)
 0:11.19   File "/boot/home/src/firefox-102.9.0/python/mozbuild/mozbuild/util.py", line 57, in exec_
 0:11.20     exec(object, globals, locals)
 0:11.20   File "<string>", line 1, in <module>
 0:11.20 ModuleNotFoundError: No module named 'mozversioncontrol'
*** Fix above errors and then restart with "./mach build"

sys.path is this

 0:15.52 path=[
'/boot/home/src/firefox-102.9.0/third_party/python/six',
'/boot/home/src/firefox-102.9.0/third_party/python/pyparsing',
'/boot/home/src/firefox-102.9.0/third_party/python/packaging',
'/boot/home/src/firefox-102.9.0/python/mozbuild',
'/boot/home/src/firefox-102.9.0/python/mozboot',
'/boot/home/src/firefox-102.9.0/python/mach'
 '/boot/home/src/firefox-102.9.0',
'/packages/python3.9-3.9.16-1/.self/lib/python39.zip',
'/packages/python3.9-3.9.16-1/.self/lib/python3.9',
'/packages/python3.9-3.9.16-1/.self/lib/python3.9/lib-dynload',
'/packages/python3.9-3.9.16-1/.self/non-packaged/lib/python3.9/site-packages',
'/packages/python3.9-3.9.16-1/.self/lib/python3.9/vendor-packages']

@kenz-gelsoft
Copy link
Owner Author

I'm searching why sys.path is not inherited correctly. But not easy.

~/src/firefox-102.9.0> ./mach build
req_defs: ['build', 'config', 'config/mozunit', 'dom/bindings', 'dom/bindings/parser', 'layout/tools/reftest', 'python/l10n', 'python/mach', 'python/mozboot', 'python/mozbuild', 'python/mozlint', 'python/mozperftest', 'python/mozrelease', 'python/mozterm', 'python/mozversioncontrol', 'security/manager/tools', 'taskcluster', 'testing', 'testing/awsy', 'testing/condprofile', 'testing/firefox-ui/harness', 'testing/marionette/client', 'testing/marionette/harness', 'testing/mozbase/manifestparser', 'testing/mozbase/mozcrash', 'testing/mozbase/mozdebug', 'testing/mozbase/mozdevice', 'testing/mozbase/mozfile', 'testing/mozbase/mozhttpd', 'testing/mozbase/mozgeckoprofiler', 'testing/mozbase/mozinfo', 'testing/mozbase/mozinstall', 'testing/mozbase/mozleak', 'testing/mozbase/mozlog', 'testing/mozbase/moznetwork', 'testing/mozbase/mozpower', 'testing/mozbase/mozprocess', 'testing/mozbase/mozprofile', 'testing/mozbase/mozproxy', 'testing/mozbase/mozrunner', 'testing/mozbase/mozsystemmonitor', 'testing/mozbase/mozscreenshot', 'testing/mozbase/moztest', 'testing/mozbase/mozversion', 'testing/raptor', 'testing/talos', 'testing/web-platform', 'testing/xpcshell', 'toolkit/components/telemetry/tests/marionette/harness', 'tools', 'tools/moztreedocs', 'xpcom/ds/tools', 'xpcom/geckoprocesstypes_generator', 'xpcom/idl-parser']
/bin/python3
active metadata not found
orig: <mach.site.ExternalPythonSite object at 0x14cdfab6b20>
/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
<mach.site.PythonVirtualenv object at 0x14ce08d5460>
Traceback (most recent call last):
  File "/boot/home/src/firefox-102.9.0/./mach", line 96, in <module>
    main(sys.argv[1:])
  File "/boot/home/src/firefox-102.9.0/./mach", line 88, in main
    mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
  File "/boot/home/src/firefox-102.9.0/./mach", line 35, in check_and_get_mach
    return load_mach(dir_path, mach_path)
  File "/boot/home/src/firefox-102.9.0/./mach", line 21, in load_mach
    return mach_initialize.initialize(dir_path)
  File "/boot/home/src/firefox-102.9.0/build/mach_initialize.py", line 153, in initialize
    _activate_python_environment(
  File "/boot/home/src/firefox-102.9.0/build/mach_initialize.py", line 99, in _activate_python_environment
    mach_environment.activate()
  File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 383, in activate
    activate_virtualenv(self._virtualenv())
  File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 1284, in activate_virtualenv
    assert 'mozversioncontrol' in sys.path
AssertionError

@kenz-gelsoft
Copy link
Owner Author

@kenz-gelsoft
Copy link
Owner Author

I thought "mach" venv is not expected state, but:

~/src/firefox-102.9.0> ./mach build
from_prefix=/packages/python3.9-3.9.16-1/.self
metadata file not found path=/packages/python3.9-3.9.16-1/.self/moz_virtualenv_metadata.json
venv_prefix=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
activating...: path=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach/non-packaged/bin:.:/boot/home/config/non-packaged/bin:/boot/home/config/bin:/boot/system/non-packaged/bin:/bin:/boot/system/apps:/boot/system/preferences, prefix=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
update_current_site=mach, prefix=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
current=mach, prefix=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
current=mach, prefix=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
command pkgsrc=SitePackagesSource.VENV
current=mach, prefix=/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach
venv_prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
uptodate=None
will be activated
activating...: path=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin:/boot/home/.mozbuild/srcdirs/firefox-102.9.0-90f8f69e9724/_virtualenvs/mach/non-packaged/bin:.:/boot/home/config/non-packaged/bin:/boot/home/config/bin:/boot/system/non-packaged/bin:/bin:/boot/system/apps:/boot/system/preferences, prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
update_current_site=build, prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
build_command=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
build=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
 0:02.30 Clobber not needed.
 Config object not found by mach.
current=build, prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
command pkgsrc=SitePackagesSource.VENV
venv_prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
uptodate=None
Invoking configure.py bin=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
 0:04.08 Using Python 3.9.16 from /boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python
 0:04.08 from_prefix=/packages/python3.9-3.9.16-1/.self
 0:04.08 metadata file not found path=/packages/python3.9-3.9.16-1/.self/moz_virtualenv_metadata.json
 0:04.08 update_current_site=mach, prefix=None
 0:04.08 current=mach, prefix=/packages/python3.9-3.9.16-1/.self
 0:04.08 Traceback (most recent call last):
 0:04.08   File "/boot/home/src/firefox-102.9.0/configure.py", line 349, in <module>
 0:04.09     sys.exit(main(sys.argv))
 0:04.09   File "/boot/home/src/firefox-102.9.0/configure.py", line 120, in main
 0:04.09     _activate_build_virtualenv()
 0:04.09   File "/boot/home/src/firefox-102.9.0/configure.py", line 337, in _activate_build_virtualenv
 0:04.09     build_site = CommandSiteManager.from_environment(
 0:04.09   File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 516, in from_environment
 0:04.09     active_metadata = MozSiteMetadata.from_runtime()
 0:04.09   File "/boot/home/src/firefox-102.9.0/python/mach/mach/site.py", line 172, in from_runtime
 0:04.10     assert sys.prefix != '/packages/python3.9-3.9.16-1/.self'
 0:04.10 AssertionError
*** Fix above errors and then restart with "./mach build"

but the incorrect mach venv from here. This code expects we're in the "build" venv if this called from mach-managed code.

def _activate_build_virtualenv():
    """Ensure that the build virtualenv is activated

    configure.py may be executed through Mach, or via "./configure, make".
    In the first case, the build virtualenv should already be activated.
    In the second case, we're likely being executed with the system Python, and must
    prepare the virtualenv and activate it ourselves.
    """

    version = ".".join(str(i) for i in sys.version_info[0:3])
    print(f"Using Python {version} from {sys.executable}")

    active_site = MozSiteMetadata.from_runtime()
    if active_site and active_site.site_name == "build":
        # We're already running within the "build" virtualenv, no additional work is
        # needed.
        return

    # We're using the system python (or are nested within a non-build mach-managed
    # virtualenv), so we should activate the build virtualenv as expected by the rest of
    # configure.

    topobjdir = os.path.realpath(".")
    topsrcdir = os.path.realpath(os.path.dirname(__file__))

    mach_site = MachSiteManager(
        topsrcdir,
        None,
        MachEnvRequirements(),
        ExternalPythonSite(sys.executable),
        SitePackagesSource.NONE,
    )
    mach_site.activate()

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Apr 10, 2023

I guess newer python which venv integrated is not compatible with virtualenv.py.

VIRTUALENV environment variable was set, but not to be used. Maybe from this, invoked subprocess doesn't inherit correct sys.prefix

venv_prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
uptodate=None
Invoking configure.py bin=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python prefix=/boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build
 0:03.35 Using Python 3.9.16 from /boot/home/src/firefox-102.9.0/obj-x86_64-unknown-haiku/_virtualenvs/build/non-packaged/bin/python
 0:03.35 from_prefix=/packages/python3.9-3.9.16-1/.self
 0:03.35 metadata file not found path=/packages/python3.9-3.9.16-1/.self/moz_virtualenv_metadata.json

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Apr 10, 2023

FreeBSD port uses autoconf213 and older sourcetree looks supporting it.

https://cgit.freebsd.org/ports/tree/www/firefox-esr/Makefile#n65

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Apr 10, 2023

~/src/firefox-102.9.0/obj-x86_64-unknown-haiku> python3 ../configure.py 
(snip)
checking for llvm_profdata... /bin/llvm-profdata
checking for libpulse... no
ERROR: Package libpulse was not found in the pkg-config search path.
ERROR: Perhaps you should add the directory containing `libpulse.pc'
ERROR: to the PKG_CONFIG_PATH environment variable
ERROR: Package 'libpulse', required by 'virtual:world', not found

--disable-pulseaudio

or

--disable-audio-backends

or

specfying oss(opensound) for audio-backend if no backend isn't allowed.

https://searchfox.org/mozilla-esr102/source/toolkit/moz.configure#267

@kenz-gelsoft
Copy link
Owner Author

@kenz-gelsoft
Copy link
Owner Author

after fixing #9 (comment)

now mach itself start working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant