Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in compilation in after_script: - ./dlib-java java-jar #2

Closed
agunin opened this issue Feb 27, 2019 · 8 comments
Closed

Error in compilation in after_script: - ./dlib-java java-jar #2

agunin opened this issue Feb 27, 2019 · 8 comments

Comments

@agunin
Copy link

agunin commented Feb 27, 2019

myproject

I am following the compilation process of this project, in the last step on 3

1)before_install:

  • ./dlib-java make-opencv
  • ./dlib-java make-dlib

2)script:

  • ./dlib-java mvn-package
  1. after_script:
  • ./dlib-java java-jar

I'm throwing an error in this step that I detail below

./dlib-java java-jar

//LD_LIBRARY_PATH="/tmp/dlib/usr/lib;/tmp/opencv/usr/lib;/tmp/opencv/usr/share/OpenCV/java" java -jar "target/dlib-1.0-SNAPSHOT.jar"

Error: Unable to access jarfile target/dlib-1.0-SNAPSHOT.jar

also try to change that line in the script code dlib-java

LD_LIBRARY_PATH="/tmp/dlib/usr/lib;/tmp/opencv/usr/lib;/tmp/opencv/usr/share/OpenCV/java" java -jar "dlib/target/dlib-1.0-SNAPSHOT.jar"

but I deployed the following error
./dlib-java java-jar
Error: no se ha encontrado el método principal en la clase com.github.radium226.dlib.DLib, defina el método principal del siguiente modo:\n public static void main(String[] args)\nde lo contrario, se deberá ampliar una clase de aplicación JavaFX javafx.application.Application

What is I doing wrong, the classes are downloaded from the project and followed step by step the same, could you help me? thank you
I detail my output in the command construction / dlib-java mvn-package

./dlib-java mvn-package

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] DLib Parent
[INFO] DLib
[INFO] DLib Models
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DLib Parent 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ dlib-parent ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DLib 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ dlib ---
[INFO] Deleting /home/usuario/dlib_java/dlib-java-master/dlib/target
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-initialize) @ dlib ---
==> Creating directories
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-generate-sources) @ dlib ---
==> Generating Java sources using SWIG
- showcase
Language subdirectory: java
Search paths:
./
src/main/native/swig/
src/main/native/include/
./swig_lib/java/
/usr/share/swig3.0/java/
./swig_lib/
/usr/share/swig3.0/
Preprocessing...
Starting language-specific parse...
Processing types...
C++ analysis...
Processing nested classes...
Generating wrappers...
- dlib
Language subdirectory: java
Search paths:
./
src/main/native/swig/
src/main/native/include/
./swig_lib/java/
/usr/share/swig3.0/java/
./swig_lib/
/usr/share/swig3.0/
Preprocessing...
Starting language-specific parse...
Processing types...
C++ analysis...
Processing nested classes...
Generating wrappers...
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (generate-sources) @ dlib ---
[INFO] Source directory: /home/usuario/dlib_java/dlib-java-master/dlib/target/generated-sources/swig added.
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-generate-resources) @ dlib ---
==> Compiling source files to objects
- src/main/native/face_descriptor_computer.cpp to target/native/build/face_descriptor_computer.o
- src/main/native/showcase.cpp to target/native/build/showcase.o
- src/main/native/shape_predictor.cpp to target/native/build/shape_predictor.o
- src/main/native/face_detector.cpp to target/native/build/face_detector.o
- target/native/showcase_wrap.cpp to target/native/build/showcase_wrap.o
- target/native/dlib_wrap.cpp to target/native/build/dlib_wrap.o
==> Linking object files to shared library
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-resource (generate-resources) @ dlib ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dlib ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ dlib ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 14 source files to /home/usuario/dlib_java/dlib-java-master/dlib/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ dlib ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ dlib ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/usuario/dlib_java/dlib-java-master/dlib/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ dlib ---
[INFO] Surefire report directory: /home/usuario/dlib_java/dlib-java-master/dlib/target/surefire-reports


T E S T S

Running com.github.radium226.dlib.FaceDescriptorComputerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.033 sec - in com.github.radium226.dlib.FaceDescriptorComputerTest
Running com.github.radium226.dlib.ShapePredictorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.01 sec - in com.github.radium226.dlib.ShapePredictorTest

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 2

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ dlib ---
[INFO] Building jar: /home/usuario/dlib_java/dlib-java-master/dlib/target/dlib-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:3.1.1:shade (default) @ dlib ---
[INFO] Including opencv:opencv:jar:3.4.1 in the shaded jar.
[INFO] Including tw.edu.sju.ee.eea.commons:commons-nativeutils:jar:1.0 in the shaded jar.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /home/usuario/dlib_java/dlib-java-master/dlib/target/dlib-1.0-SNAPSHOT.jar with /home/usuario/dlib_java/dlib-java-master/dlib/target/dlib-1.0-SNAPSHOT-shaded.jar
[INFO] Dependency-reduced POM written at: /home/usuario/dlib_java/dlib-java-master/dlib/dependency-reduced-pom.xml
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DLib Models 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ dlib-models ---
[INFO] Deleting /home/usuario/dlib_java/dlib-java-master/dlib-models/target
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-generate-resources) @ dlib-models ---
wget --quiet "http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2" -O "./shape_predictor_68_face_landmarks.dat.bz2"
bzip2 --quiet --decompress --keep "./shape_predictor_68_face_landmarks.dat.bz2"
wget --quiet "http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2" -O "./shape_predictor_5_face_landmarks.dat.bz2"
bzip2 --quiet --decompress --keep "./shape_predictor_5_face_landmarks.dat.bz2"
wget --quiet "http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2" -O "./dlib_face_recognition_resnet_model_v1.dat.bz2"
bzip2 --quiet --decompress --keep "./dlib_face_recognition_resnet_model_v1.dat.bz2"
rm shape_predictor_5_face_landmarks.dat.bz2 dlib_face_recognition_resnet_model_v1.dat.bz2 shape_predictor_68_face_landmarks.dat.bz2
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-resource (generate-resources) @ dlib-models ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dlib-models ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ dlib-models ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/usuario/dlib_java/dlib-java-master/dlib-models/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ dlib-models ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/usuario/dlib_java/dlib-java-master/dlib-models/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ dlib-models ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ dlib-models ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ dlib-models ---
[INFO] Building jar: /home/usuario/dlib_java/dlib-java-master/dlib-models/target/dlib-models-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] DLib Parent ........................................ SUCCESS [ 0.533 s]
[INFO] DLib ............................................... SUCCESS [01:30 min]
[INFO] DLib Models ........................................ SUCCESS [05:25 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:56 min
[INFO] Finished at: 2019-02-27T18:58:14-03:00
[INFO] Final Memory: 21M/56M
[INFO] ------------------------------------------------------------------------
usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$

@radium226
Copy link
Owner

radium226 commented Feb 28, 2019 via email

@agunin
Copy link
Author

agunin commented Feb 28, 2019

Hi how are you?
First of all, thank you very much for answering my question,
my version of java is:

usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

java -XshowSettings:properties
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = /usr/lib/jvm/java-8-oracle/jre/lib/endorsed
java.ext.dirs = /usr/lib/jvm/java-8-oracle/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /usr/lib/jvm/java-8-oracle/jre
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib/amd64
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_201-b09
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_201
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.201-b09
line.separator = \n
os.arch = amd64
os.name = Linux
os.version = 4.15.0-45-generic
path.separator = :
sun.arch.data.model = 64
sun.boot.class.path = /usr/lib/jvm/java-8-oracle/jre/lib/resources.jar
/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar
/usr/lib/jvm/java-8-oracle/jre/lib/sunrsasign.jar
/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar
/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar
/usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar
/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar
/usr/lib/jvm/java-8-oracle/jre/classes
sun.boot.library.path = /usr/lib/jvm/java-8-oracle/jre/lib/amd64
sun.cpu.endian = little
sun.cpu.isalist =
sun.desktop = gnome
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = UTF-8
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level = unknown
user.country = UY
user.dir = /home/usuario/dlib_java/dlib-java-master
user.home = /home/usuario
user.language = es
user.name = usuario
user.timezone =

@agunin
Copy link
Author

agunin commented Feb 28, 2019

Other considerations that I had to modify for me to compile are

/home/usuario/dlib_java/dlib-java-master/dlib/src/main/native/make.sh

I had to modify the function by adding -std = c ++ 11

gcc :: compile_object ()
{
declare source_file_path = "$ {1}"
declare target_file_path = "$ {2}"

g ++ \
    -fPIC \
    -fno-strict-aliasing \
    -I "/ usr / lib / jvm / java-8-openjdk-amd64 / include" \
    -I "/ usr / lib / jvm / java-8-openjdk-amd64 / include / linux" \
    $ (pkg-config --cflags "dlib-1") \
    $ (pkg-config --cflags "opencv") \
    -I "$ {SOURCE_FOLDER}" \
    -I "$ {SOURCE_FOLDER} / include" \
    -c "$ {source_file_path}" -o "$ {target_file_path}" -std = c ++ 11

}
and in the

/home/usuario/dlib_java/dlib-java-master/dlib/src/main/native/face_descriptor_computer.hpp

Comment this line

//crops.push_back(dlib::jitter_image(img,rnd));

and the line

cv :: Mat m; // = dlib :: toMat (face_chip);

thanks for your time.
regards

Agustín

@radium226
Copy link
Owner

Hi! Thanks a lot for you feedback.

I've cloned the source and took a look of everything and I figured out that a lot of stuff were actually missing. I'l try to update the dlib-java script next week in order to make everything work. I'm also going to add some of the snippets you mentioned above (like the -std=c++ stuff).

@radium226
Copy link
Owner

Hi! I've made multiple updates in the master branch. I hope it fixes the issues you encountered. I upgraded OpenCV and DLib and also fixed a lot of stuff which were wrong in dlib-java. It's a first step to make this all thing more robust.

Feel free to make me some feedback!

@agunin
Copy link
Author

agunin commented Mar 6, 2019

Hello how are you? thank you very much for the changes and for your work!

Download the project again and now compile everything without problems to a certain extent, which I detail below, I think it is my mistake in my linux but I do not realize how to fix it

usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$ mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] DLib Parent
[INFO] DLib
[INFO] DLib Models
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DLib Parent 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DLib 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-initialize) @ dlib ---
==> Creating directories
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-generate-sources) @ dlib ---
==> Generating Java sources using SWIG
- showcase
Language subdirectory: java
Search paths:
./
src/main/native/swig/
src/main/native/include/
./swig_lib/java/
/usr/share/swig3.0/java/
./swig_lib/
/usr/share/swig3.0/
Preprocessing...
Starting language-specific parse...
Processing types...
C++ analysis...
Processing nested classes...
Generating wrappers...
- dlib
Language subdirectory: java
Search paths:
./
src/main/native/swig/
src/main/native/include/
./swig_lib/java/
/usr/share/swig3.0/java/
./swig_lib/
/usr/share/swig3.0/
Preprocessing...
Starting language-specific parse...
Processing types...
C++ analysis...
Processing nested classes...
Generating wrappers...
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (generate-sources) @ dlib ---
[INFO] Source directory: /home/usuario/dlib_java/dlib-java-master/dlib/target/generated-sources/swig added.
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (make-generate-resources) @ dlib ---
==> Compiling source files to objects
- src/main/native/face_descriptor_computer.cpp to target/native/build/face_descriptor_computer.o
- src/main/native/showcase.cpp to target/native/build/showcase.o
- src/main/native/shape_predictor.cpp to target/native/build/shape_predictor.o
- src/main/native/face_detector.cpp to target/native/build/face_detector.o
- target/native/showcase_wrap.cpp to target/native/build/showcase_wrap.o
- target/native/dlib_wrap.cpp to target/native/build/dlib_wrap.o
==> Linking object files to shared library
++ pkg-config --libs opencv4
++ pkg-config --libs dlib-1

  • g++ --verbose -fPIC -shared -L/tmp/opencv/usr//tmp/opencv/usr/lib -lopencv_stitching -lopencv_gapi -lopencv_freetype -lopencv_tracking -lopencv_saliency -lopencv_aruco -lopencv_superres -lopencv_optflow -lopencv_ximgproc -lopencv_ccalib -lopencv_dpm -lopencv_stereo -lopencv_reg -lopencv_datasets -lopencv_hfs -lopencv_face -lopencv_bgsegm -lopencv_xfeatures2d -lopencv_videostab -lopencv_video -lopencv_bioinspired -lopencv_text -lopencv_ml -lopencv_img_hash -lopencv_surface_matching -lopencv_dnn_objdetect -lopencv_dnn -lopencv_line_descriptor -lopencv_plot -lopencv_xobjdetect -lopencv_objdetect -lopencv_shape -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_fuzzy -lopencv_xphoto -lopencv_photo -lopencv_rgbd -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core -L/tmp/dlib/usr/lib -ldlib -lpng12 target/native/build/face_descriptor_computer.o target/native/build/showcase.o target/native/build/shape_predictor.o target/native/build/face_detector.o target/native/build/showcase_wrap.o target/native/build/dlib_wrap.o -o target/generated-resources/swig/libdlib-java.so
    Using built-in specs.
    COLLECT_GCC=g++
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu116.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1
    16.04.11)
    COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
    LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
    COLLECT_GCC_OPTIONS='-v' '-fPIC' '-shared' '-L/tmp/opencv/usr//tmp/opencv/usr/lib' '-L/tmp/dlib/usr/lib' '-o' 'target/generated-resources/swig/libdlib-java.so' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
    /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccnlbYeP.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -shared -z relro -o target/generated-resources/swig/libdlib-java.so /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o -L/tmp/opencv/usr//tmp/opencv/usr/lib -L/tmp/dlib/usr/lib -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lopencv_stitching -lopencv_gapi -lopencv_freetype -lopencv_tracking -lopencv_saliency -lopencv_aruco -lopencv_superres -lopencv_optflow -lopencv_ximgproc -lopencv_ccalib -lopencv_dpm -lopencv_stereo -lopencv_reg -lopencv_datasets -lopencv_hfs -lopencv_face -lopencv_bgsegm -lopencv_xfeatures2d -lopencv_videostab -lopencv_video -lopencv_bioinspired -lopencv_text -lopencv_ml -lopencv_img_hash -lopencv_surface_matching -lopencv_dnn_objdetect -lopencv_dnn -lopencv_line_descriptor -lopencv_plot -lopencv_xobjdetect -lopencv_objdetect -lopencv_shape -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_fuzzy -lopencv_xphoto -lopencv_photo -lopencv_rgbd -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core -ldlib -lpng12 target/native/build/face_descriptor_computer.o target/native/build/showcase.o target/native/build/shape_predictor.o target/native/build/face_detector.o target/native/build/showcase_wrap.o target/native/build/dlib_wrap.o -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
    /usr/bin/ld: no se puede encontrar -lopencv_stitching
    /usr/bin/ld: no se puede encontrar -lopencv_gapi
    /usr/bin/ld: no se puede encontrar -lopencv_freetype
    /usr/bin/ld: no se puede encontrar -lopencv_tracking
    /usr/bin/ld: no se puede encontrar -lopencv_saliency
    /usr/bin/ld: no se puede encontrar -lopencv_aruco
    /usr/bin/ld: no se puede encontrar -lopencv_superres
    /usr/bin/ld: no se puede encontrar -lopencv_optflow
    /usr/bin/ld: no se puede encontrar -lopencv_ximgproc
    /usr/bin/ld: no se puede encontrar -lopencv_ccalib
    /usr/bin/ld: no se puede encontrar -lopencv_dpm
    /usr/bin/ld: no se puede encontrar -lopencv_stereo
    /usr/bin/ld: no se puede encontrar -lopencv_reg
    /usr/bin/ld: no se puede encontrar -lopencv_datasets
    /usr/bin/ld: no se puede encontrar -lopencv_hfs
    /usr/bin/ld: no se puede encontrar -lopencv_face
    /usr/bin/ld: no se puede encontrar -lopencv_bgsegm
    /usr/bin/ld: no se puede encontrar -lopencv_xfeatures2d
    /usr/bin/ld: no se puede encontrar -lopencv_videostab
    /usr/bin/ld: no se puede encontrar -lopencv_video
    /usr/bin/ld: no se puede encontrar -lopencv_bioinspired
    /usr/bin/ld: no se puede encontrar -lopencv_text
    /usr/bin/ld: no se puede encontrar -lopencv_ml
    /usr/bin/ld: no se puede encontrar -lopencv_img_hash
    /usr/bin/ld: no se puede encontrar -lopencv_surface_matching
    /usr/bin/ld: no se puede encontrar -lopencv_dnn_objdetect
    /usr/bin/ld: no se puede encontrar -lopencv_dnn
    /usr/bin/ld: no se puede encontrar -lopencv_line_descriptor
    /usr/bin/ld: no se puede encontrar -lopencv_plot
    /usr/bin/ld: no se puede encontrar -lopencv_xobjdetect
    /usr/bin/ld: no se puede encontrar -lopencv_objdetect
    /usr/bin/ld: no se puede encontrar -lopencv_shape
    /usr/bin/ld: no se puede encontrar -lopencv_structured_light
    /usr/bin/ld: no se puede encontrar -lopencv_phase_unwrapping
    /usr/bin/ld: no se puede encontrar -lopencv_fuzzy
    /usr/bin/ld: no se puede encontrar -lopencv_xphoto
    /usr/bin/ld: no se puede encontrar -lopencv_photo
    /usr/bin/ld: no se puede encontrar -lopencv_rgbd
    /usr/bin/ld: no se puede encontrar -lopencv_calib3d
    /usr/bin/ld: no se puede encontrar -lopencv_features2d
    /usr/bin/ld: no se puede encontrar -lopencv_highgui
    /usr/bin/ld: no se puede encontrar -lopencv_videoio
    /usr/bin/ld: no se puede encontrar -lopencv_imgcodecs
    /usr/bin/ld: no se puede encontrar -lopencv_imgproc
    /usr/bin/ld: no se puede encontrar -lopencv_flann
    /usr/bin/ld: no se puede encontrar -lopencv_core

    collect2: error: ld returned 1 exit status
    [ERROR] Command execution failed.

My generated .pc file is as follows

Package Information for pkg-config

prefix=/tmp/opencv/usr
exec_prefix=${prefix}
libdir=${exec_prefix}//tmp/opencv/usr/lib
includedir_old=${prefix}/include/opencv4/opencv
includedir_new=${prefix}/include/opencv4

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 4.0.1
Libs: -L${exec_prefix}//tmp/opencv/usr/lib -lopencv_stitching -lopencv_gapi -lopencv_freetype -lopencv_tracking -lopencv_saliency -lopencv_aruco -lopencv_superres -lopencv_optflow -lopencv_ximgproc -lopencv_ccalib -lopencv_dpm -lopencv_stereo -lopencv_reg -lopencv_datasets -lopencv_hfs -lopencv_face -lopencv_bgsegm -lopencv_xfeatures2d -lopencv_videostab -lopencv_video -lopencv_bioinspired -lopencv_text -lopencv_ml -lopencv_img_hash -lopencv_surface_matching -lopencv_dnn_objdetect -lopencv_dnn -lopencv_line_descriptor -lopencv_plot -lopencv_xobjdetect -lopencv_objdetect -lopencv_shape -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_fuzzy -lopencv_xphoto -lopencv_photo -lopencv_rgbd -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core
Libs.private: -ldl -lm -lpthread -lrt
Cflags: -I${includedir_old} -I${includedir_new}

Any suggestions? , I will continue trying to solve this error.

thank you very much, greetings

@agunin
Copy link
Author

agunin commented Mar 6, 2019

I found the error in the opencv4.pc file, modify the path that is in bold

Package Information for pkg-config

prefix=/tmp/opencv/usr
exec_prefix=${prefix}
libdir=${exec_prefix}//tmp/opencv/usr/lib
includedir_old=${prefix}/include/opencv4/opencv
includedir_new=${prefix}/include/opencv4

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 4.0.1
Libs: -L//tmp/opencv/usr/lib -lopencv_stitching -lopencv_gapi -lopencv_freetype -lopencv_tracking -lopencv_saliency -lopencv_aruco -lopencv_superres -lopencv_optflow -lopencv_ximgproc -lopencv_ccalib -lopencv_dpm -lopencv_stereo -lopencv_reg -lopencv_datasets -lopencv_hfs -lopencv_face -lopencv_bgsegm -lopencv_xfeatures2d -lopencv_videostab -lopencv_video -lopencv_bioinspired -lopencv_text -lopencv_ml -lopencv_img_hash -lopencv_surface_matching -lopencv_dnn_objdetect -lopencv_dnn -lopencv_line_descriptor -lopencv_plot -lopencv_xobjdetect -lopencv_objdetect -lopencv_shape -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_fuzzy -lopencv_xphoto -lopencv_photo -lopencv_rgbd -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_flann -lopencv_core
Libs.private: -ldl -lm -lpthread -lrt
Cflags: -I${includedir_old} -I${includedir_new}

I finally run the last command and I have a link error with the opencv jar apparently

usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$ ./dlib-java "java-jar"
Exception in thread "main" java.lang.UnsatisfiedLinkError: opencv_java401
at com.github.radium226.commons.Libraries.lambda$static$3(Libraries.java:58)
at com.github.radium226.commons.Libraries.loadLibrary(Libraries.java:75)
at com.github.radium226.opencv.OpenCV.loadLibraries(OpenCV.java:10)
at com.github.radium226.dlib.DLib.loadLibraries(DLib.java:11)
at com.github.radium226.dlib.examples.Showcase.main(Showcase.java:20)

Fix this problem by modifying this code, is this correct?

dlib_java::exec_jar()
{
LD_LIBRARY_PATH="/tmp/opencv/usr/lib:/tmp/opencv/usr/share/java/opencv4:/tmp/dlib/usr/lib" java -jar "dlib/target/dlib-1.0-SNAPSHOT.jar"
"$( find . -name "lena.jpg" -print | head -n1 )"
}

Now what does not load me correctly is the libdlib-java.so

usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$ ./dlib-java "java-jar"
Loading libraryName ..dlib-java
InputStream inputStream = Libraries.class.getClassLoader().getResourceAsStream(libraryFileName(libraryName));dlib-java
Path temporaryFolderPath = Files.createTempDirectory(libraryName);/tmp/dlib-java7352831714382653951
Path libraryFilePath = temporaryFolderPath.resolve(libraryFileName(libraryName));/tmp/dlib-java7352831714382653951/libdlib-java.so
Files.copy(inputStream, libraryFilePath);dlib-java
Before Files.exists(libraryFilePath) libraryFilePath:/home/usuario/dlib_java/dlib-java-master/target/generated-resources/swig/libdlib-java.so
throw new UnsatisfiedLinkError(libraryName);

Exception in thread "main" java.lang.UnsatisfiedLinkError: dlib-java
at com.github.radium226.commons.Libraries.lambda$static$3(Libraries.java:67)
at com.github.radium226.commons.Libraries.loadLibrary(Libraries.java:84)
at com.github.radium226.dlib.DLib.loadLibraries(DLib.java:13)
at com.github.radium226.dlib.examples.Showcase.main(Showcase.java:20)

I'm looking for my error in the Libraries.java code

public static LibraryLoader SWIG_GENERATED_RESOURCES = libraryName -> {
Path libraryFilePath = Paths
.get(System.getProperty("user.dir"))
.resolve("target/generated-resources/swig/")
.resolve(libraryFileName(libraryName));

    if (Files.exists(libraryFilePath)) {
        System.load(libraryFilePath.toString());
    } else {
        throw new UnsatisfiedLinkError(libraryName);
    }
};

I was making some changes in the code, to be able to load the file libdib-java.so
dlibjava

usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$ ./dlib-java "java-jar"
libraryFilePath :/usr/share/dlibjava/libdlib-java.so
System.load(libraryFilePath.toString());
Exception in thread "main" java.lang.UnsatisfiedLinkError: dlib-java
at com.github.radium226.commons.Libraries.lambda$static$3(Libraries.java:64)
at com.github.radium226.commons.Libraries.loadLibrary(Libraries.java:81)
at com.github.radium226.dlib.DLib.loadLibraries(DLib.java:13)
at com.github.radium226.dlib.examples.Showcase.main(Showcase.java:20)

usuario@usuario-VirtualBox:~/dlib_java/dlib-java-master$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

@radium226
Copy link
Owner

I took some time... But I rewrote the compilation process. If you're still interested, you can check the README.md and see the new Makefiles!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants