Closed Bug 1732859 Opened 3 years ago Closed 3 years ago

libxul.so is missing Glean symbols on Android Arm targets

Categories

(Data Platform and Tools :: Glean: SDK, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: janerik, Assigned: janerik)

References

Details

Attachments

(1 file)

Originally reported at https://github.com/mozilla/glean/issues/1804:

09-23 14:10:38.080  6444  6444 D AndroidRuntime: Shutting down VM
09-23 14:10:38.081  6444  6444 E AndroidRuntime: FATAL EXCEPTION: main
09-23 14:10:38.081  6444  6444 E AndroidRuntime: Process: org.mozilla.fenix.debug, PID: 6444
09-23 14:10:38.081  6444  6444 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Error looking up function 'glean_enable_logging': undefined symbol: glean_enable_logging
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.sun.jna.Function.<init>(Function.java:252)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:600)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:576)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:562)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.sun.jna.Library$Handler.invoke(Library.java:243)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at java.lang.reflect.Proxy.invoke(Proxy.java:813)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at $Proxy1.glean_enable_logging(Unknown Source)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at mozilla.telemetry.glean.rust.LibGleanFFIKt.loadIndirect(LibGleanFFI.kt:91)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at mozilla.telemetry.glean.rust.LibGleanFFI$Companion.<clinit>(LibGleanFFI.kt:100)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at mozilla.telemetry.glean.rust.LibGleanFFI.<clinit>(LibGleanFFI.kt)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at mozilla.telemetry.glean.private.CounterMetricType.<init>(CounterMetricType.kt:42)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at org.mozilla.fenix.GleanMetrics.PerfStartup.<clinit>(PerfStartup.kt:129)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at org.mozilla.fenix.FenixApplication.onCreate(FenixApplication.kt:102)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.app.ActivityThread.-wrap2(ActivityThread.java)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:102)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6077)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
09-23 14:10:38.081  6444  6444 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

Contrary to what I thought I properly tested, not all bundled libxul.so files in geckoview-nightly-omni include the symbols.

❯ unzip -p geckoview*aar jni/armeabi-v7a/libxul.so | nm -gD - | rg glean_enable
❯ unzip -p geckoview*aar jni/arm64-v8a/libxul.so | nm -gD - | rg glean_enable
❯ unzip -p geckoview*aar jni/x86/libxul.so | nm -gD - | rg glean_enable
04327740 T glean_enable_logging
❯ unzip -p geckoview*aar jni/x86_64/libxul.so | nm -gD - | rg glean_enable
0000000004308f10 T glean_enable_logging

This wasn't notice because we don't depend on libxul just yet because of libglean_ffi.so still being shipped.
I didn't notice locally, because I'm always testing in a x86 emulator.

We previously tried to do this from Rust,
but that seems to be unreliable and currently only works for x86{,_64}.

The same trick however works from the C++ side: we reference one symbol
(and re-export it) and all the other symbols show up as well.
Now all libxul.so files build for Android targets export the glean_*
symbols, which are used by the Glean Android SDK to call into Glean.

Blocks: 1708669
Pushed by jrediger@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9a7cdcf8ee7a
Force re-export of Glean symbols in C++. r=chutten
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: