radium226 / dlib-java

Java wrapper for the DLib library
GNU General Public License v3.0
13 stars 14 forks source link

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

Closed agunin closed 4 years ago

agunin commented 5 years ago

myproject

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

1)before_install:

2)script:

3) after_script:

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


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 commented 5 years ago

Hello !

I do not have the code in front of me right now, but I'll try to take a look today.

First, you are right: the path I used is wrong and you used the correct one in your second attempt.

Second, can you tell me which version of java you're using? It seems that you're issue is related tout JavaFX and I don't use it directly. I bet it's an issue comming from OpenCV and you should stick to java 1.8

Le mer. 27 févr. 2019 à 23:13, agunin notifications@github.com a écrit :

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$

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/radium226/dlib-java/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AGBcUOkGK2U_UwlLiRGtcDSivMEbYgqeks5vRwMTgaJpZM4bVkU5 .

agunin commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

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 commented 5 years ago

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 commented 4 years ago

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!