简体   繁体   中英

Oracle JDK installation on Yocto build

I'm trying to install Oracle JDK on my yocto build as it's needed to build the OpenCV Java API.

This is my configuration file:

MACHINE ??= "intel-corei7-64"

DISTRO ?= "poky"

PACKAGE_CLASSES ?= "package_deb"

SDKMACHINE ?= "x86_64"

EXTRA_IMAGE_FEATURES ?= "debug-tweaks"

USER_CLASSES ?= "buildstats image-mklibs image-prelink"

PATCHRESOLVE = "noop"

BB_DISKMON_DIRS = "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K \
    ABORT,/tmp,10M,1K"


PACKAGECONFIG_append_pn-qemu-native = " sdl" 
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"

CONF_VERSION = "1"

# Modify the following line accoring to your Host Machine setup
# Example: CPU with 6 core 12 threads use the following configuration. 
BB_NUMBER_THREADS = '12' 
PARALLEL_MAKE = '-j 12'

# Java installation 
IMAGE_INSTALL_append += " gtkperf libxslt oracle-jse-jre " 
LICENSE_FLAGS_WHITELIST += "oracle_java" 
PREFERRED_VERSION_xserver-nodm-init = "1.0"


# OpenCV installation 
CORE_IMAGE_EXTRA_INSTALL += "opencv opencv-samples libopencv-core-dev libopencv-highgui-dev libopencv-imgproc-dev libopencv-objdetect-dev libopencv-ml-dev"

bblayers.conf is correctly set. I'm using morty branch for every layer. For building I simply launch the command:

bitbake core-image-sato

The build end successfully but I end up with the following error on the target machine:

root@intel-corei7-64:~# java -version
-sh: /usr/bin/java: No such file or directory

But

root@intel-corei7-64:/usr/bin# ls -l | grep java
lrwxrwxrwx 1 root root      31 Apr  1 11:40 java -> /usr/share/jre1.8.0_91/bin/java

And looking in said directory

root@intel-corei7-64:/usr/share/jre1.8.0_91/bin# ls -l
total 388
lrwxrwxrwx 1 root root      8 Apr  1 11:40 ControlPanel -> jcontrol
-rwxr-xr-x 1 1001 1001   5080 Apr  1 09:14 java
-rwxr-xr-x 1 1001 1001 103920 Apr  1 09:14 javaws
-rwxr-xr-x 1 1001 1001   6264 Apr  1  2016 jcontrol
-rwxr-xr-x 1 1001 1001   5208 Apr  1 09:14 jjs
-rwxr-xr-x 1 1001 1001   5208 Apr  1 09:14 keytool
-rwxr-xr-x 1 1001 1001   5416 Apr  1 09:14 orbd
-rwxr-xr-x 1 1001 1001   5224 Apr  1 09:14 pack200
-rwxr-xr-x 1 1001 1001   5264 Apr  1 09:14 policytool
-rwxr-xr-x 1 1001 1001   5208 Apr  1 09:14 rmid
-rwxr-xr-x 1 1001 1001   5216 Apr  1 09:14 rmiregistry
-rwxr-xr-x 1 1001 1001   5232 Apr  1 09:14 servertool
-rwxr-xr-x 1 1001 1001   5448 Apr  1 09:14 tnameserv
-rwxr-xr-x 1 1001 1001 200400 Apr  1 09:14 unpack200

Do I need to do something more to correctly build the image? Is there anything wrong with my configuration files? Anybody encountered the same error?

I ran into the same problem, and with some generous help given by Fabio Berton from OS Systems , we found out that the problem is related to the fact that /usr/bin/java depends on /lib64/ld-linux-x86-64.so.2 .

You can check that by opening a shell inside the target and doing strings /usr/lib/jvm/java-8-oracle/bin/java .

We also found that /lib/ld-linux-x86-64.so.2 is a symbolic link to /lib/ld-2.26.so .

So all you have to do is to create a oracle-jse-jdk_1.7.0.bbappend like this:

FILES_${PN} += "/lib64/ld-linux-x86-64.so.2"

do_install_append() {
    install -d ${D}/lib64
    cd ${D}/lib64
    ln -s ../lib/ld-2.26.so ld-linux-x86-64.so.2 
}

Regards, Bernardo.

I couldn't installe Oracle JDK but I managed to install openjdk-8 and succesfully enable the OpenCV Java API.

I made a guide on how to accomplish this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM