Closed elizagamedev closed 8 months ago
Thank you for the report.
I think your analysis is right. Seems that trying to build only *.so files with --crosstool_top=
and --cpu=
option, which I learned from the following section, isn't working as we hoped.
Today I played with the other approach, which is also explained in another section in the same page, to follow the way people build an APK with native libraries with Bazel in an end to end manner.
This approach, which builds an APK with --android_crosstool_top=
and --fat_apk_cpu=
option instead of --crosstool_top=
and --cpu=
, indeed worked as expected. The *.so files extracted from the final APK looked OK.
So my plan is to rewrite the current build rule with the above one. It still takes time for me to finish cleaning up my prototype before submitting it, but I'm mostly sure that this is at least a fixable problem.
I'll update this thread when the fix becomes ready.
Thank you so much for the detailed and quick response! I'm not well versed in the Android NDK world, especially when building with bazel, so it would have taken me ages to figure this out. I really appreciate it.
With b0a604f110e01d11107ebbaad09e674cecee34f5, loading libmozc.so
as follows started succeeding in my local environment.
System.loadLibrary("mozc");
Can you confirm that System.loadLibrary("mozc")
succeeds without any exception in your environment?
Here is a copy of native_libs.zip downloaded from https://github.com/google/mozc/actions/runs/6727110559
It loads perfectly now. Thank you so much!
Description
This problem happens both when building libmozcjni.so via the Docker build instructions and when using one of the github CI build artifacts. The generated libmozcjni.so contains a great deal of undefined function references but no links to any libraries which define those functions. The result is that attempting to load this library on Android results in an error when calling
System.loadLibrary()
.Commit-id
006084cf4e3a31a37f48a55c7d4a73790ce39dfb (latest)
Build target
Choose one of them 1. Docker build for Linux and Android-lib
CI build status
Whether the current CI build status is
passing
orfailure
. https://github.com/google/mozc#build-statusChoose either of them
Environment
Docker image built from latest revision
Build commands
Following exactly https://github.com/google/mozc/blob/master/docs/build_mozc_in_docker.md.
Error logs
Here is the dlopen error generated from attempting to call loadLibrary on the latest CI artifact.
Additional context
Here is the output of
objdump -T
on the latest CI artifact for Android. (Only the relevant lines are included.)A good number of these appear to be libc++ functions. However, libmozcjni.so doesn't link to libc++ according to
readelf -d
.I may be making a mistake and misunderstanding how elf/Android works, but something here seems wrong to me.