Ask Your Question
-1

Self contained (no root/sudo access) java build for RHEL, OEL 6.10

asked 2020-08-18 10:43:10 -0600

vmishin100 gravatar image

Did anybody build self contained opencv java library to be installed on linux without admin permissions?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-08-18 11:09:13 -0600

berak gravatar image

i've done this on heroku recently (where you're also not root !) and there are simple ways to do so.

first, you should build statically linked opencv libs, so your opencv-java.so does no more depend on further opencv so's:

cmake -DBUILD_SHARED_LIBS=OFF

then, you're free to change the install location to any place, that does not need root privileges (e.g. your home folder), like:

cmake -DCMAKE_INSTALL_PREFIX=/opt/opencv

(that's just an example !)

in the end, like this you will only need the opencv-java.so and opencv_java.jar.

you could even skip the make install step, and copy those files manually from your build folder.

edit flag offensive delete link more

Comments

@berak thanks for the answer. The problem is that on Oracle Linux 6.10 (RHEL) or even higher, cmake dosn't work - cmake version 2.x but require 3.51, the came problem with compiler c++ 4.8, but better to have 8.3. I can build it on other images ubuntu 20.04 e.g. Then if I copy native libraries to other docker image I still need to install some system libraries. I need to do couple more experiments. Anyway the point is if we can install it on Android or iOS it might be the way to package all necessary libraries including external into one place and just copy/deploy it to other machine. I'll. post my cmake in next message.

vmishin100 gravatar imagevmishin100 ( 2020-08-24 11:57:22 -0600 )edit

My cmake: cmake -DBUILD_SHARED_LIBS=OFF \ -DBUILD_FFMPEG=ON \ -DCMAKE_INSTALL_PREFIX=/home/app/usr/local \ -DBUILD_opencv_java=ON \ -DBUILD_JAVA=ON \ -DCMAKE_BUILD_TYPE=Debug \ -DVIDEOIO_ENABLE_PLUGINS=ON \ -DOPENCV_ENABLE_LINKER_RPATH_LINK_ORIGIN=ON \ -DOPENCV_GENERATE_PKGCONFIG=ON \ -DCMAKE_SKIP_RPATH=ON \ -DVIDEOIO_PLUGIN_LIST=ffmpeg ..

vmishin100 gravatar imagevmishin100 ( 2020-08-24 11:57:40 -0600 )edit

The is ffmpeg plugin necessary

vmishin100 gravatar imagevmishin100 ( 2020-08-24 11:59:51 -0600 )edit

Although for mac I don't see that plugin. In linux case kernels are the same, thus same program should run for various distribution.

vmishin100 gravatar imagevmishin100 ( 2020-08-24 12:05:11 -0600 )edit

Independent of distro it was build on

vmishin100 gravatar imagevmishin100 ( 2020-08-24 12:08:20 -0600 )edit

My cmake:

cmake -DBUILD_SHARED_LIBS=OFF \
-DBUILD_FFMPEG=ON \
-DCMAKE_INSTALL_PREFIX=/home/app/usr/local \
-DBUILD_opencv_java=ON \
-DBUILD_JAVA=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DVIDEOIO_ENABLE_PLUGINS=ON \
-DOPENCV_ENABLE_LINKER_RPATH_LINK_ORIGIN=ON \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DCMAKE_SKIP_RPATH=ON \
-DVIDEOIO_PLUGIN_LIST=ffmpeg ..
vmishin100 gravatar imagevmishin100 ( 2020-08-24 12:39:52 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-08-18 10:43:10 -0600

Seen: 424 times

Last updated: Aug 18 '20