在Yocto上构建Oracle JDK

时间:2017-04-01 12:29:15

标签: java oracle opencv embedded-linux yocto

我正在尝试在我的yocto构建中安装Oracle JDK,因为它需要构建OpenCV Java API。

这是我的配置文件:

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已正确设置。我为每一层都使用了morty分支。 对于构建我只需启动命令:

bitbake core-image-sato

构建成功结束但我最终在目标机器上出现以下错误:

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

但是

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

查看目录

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

我是否需要做更多的事情来正确构建图像?我的配置文件有什么问题吗?有人遇到过同样的错误吗?

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,并且Fabio Berton O.S. Systems提供了一些慷慨的帮助,我们发现这个问题与/usr/bin/java取决于{{/lib64/ld-linux-x86-64.so.2的事实有关。 1}}。

您可以通过在目标中打开一个shell并执行strings /usr/lib/jvm/java-8-oracle/bin/java来检查它。

我们还发现/lib/ld-linux-x86-64.so.2/lib/ld-2.26.so的符号链接。

所以你要做的就是像这样创建一个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 
}

此致 伯纳。

答案 1 :(得分:0)

我无法安装Oracle JDK,但我设法安装了openjdk-8并成功启用了OpenCV Java API。

I made a guide关于如何实现这一目标。