Open Bug 1897167 Opened 1 year ago Updated 7 months ago

`./mach android assemble-app` does not read the correct mozconfig

Categories

(Firefox Build System :: Android Studio and Gradle Integration, task)

task

Tracking

(Not tracked)

People

(Reporter: saschanaz, Unassigned)

Details

During ./mach build I found that the build fails on mach android assembl-app. So I tried running the command separately and got this:

> ./mach android assemble-app
 0:00.73 D:/gecko/gradlew.bat --info geckoview:generateJNIWrappersForGeneratedWithGeckoBinariesDebug -x lint
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf-8
Initialized native services in: C:\Users\sasch\.gradle\native
Initialized jansi services in: C:\Users\sasch\.gradle\native
Received JVM installation metadata from 'C:\Users\sasch\.mozbuild\jdk\jdk-17.0.11+9': {JAVA_HOME=C:\Users\sasch\.mozbuild\jdk\jdk-17.0.11+9, JAVA_VERSION=17.0.11, JAVA_VENDOR=Eclipse Adoptium, RUNTIME_NAME=OpenJDK Runtime Environment, RUNTIME_VERSION=17.0.11+9, VM_NAME=OpenJDK 64-Bit Server VM, VM_VERSION=17.0.11+9, VM_VENDOR=Eclipse Adoptium, OS_ARCH=amd64}
Found daemon DaemonInfo{pid=32880, address=[583e30bf-de64-436f-bcb8-31a12d450e3d port:49760, addresses:[/127.0.0.1]], state=Idle, lastBusy=1713800323329, context=DefaultDaemonContext[uid=049f4062-bc24-4c81-85e0-93dcf2ed86f2,javaHome=C:\Users\sasch\.mozbuild\jdk\jdk-17.0.10+7,daemonRegistryDir=C:\Users\sasch\.gradle\daemon,pid=32880,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=-XX:MaxMetaspaceSize=6g,--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xms2g,-Xmx8g,-Dfile.encoding=utf-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\sasch\.mozbuild\jdk\jdk-17.0.11+9,daemonRegistryDir=C:\Users\sasch\.gradle\daemon,pid=12148,idleTimeout=null,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=-XX:MaxMetaspaceSize=6g,--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xms2g,-Xmx8g,-Dfile.encoding=utf-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=049f4062-bc24-4c81-85e0-93dcf2ed86f2,javaHome=C:\Users\sasch\.mozbuild\jdk\jdk-17.0.10+7,daemonRegistryDir=C:\Users\sasch\.gradle\daemon,pid=32880,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=-XX:MaxMetaspaceSize=6g,--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xms2g,-Xmx8g,-Dfile.encoding=utf-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 31376). The daemon log file: C:\Users\sasch\.gradle\daemon\8.7\daemon-31376.out.log
Starting 9th build in daemon [uptime: 7 mins 16.836 secs, performance: 100%, GC rate: 0.00/s, heap usage: 0% of 8 GiB, non-heap usage: 0% of 6 GiB]
Using 64 worker leases.
Not watching D:\gecko since the file system is not supported
Watching the file system is configured to be enabled if available
File system watching is active
Starting Build
mozconfig.gradle> Loading mach environment into a gradle extension property
settings.gradle> Read local.properties: D:\gecko\local.properties
settings.gradle> Setting mozconfig from local.properties: mozconfig-android-x86-64
mozconfig.gradle> Error running ./mach environment:

Process '[C:\Users\sasch\.mozbuild\srcdirs\gecko-23ebcb979905\_virtualenvs\common\Scripts\python.exe, D:\gecko/mach, environment, --format, json, --verbose]' finished with non-zero exit value 1:

stdout:
Error running mach:

    mach environment --format json --verbose

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 environment`` 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:

mozbuild.base.BuildEnvironmentNotFoundException: config.status not available. Run configure.. Did you mean: '_config_environment'?

  File "D:\gecko\python\mozbuild\mozbuild\mach_commands.py", line 2173, in environment
    return func(command_context, sys.stdout, verbose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\gecko\python\mozbuild\mozbuild\mach_commands.py", line 2247, in _environment_json
    json.dump(command_context, cls=EnvironmentEncoder, sort_keys=True, fp=out)
  File "C:\Users\sasch\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py", line 179, in dump
    for chunk in iterable:
  File "C:\Users\sasch\AppData\Local\Programs\Python\Python312\Lib\json\encoder.py", line 439, in _iterencode
    o = _default(o)
        ^^^^^^^^^^^
  File "D:\gecko\python\mozbuild\mozbuild\mach_commands.py", line 2240, in default
    result["substs"] = obj.substs
                       ^^^^^^^^^^
  File "d:\gecko\python\mozbuild\mozbuild\base.py", line 389, in substs
    return self.config_environment.substs
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\gecko\python\mozbuild\mozbuild\base.py", line 365, in config_environment
    raise BuildEnvironmentNotFoundException(

Sentry event ID: a616cb1140044260b18fc18cfdb55541


stderr:
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit


FAILURE: Build failed with an exception.

* Where:
Script 'D:\gecko\mobile\android\gradle\mozconfig.gradle' line: 39

* What went wrong:
A problem occurred evaluating script.
> Could not run ./mach environment. Try running ./mach build first.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
Watched directory hierarchies: []

I modified the message to include the path in https://searchfox.org/mozilla-central/rev/445a6e86233c733c5557ef44e1d33444adaddefc/python/mozbuild/mozbuild/base.py#364-367 and found that the path points to the default obj path, not the path assigned by mozconfig.

My mozconfig:

# Use this as MOZCONFIG=mozconfig-android-x86-64-dbg

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-android-dbg

mk_add_options AUTOCLOBBER=1
ac_add_options --disable-optimize
ac_add_options --enable-debug

# Build GeckoView/Firefox for Android:
ac_add_options --enable-project=mobile/android
ac_add_options --target=x86_64

I also have mozconfig-android-x86-64 that uses the default obj dir and that's why I haven't met this issue so far. That explains why I couldn't reproduce android debug build issue on my machine...

The severity field is not set for this bug.
:rsainani, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(rsainani)
Flags: needinfo?(rsainani)
Severity: -- → N/A
Type: defect → task
You need to log in before you can comment on or make changes to this bug.