简体   繁体   English

Yocto构建上的Oracle JDK安装

[英]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. 我正在尝试在我的yocto构建上安装Oracle JDK,因为它是构建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. bblayers.conf设置正确。 I'm using morty branch for every layer. 我在每一层使用morty分支。 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 . 我遇到了同样的问题,在OS SystemsFabio Berton的慷慨帮助下,我们发现问题与/usr/bin/java依赖于/lib64/ld-linux-x86-64.so.2这一事实有关。 /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 . 您可以通过在目标内部打开外壳并执行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 . 我们还发现, /lib/ld-linux-x86-64.so.2是一个符号链接/lib/ld-2.26.so

So all you have to do is to create a oracle-jse-jdk_1.7.0.bbappend like this: 因此,您要做的就是创建一个像这样的oracle-jse-jdk_1.7.0.bbappend

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. 我无法安装Oracle JDK,但我设法安装了openjdk-8并成功启用了OpenCV Java API。

I made a guide on how to accomplish this. 对如何实现这一目标做了指导

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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