Closed Bug 1396494 Opened 7 years ago Closed 6 years ago

mach bootstrap| possibly fails at accepting Android SDK license stage

Categories

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

Unspecified
Linux
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: JanH, Unassigned)

Details

According to bug 1394879 comment 5, we might be having some problems there
@Suneet:

As a workaround, do things work if you add the "--no-interactive" command line option to the bootstrap script?
Please choose the version of Firefox you want to build:
1. Firefox for Desktop Artifact Mode
2. Firefox for Desktop
3. Firefox for Android Artifact Mode
4. Firefox for Android
Your choice: 3
Executing as root: sudo apt-get install -y autoconf2.13 build-essential ccache python-dev python-pip python-setuptools unzip uuid zip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
autoconf2.13 is already the newest version (2.13-67).
uuid is already the newest version (1.6.2-1.5build2).
build-essential is already the newest version (12.1ubuntu2).
ccache is already the newest version (3.2.4-1).
python-dev is already the newest version (2.7.11-1).
python-setuptools is already the newest version (20.7.0-1).
unzip is already the newest version (6.0-20ubuntu1).
zip is already the newest version (3.0-11).
python-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Executing as root: sudo dpkg --add-architecture i386
Executing as root: sudo apt-get update -y
Hit:1 http://in.archive.ubuntu.com/ubuntu xenial InRelease          
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:3 http://archive.ubuntu.com/ubuntu xenial InRelease                        
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB]   
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]       
Get:6 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]    
Get:7 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [167 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [5,888 B]
Get:9 http://in.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [354 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [146 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [529 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [87.1 kB]
Get:13 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [48.9 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [69.1 kB]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [354 kB]
Get:16 http://in.archive.ubuntu.com/ubuntu xenial-security/main i386 Packages [331 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [331 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [506 kB]
Get:19 http://in.archive.ubuntu.com/ubuntu xenial-security/main Translation-en [155 kB]
Get:20 http://in.archive.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [59.9 kB]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [155 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [59.9 kB]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [57.0 kB]
Get:24 http://in.archive.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [57.0 kB]
Get:25 http://in.archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [167 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [209 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [171 kB]
Get:28 http://in.archive.ubuntu.com/ubuntu xenial-security/universe i386 Packages [146 kB]
Get:29 http://in.archive.ubuntu.com/ubuntu xenial-security/universe Translation-en [87.1 kB]
Get:30 http://in.archive.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [48.9 kB]
Get:31 http://archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [226 kB]
Get:32 http://in.archive.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [69.1 kB]
Get:33 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [632 kB]
Get:34 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [632 kB]
Get:35 http://in.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [607 kB]
Get:36 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [607 kB]
Get:37 http://in.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [261 kB]
Get:38 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [305 kB]
Get:39 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [261 kB]
Get:40 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [305 kB]
Get:41 http://in.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [210 kB]
Hit:42 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Hit:43 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted i386 Packages
Hit:44 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en
Hit:45 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 DEP-11 Metadata
Get:46 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [529 kB]
Ign:42 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:43 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted i386 Packages
Ign:44 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en
Get:47 http://archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [210 kB]
Get:48 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [506 kB]
Get:49 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [209 kB]
Get:50 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [171 kB]
Get:51 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [226 kB]
Ign:42 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:43 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted i386 Packages
Ign:44 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en
Get:42 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.6 kB]
Get:43 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted i386 Packages [13.6 kB]
Get:44 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,767 B]
Fetched 10.7 MB in 38s (278 kB/s)                                              
Reading package lists... Done
Executing as root: sudo apt-get install -y default-jdk wget libncurses5:i386 libstdc++6:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
default-jdk is already the newest version (2:1.8-56ubuntu2).
libncurses5:i386 is already the newest version (6.0+20160213-1ubuntu1).
libstdc++6:i386 is already the newest version (5.4.0-6ubuntu1~16.04.4).
wget is already the newest version (1.17.1-1ubuntu1.2).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Looks like you have the Android SDK installed at:
/home/suneetsri/.mozbuild/android-sdk-linux
We will install all required Android packages.


We are now installing the following Android packages:
platform-tools
build-tools;23.0.3
platforms;android-23
extras;android;m2repository
extras;google;m2repository

You may be prompted to agree to the Android license. You may see some of
output as packages are downloaded and installed.

Warning: File /home/suneetsri/.android/repositories.cfg could not be loaded.

Getting this ! Doesn't works
./mach bootstrap works for me
But I get error after running ./mach build 

0:18.48 Checking the license for package Android SDK Build-Tools 25.0.3 in /Users/tnguyen/.mozbuild/android-ndk-r15c/licenses
 0:18.48 Warning: License for package Android SDK Build-Tools 25.0.3 not accepted.
 0:18.48 Checking the license for package Android SDK Platform 23 in /Users/tnguyen/.mozbuild/android-ndk-r15c/licenses
 0:18.48 Warning: License for package Android SDK Platform 23 not accepted.
 0:18.48
 0:18.48 FAILURE: Build failed with an exception.
 0:18.48
 0:18.48 * What went wrong:
 0:18.48 A problem occurred configuring project ':app'.
 0:18.49 > You have not accepted the license agreements of the following SDK components:
 0:18.49   [Android SDK Platform 23, Android SDK Build-Tools 25.0.3].
 0:18.49   Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
 0:18.49   Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
 0:18.49
 0:18.49 * Try:
 0:18.49 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 0:18.49

It doesn't work even after running ./sdkmanager --licenses
My platform is OS X 10.11.4. Jan, any advice? Thanks
Flags: needinfo?(jh+bugzilla)
Sorry, no. I filed this bug for a contributor, but somehow that problem resolved itself and I've got no idea how.
Flags: needinfo?(jh+bugzilla) → needinfo?(nalexander)
> ./mach bootstrap works for me
> But I get error after running ./mach build 
> 
> 0:18.48 Checking the license for package Android SDK Build-Tools 25.0.3 in
> /Users/tnguyen/.mozbuild/android-ndk-r15c/licenses

This looks a little off; my guess is that your mozconfig is incorrect.  You've got an NDK path where your SDK path should be.  You want something like:

ac_add_options --with-android-sdk="/Users/nalexander/.mozbuild/android-sdk-macosx"
ac_add_options --with-android-ndk="/Users/nalexander/.mozbuild/android-ndk-r11c"

Can you verify and, if I'm incorrect, post your mozconfig?
Flags: needinfo?(nalexander) → needinfo?(tnguyen)
Here's output of my running ./mach bootstrap:

Please choose the version of Firefox you want to build:
1. Firefox for Desktop Artifact Mode
2. Firefox for Desktop
3. Firefox for Android Artifact Mode
4. Firefox for Android
Your choice: 4
Looks like you have Homebrew installed. We will install all required packages via Homebrew.


Looks like you have the Android NDK installed at:
/Users/tnguyen/.mozbuild/android-ndk-r15c


Looks like you have the Android SDK installed at:
/Users/tnguyen/.mozbuild/android-sdk-macosx
We will install all required Android packages.


We are now installing the following Android packages:
platform-tools
build-tools;25.0.3
platforms;android-23
extras;android;m2repository
extras;google;m2repository
emulator

You may be prompted to agree to the Android license. You may see some of
output as packages are downloaded and installed.

done

....[Running other configs]

Your system should be ready to build Firefox for Android!

Paste the lines between the chevrons (>>> and <<<) into your mozconfig file:

<<<
# Build Firefox for Android:
ac_add_options --enable-application=mobile/android
ac_add_options --target=arm-linux-androideabi

# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="/Users/tnguyen/.mozbuild/android-sdk-macosx"
ac_add_options --with-android-ndk="/Users/tnguyen/.mozbuild/android-ndk-r15c"
>>>


Then I added those lines to mozconfig. Details:

ac_add_options --with-google-api-keyfile=/Volumes/B2G/Projects/mozilla-central/nightlyGoogleKey

# Build Firefox for Android:
ac_add_options --enable-application=mobile/android
ac_add_options --target=arm-linux-androideabi

# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="/Users/tnguyen/.mozbuild/android-sdk-macosx"
ac_add_options --with-android-ndk="/Users/tnguyen/.mozbuild/android-ndk-r15c"

# Write build artifacts to:
mk_add_options MOZ_OBJDIR=./objdir-droid

mk_add_options MOZ_MAKE_FLAGS="-j8"
Flags: needinfo?(tnguyen)
That's... odd.  Can show the output of `find /Users/tnguyen/.mozbuild/android-*/licenses`, and maybe `cat /Users/tnguyen/.mozbuild/android-sdk-macosx/licenses/*`?  I've never seen this before.
Flags: needinfo?(tnguyen)
I have no idea too, but I asked my colleague, and here's something I find:
- After running ./mach bootstrap, there's missing licenses file in .mozbuild/android-ndk-r15c and I have no idea how to accept (even run ./sdkmanager --licenses)
- I tried to use Android studio and point the sdk folder to .mozbuild/android-sdk-macosx, then used the UI to download/update/accept again. Then it's fixed
- I still have to change a bit in local.properties to sdk=android-sdk-macosx (in Android Studio) to build successfully
Flags: needinfo?(tnguyen)
(In reply to Thomas Nguyen[:tnguyen] ni? plz from comment #8)
> I have no idea too, but I asked my colleague, and here's something I find:
> - After running ./mach bootstrap, there's missing licenses file in
> .mozbuild/android-ndk-r15c and I have no idea how to accept (even run
> ./sdkmanager --licenses)

I don't think the Android NDK uses the licenses thing at all.

> - I tried to use Android studio and point the sdk folder to
> .mozbuild/android-sdk-macosx, then used the UI to download/update/accept
> again. Then it's fixed

This is ... odd.

> - I still have to change a bit in local.properties to sdk=android-sdk-macosx
> (in Android Studio) to build successfully

Yeah, I don't really know how to work around this.  It's come up a few times: https://bugzilla.mozilla.org/show_bug.cgi?id=1417537 is the latest ticket, I think.

I'm glad you got it working; I'll leave this open in case somebody else sees this.
Closing per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195

Contact :susheel if you think this bug should be re-opened
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Product: Firefox for Android → Firefox Build System
You need to log in before you can comment on or make changes to this bug.