Closed Bug 1179074 Opened 4 years ago Closed 4 years ago

mozglue not found when package is installed into /system and system is arm64-v8a

Categories

(Firefox for Android :: General, defect)

Unspecified
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 42
Tracking Status
firefox41 --- fixed
firefox42 --- fixed
fennec 42+ ---

People

(Reporter: m_kato, Assigned: rnewman)

Details

Attachments

(1 file)

Even if system is arm64-v8a, armv7-a package should be launched.

But when APK is installed into /system, GeckoLoader cannot find mozglue at extractLibrary() by the following error.


06-30 19:43:53.990 F/GeckoLoader(11109): Couldn't load /data/data/org.mozilla.fennec/lib/libmozglue.so: java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/data/org.mozilla.fennec/lib/libmozglue.so" not found
06-30 19:43:54.010 W/GeckoLoader(11109): lib/arm64-v8a/libmozglue.so not found in APK /system/priv-app/fennec/fennec.apk
06-30 19:43:54.010 E/GeckoLoader(11109): Load diagnostics: LOAD mozglue: ABI: arm-eabi-gcc3, arm64-v8a: Data: /data/data/org.mozilla.fennec, ax=false, ddx=false, -1x=false, -2x=false, nativeLib: /system/priv-app/fennec/lib/arm64, dirx=false, libx=false
06-30 19:43:54.010 E/GeckoApp(11109): Exception starting favicon cache. Corrupt resources?
06-30 19:43:54.010 E/GeckoApp(11109): java.lang.RuntimeException: LOAD mozglue: ABI: arm-eabi-gcc3, arm64-v8a: Data: /data/data/org.mozilla.fennec, ax=false, ddx=false, -1x=false, -2x=false, nativeLib: /system/priv-app/fennec/lib/arm64, dirx=false, libx=false
06-30 19:43:54.010 E/GeckoApp(11109): 	at org.mozilla.gecko.mozglue.GeckoLoader.doLoadLibrary(GeckoLoader.java:509)


We should consider load armv7-a so into APK even if default ABI is arm64-v8a.
> We should consider load armv7-a so into APK even if default ABI is arm64-v8a.

What is build target? arm64 or armv7? If the former, then there's something wrong in the apk or something else. If the latter, then the code is wrong assuming the runtime cpu abi is the same as the one from the build.

That being said, are arm64 android systems multi-arch? That is, is an armv7 libc available for armv7 libraries? IOW, is executing armv7 code supposed to work?
> 06-30 19:43:54.010 E/GeckoLoader(11109): Load diagnostics: LOAD mozglue:
> ABI: arm-eabi-gcc3, arm64-v8a

        // These might differ. If so, we know why the library won't load!
        message.append(": ABI: " + AppConstants.MOZ_APP_ABI + ", " + getCPUABI());


    @SuppressWarnings("deprecation")
    private static final String getCPUABI() {
        return android.os.Build.CPU_ABI;
    }


We do lots of things wrong with ABIs from Android's perspective, as I recall.
A reasonable fix is to use SUPPORTED_ABIS instead of getCPUABI:

http://developer.android.com/reference/android/os/Build.html#SUPPORTED_ABIS

and repeat the core of extractLibrary as we walk that list.

If this is urgent, I'm happy to roll up a fix. If it's not urgent, I'd be happy to do so in two or three weeks.
Flags: needinfo?(m_kato)
(In reply to Mike Hommey [:glandium] from comment #1)
> > We should consider load armv7-a so into APK even if default ABI is arm64-v8a.
> 
> What is build target? arm64 or armv7? If the former, then there's something
> wrong in the apk or something else. If the latter, then the code is wrong
> assuming the runtime cpu abi is the same as the one from the build.

APK is armv7-a package.  We have no configuration for Fennec/armv8 

> That being said, are arm64 android systems multi-arch? That is, is an armv7
> libc available for armv7 libraries? IOW, is executing armv7 code supposed to
> work?

Yes. Android/aarch64 works both armv7-a and arm64-v8a.
Flags: needinfo?(m_kato)
(In reply to Richard Newman [:rnewman] from comment #3)
> A reasonable fix is to use SUPPORTED_ABIS instead of getCPUABI:
> 
> http://developer.android.com/reference/android/os/Build.html#SUPPORTED_ABIS
> 
> and repeat the core of extractLibrary as we walk that list.
> 
> If this is urgent, I'm happy to roll up a fix. If it's not urgent, I'd be
> happy to do so in two or three weeks.

This is a partner issue that Karen and Mark know well.  So this is urgent.
Richard - Sounds like you should take a crack at it.

Kato - If Richard's initial fix doesn't work, we'll need to try other options next week.
Flags: needinfo?(rnewman)
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
tracking-fennec: --- → ?
Flags: needinfo?(rnewman)
This simply walks the whole list, not the deprecated single ABI approach; we should fail on v8 then try v7 and succeed.

This passes Try; m_kato, can you test?
Attachment #8628628 - Flags: review?(mh+mozilla)
Attachment #8628628 - Flags: review?(mark.finkle)
I should note: this assumes that this is very modern Android (5.0 or higher), because that's the only place we get SUPPORTED_ABIS.

If you need support on earlier Android versions, then we'll need to do that ABI decision manually, which should be pretty straightforward: either fall back to Build.CPU_ABI2 (effectively construct a two-element SUPPORTED_ABIS), or:

    String abi = getCPUABI();
    if (abi.equals("arm64-v8a")) {
        abi = ...
    }
Comment on attachment 8628628 [details] [diff] [review]
Use all of SUPPORTED_ABIS when loading libraries from APK. v1

Review of attachment 8628628 [details] [diff] [review]:
-----------------------------------------------------------------

I don't know the android APIs enough to say whether this is right, but that looks sound.
Attachment #8628628 - Flags: review?(mh+mozilla) → feedback+
(In reply to Richard Newman [:rnewman] from comment #8)
> Created attachment 8628628 [details] [diff] [review]
> Use all of SUPPORTED_ABIS when loading libraries from APK. v1
> 
> This simply walks the whole list, not the deprecated single ABI approach; we
> should fail on v8 then try v7 and succeed.
> 
> This passes Try; m_kato, can you test?

I have no rooted arm64 device that can install APK into /system.  So I ask partner about it.
But you need not wait their response.
Attachment #8628628 - Flags: review?(mark.finkle) → review+
CCing lizzard in case this means yet another partner respin firedrill.
Comment on attachment 8628628 [details] [diff] [review]
Use all of SUPPORTED_ABIS when loading libraries from APK. v1

Review of attachment 8628628 [details] [diff] [review]:
-----------------------------------------------------------------

snorp should review this before landing
Attachment #8628628 - Flags: review?(snorp)
tracking-fennec: ? → 42+
Technically snorp should review this *after* landing -- Comment 12.
Comment on attachment 8628628 [details] [diff] [review]
Use all of SUPPORTED_ABIS when loading libraries from APK. v1

Review of attachment 8628628 [details] [diff] [review]:
-----------------------------------------------------------------

I was thinking I already fixed something like this another way, but I was just remembering a discussion: https://bugzilla.mozilla.org/show_bug.cgi?id=1084516#c2
Attachment #8628628 - Flags: review?(snorp) → review+
https://hg.mozilla.org/mozilla-central/rev/d77f40e00dc0
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
Comment on attachment 8628628 [details] [diff] [review]
Use all of SUPPORTED_ABIS when loading libraries from APK. v1

Assuming this fixes the issue, let's try to take this for 41.

The fix should be surprisingly low risk, and it's partner-related.
Attachment #8628628 - Flags: approval-mozilla-aurora?
Comment on attachment 8628628 [details] [diff] [review]
Use all of SUPPORTED_ABIS when loading libraries from APK. v1

Uplift approval for Aurora because this has been in central for a while and is low-risk.
Attachment #8628628 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.