[libbluray-devel] Found a JRE compiled for Android (ARM)

Petri Hintukainen phintuka at users.sourceforge.net
Sat Jan 23 21:31:59 UTC 2021


la, 2021-01-23 kello 17:43 -0300, Vitor Dall'Acqua kirjoitti:
> Well, I'm no expert but when I tried to add it along with other
> libraries it ended up in the same folder along with all other libs.

Then, it should find libjvm.so from there without any path ? If
JAVA_HOME is unset, first probed library is "libjvm.so" without any
path added to it.

If not, you could try adding following snippet to bdj.c:_load_jvm(),
before "java_home = getenv("JAVA_HOME")" line:

    handle = dl_dlopen("/lib/arm64/libjvm.so", NULL);
    if (handle) {
        return handle;
    }

But JVM probably won't find other files it needs if those are inside
the apk.

> On Sat, Jan 23, 2021 at 5:42 PM Shaya Potter <spotter at gmail.com>
> wrote:
> > I'm guessing you mean, one can't add directories in an apk?
> > 
> > On Sat, Jan 23, 2021 at 10:38 PM Vitor Dall'Acqua
> > <veggav at gmail.com> wrote:
> > > Yes, I'm adding it to the apk, the problem is that if I set it
> > > like this:
> > >  #undef JDK_HOME
> > >   #define JDK_HOME "/lib/arm64/"
> > > 
> > > It needs to look at the root of JDK_HOME. I can't add folders.
> > > And from the looks of the log it will look for it in
> > > /lib/arm64/jre/lib/aarch64/server/libjvm.so
> > > 
> > > On Sat, Jan 23, 2021 at 5:33 PM Shaya Potter <spotter at gmail.com>
> > > wrote:
> > > > so seems related to the issue I mentioned
> > > > 
> > > > https://stackoverflow.com/questions/59608865/library-is-not-accessible-for-the-namespace-classloader-namespace
> > > > 
> > > > seems to be that the solution is that you will have to include
> > > > it in the apk itself.
> > > > 
> > > > On Sat, Jan 23, 2021 at 10:26 PM Vitor Dall'Acqua <
> > > > veggav at gmail.com> wrote:
> > > > > Well... managed to get it to see...
> > > > > 
> > > > > 2021-01-23 18:21:35.375 T:19738   DEBUG <general>:
> > > > > CBlurayCallback::Logger - bdj.c:311: Opening
> > > > > /storage/emulated/0/JAVA/jre/lib/aarch64/server/libjvm ...
> > > > >                                                    
> > > > > 2021-01-23 18:21:35.377 T:19738   DEBUG <general>:
> > > > > CBlurayCallback::Logger - dl_posix.c:54: can't open library
> > > > > '/storage/emulated/0/JAVA/jre/lib/aarch64/server/libjvm.so':
> > > > > dlopen failed: library
> > > > > "/storage/emulated/0/JAVA/jre/lib/aarch64/server/libjvm.so"
> > > > > needed or dlopened by "/mnt/expand/cab01563-bcca-48fa-a0bf-
> > > > > 0fbddaf9b192/app/org.xbmc.kodi19DV-
> > > > > BHAaVSj7u8lhvDk_OSQttQ==/lib/arm64/libkodi.so" is not
> > > > > accessible for the namespace "classloader-namespace"
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > On Sat, Jan 23, 2021 at 3:30 PM Shaya Potter <
> > > > > spotter at gmail.com> wrote:
> > > > > > 
> > > > > > i looked at what they call "source code", its not source
> > > > > > (unless I'm missing it).  It's just the pre built binaries.
> > > > > > 
> > > > > > I didn't say that google did that exactly, I said, I think
> > > > > > they have made it difficult to put executables there in
> > > > > > Android Q (with that said, might not be a near term proble
> > > > > > if the app isn't targeted specifically to android Q's API
> > > > > > level, which kodi probably is not).  What I also said, I
> > > > > > dont know how that would impact dlopen (which is not
> > > > > > directly executing the program) if android would block that
> > > > > > as well.
> > > > > > 
> > > > > > with that said, I'd still think (perhaps incorrectly) from
> > > > > > a security point of view, kodi would want to ship the jvm
> > > > > > within their apk as this would prevent external things from
> > > > > > breaking it and not have it provided by the user (then
> > > > > > again, on all desktop environments it is provided by the
> > > > > > user).
> > > > > > 
> > > > > > for reference where I came across a discussion a bit ago: 
> > > > > > https://www.reddit.com/r/androiddev/comments/b2inbu/psa_android_q_blocks_executing_binaries_in_your/
> > > > > > 
> > > > > > if I had to guess, it probably would work for now (even on
> > > > > > Q), but in the future there might be issues as google
> > > > > > prevents older and older api targets from being updated in
> > > > > > the play store.
> > > > > > 
> > > > > > On Sat, Jan 23, 2021 at 8:08 PM Vitor Dall'Acqua <
> > > > > > veggav at gmail.com> wrote:
> > > > > > > But Shaya, the source is present in the linked file
> > > > > > > here. 
> > > > > > > The thing is that it's beyond my capabilities try to add
> > > > > > > this to Kodi as a dependency. 
> > > > > > > Also another problem I'm seeing here is that while I'm
> > > > > > > able to pack into an apk the libjvm.so so it is installed
> > > > > > > when you install Kodi, this isn't the case for the .jar
> > > > > > > files. 
> > > > > > > 
> > > > > > > You mentioned that Google made sure to close down the
> > > > > > > possibility of loading a .so file from outside the app
> > > > > > > folder?
> > > > > > > So you think even if libbluray could read
> > > > > > > /storage/emulated/0/ it would fail in use the libjvm?
> > > > > > > 
> > > > > > > On Sat, Jan 23, 2021 at 2:30 PM Shaya Potter <
> > > > > > > spotter at gmail.com> wrote:
> > > > > > > > vitor, I'd think that kodi's path manipulation wouldn't
> > > > > > > > impact the jre at all.  It's just for internal kodi use
> > > > > > > > for themes and media and the like, but nothing to do
> > > > > > > > with OS operations (and petri can verify if this or
> > > > > > > > true, motivated the need for libbluray to have the
> > > > > > > > ability to a pluggable set of file system operations
> > > > > > > > that could be provided to it).  But while libbluray can
> > > > > > > > use the a provided set of operations, the jvm can't.
> > > > > > > > 
> > > > > > > > I'd think one of your goals should be to get the group
> > > > > > > > that made those jvm binaries to release the source and
> > > > > > > > build for it, then kodi can include it as part of their
> > > > > > > > build process and even ship with it in the play store. 
> > > > > > > > I'd think vlc would be interested in this, as well? 
> > > > > > > > This would also be necessary as would have to ship
> > > > > > > > different jvm's for 32 bit kodi and 64 bit.
> > > > > > > > 
> > > > > > > > On Sat, Jan 23, 2021 at 2:22 PM Vitor Dall'Acqua <
> > > > > > > > veggav at gmail.com> wrote:
> > > > > > > > > Petri, do you happen to have the source with your
> > > > > > > > > latest changes?
> > > > > > > > > code.videolan.org is down and I would like to work on
> > > > > > > > > this during the weekend.
> > > > > > > > > 
> > > > > > > > > On Fri, Jan 22, 2021 at 6:08 PM Petri Hintukainen <
> > > > > > > > > phintuka at users.sourceforge.net> wrote:
> > > > > > > > > > pe, 2021-01-22 kello 16:54 -0300, Vitor Dall'Acqua
> > > > > > > > > > kirjoitti:
> > > > > > > > > > > I have not tried to build Java from source. 
> > > > > > > > > > > The version used by Termux, can be found as pre
> > > > > > > > > > compiled and source
> > > > > > > > > > > here:
> > > > > > > > > > > 
> > > > > > > > > > https://github.com/Hax4us/java/releases/download/v8/jdk8_aarch64.tar.gz
> > > > > > > > > > > 
> > > > > > > > > > > I can give a go with Kodi, which is what I'm
> > > > > > > > > > familiar with, to git
> > > > > > > > > > > clone the latest changes from libbluray, add the
> > > > > > > > > > lib/arm/client to it
> > > > > > > > > > > and add the files from that archive linked here. 
> > > > > > > > > > > Does it still need a bin folder inside? is the
> > > > > > > > > > structure correct
> > > > > > > > > > > there?
> > > > > > > > > > 
> > > > > > > > > > Structure seems to be normal. I think you need only
> > > > > > > > > > files from
> > > > > > > > > > /jdk8/jre/ and maybe from /glib/ (?).
> > > > > > > > > > 
> > > > > > > > > > JAVA_HOME would point to .../jdk8/ or
> > > > > > > > > > .../jdk8/jre/. Or, you could try
> > > > > > > > > > if simply symlinking
> > > > > > > > > > .../jdk8/jre/lib/aarch64/server/libjvm.so next to
> > > > > > > > > > libbluray.so works.
> > > > > > > > > > 
> > > > > > > > > > The files in top-level bin folder are wrapper
> > > > > > > > > > scripts. Looking at
> > > > > > > > > > those, you may need to set LD_LIBRARY_PATH so that
> > > > > > > > > > libraries from /glib
> > > > > > > > > > can be found. But I don't know if JVM needs those,
> > > > > > > > > > or if those are only
> > > > > > > > > > used with some of the applications.
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > _______________________________________________
> > > > > > > > > > libbluray-devel mailing list
> > > > > > > > > > libbluray-devel at videolan.org
> > > > > > > > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > > > > > > > _______________________________________________
> > > > > > > > > libbluray-devel mailing list
> > > > > > > > > libbluray-devel at videolan.org
> > > > > > > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > > > > > > _______________________________________________
> > > > > > > > libbluray-devel mailing list
> > > > > > > > libbluray-devel at videolan.org
> > > > > > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > > > > > _______________________________________________
> > > > > > > libbluray-devel mailing list
> > > > > > > libbluray-devel at videolan.org
> > > > > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > > > > _______________________________________________
> > > > > > libbluray-devel mailing list
> > > > > > libbluray-devel at videolan.org
> > > > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > > > _______________________________________________
> > > > > libbluray-devel mailing list
> > > > > libbluray-devel at videolan.org
> > > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > > _______________________________________________
> > > > libbluray-devel mailing list
> > > > libbluray-devel at videolan.org
> > > > https://mailman.videolan.org/listinfo/libbluray-devel
> > > _______________________________________________
> > > libbluray-devel mailing list
> > > libbluray-devel at videolan.org
> > > https://mailman.videolan.org/listinfo/libbluray-devel
> > _______________________________________________
> > libbluray-devel mailing list
> > libbluray-devel at videolan.org
> > https://mailman.videolan.org/listinfo/libbluray-devel
> _______________________________________________
> libbluray-devel mailing list
> libbluray-devel at videolan.org
> https://mailman.videolan.org/listinfo/libbluray-devel




More information about the libbluray-devel mailing list