käännä dlib ja opencv android ndk: lla

bendaf 07/28/2017. 1 answers, 983 views
android android build android-ndk dlib android-studio-2.3

Olen Android-kehittäjä, mutta olen uusi Android NDK: ssa, auta, tai kerro minulle, mitä muuta tarvitsisitte / miten yrität ratkaista tämäntyyppisen ongelman.

Käytin tätä dlib android-esimerkkiä varten ja virallista opencv android-kirjastoa varten, ja haluaisin yhdistää nämä kaksi sovellusta. Kun yritän rakentaa projektia, saan seuraavan virheen:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':openCVSamplefacedetection:externalNativeBuildDebug'.
> Build command failed.
  Error while executing process /home/feli/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/Application.mk APP_ABI=mips64 NDK_ALL_ABIS=mips64 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/lib /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj/local/mips64/libdetection_based_tracker.so}
  [mips64] Compile++      : detection_based_tracker <= DetectionBasedTracker_jni.cpp
  [mips64] Prebuilt       : libopencv_java3.so <= /home/feli/Android/openCV/OpenCV-android-sdk/sdk/native/jni/../libs/mips64/
  [mips64] SharedLibrary  : libdetection_based_tracker.so
  /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj/local/mips64/objs-debug/detection_based_tracker/DetectionBasedTracker_jni.o: In function `dlib_check_consistent_assert_usage':
  /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/dlib/dlib/threads/threads_kernel_shared.h:44: undefined reference to `USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj/local/mips64/libdetection_based_tracker.so] Error 1


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

Ensimmäinen arvioni oli, että en ole sisällyttänyt source.cpp-tiedostoa Android.mk: hen, mutta sen sijoittaminen src-tiedostoihin ei ratkaissut porttia. Tässä on minun Android.mk:

LOCAL_PATH := $(call my-dir)

## Build dlib to static library
include $(CLEAR_VARS)
LOCAL_MODULE := dlib
LOCAL_C_INCLUDES := $(LOCAL_PATH)/dlib

LOCAL_SRC_FILES += \
                $(LOCAL_PATH)/dlib/dlib/all/source.cpp \
                $(LOCAL_PATH)/dlib//dlib/threads/threads_kernel_shared.cpp \
                $(LOCAL_PATH)/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp \
                $(LOCAL_PATH)/dlib/dlib/base64/base64_kernel_1.cpp \
                $(LOCAL_PATH)/dlib/dlib/threads/threads_kernel_1.cpp \
                $(LOCAL_PATH)/dlib/dlib/threads/threads_kernel_2.cpp

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
include $(BUILD_STATIC_LIBRARY)

# Build opencv
include $(CLEAR_VARS)
OPENCVROOT := ~/Android/openCV/OpenCV-android-sdk
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE := SHARED
include ${OPENCVROOT}/sdk/native/jni/OpenCV.mk

LOCAL_MODULE     := detection_based_tracker
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_SRC_FILES  := DetectionBasedTracker_jni.cpp

LOCAL_LDLIBS     += -lm -llog -ldl -lz -ljnigraphics
LOCAL_CPPFLAGS += -fexceptions -frtti -std=c++11

# LOCAL_STATIC_LIBRARIES += dlib

include $(BUILD_SHARED_LIBRARY) 

Ehkä NDK_PROJECT_PATH=null on ongelma? Miksi nämä kaksi kirjastoa rakentuvat erikseen? Tai mitä muuta voi olla ongelma? Yritin paljon muokata Android.mk: ta, mutta se on minulle mysteeri. Kaikki apu tai mielipide olisi hyödyllistä.

EDIT:

Kun kommentoin LOCAL_STATIC_LIBRARIES += dlib riviä, sain seuraavan poikkeuksen:

Build command failed.
  Error while executing process /home/feli/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/Application.mk APP_ABI=mips64 NDK_ALL_ABIS=mips64 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/lib /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj/local/mips64/libdetection_based_tracker.so}
  [mips64] Compile++      : detection_based_tracker <= DetectionBasedTracker_jni.cpp
  [mips64] Compile++      : dlib <= source.cpp
  In file included from /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/dlib/dlib/all/source.cpp:76:
  In file included from /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/dlib/dlib/all/../gui_widgets/fonts.cpp:14:
  /home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/dlib/dlib/all/../gui_widgets/nativefont.h:27:10: fatal error: 'X11/Xlib.h' file not found
  #include            ^~~~~~~~~~~~
  1 error generated.
  make: *** [/home/feli/Development/android/test/face-detection/openCVSamplefacedetection/build/intermediates/ndkBuild/debug/obj/local/mips64/objs-debug/dlib//home/feli/Development/android/test/face-detection/openCVSamplefacedetection/src/main/jni/dlib/dlib/all/source.o] Error 1 

1 Answers


Alex Cohn 07/31/2017.

dlib käyttää cmake , eikä se ole triviaalinen asetus. Tämän kirjaston ndk-build komentosarjojen valmistaminen voi kestää kauan aikaa.

Ehdotan, että rakennat natiivin kirjaston, jossa on cmake , ndk-build cmake sijaan. Löydät esimerkin alkuperäisestä kirjastosta, joka käyttää OpenCviä GitHubissa .

Ehdotan myös, että aloitat abiFilters vain yhden tärkeimmän ABI: n ja vain silloin, kun näet, että kaikki toimii sinulle, voit rakentaa projektin muille ABI: ille. Muista, että joidenkin kirjastojen siirtäminen kaikkiin ABI: hen voi olla hankalaa. Ja jos sinulla ei ole alustaa suorittaa ainakin lyhyt saniteettitarkastus joillekin ABI: lle, ei ole mitään järkeä sen rakentamisessa.


HighResolutionMusic.com - Download Hi-Res Songs

1 Alan Walker

Lily flac

Alan Walker. 2018. Writer: Alan Walker;Lars Kristian Rosness;Magnus Bertelsen;K-391;Didrik Handlykken;Marcus Arnbekk.
2 Skylar Grey

Everything I Need flac

Skylar Grey. 2018. Writer: Elliott Taylor;Rupert Gregson-Williams;Skylar Grey.
3 Westlife

Hello My Love flac

Westlife. 2019. Writer: Steve Mac;Ed Sheeran.
4 Alan Walker

Lost Control flac

Alan Walker. 2018. Writer: Alan Walker;Thomas Troelsen;Mood Melodies;Sorana;Fredrik Borch Olsen;Magnus "Magnify" Martinsen.
5 Sam Smith

Fire On Fire flac

Sam Smith. 2018. Writer: Steve Mac;Sam Smith.
6 Alec Benjamin

Let Me Down Slowly flac

Alec Benjamin. 2019. Writer: Alec Benjamin;Sir Nolan;Michael Pollack.
7 Conor Maynard

Way Back Home (Sam Feldt Edit) flac

Conor Maynard. 2018. Writer: Ji Hye Lee;Shaun.
8 Alan Walker

Different World flac

Alan Walker. 2018. Writer: Shy Nodi;Alan Walker;Fredrik Borch Olsen;James Njie;Marcus Arnbekk;Gunnar Greve Pettersen;K-391;Corsak;Shy Martin;Magnus Bertelsen.
9 Post Malone

Sunflower flac

Post Malone. 2018. Writer: Carl Rosen;Louis Bell;Billy Walsh;Carter Lang;Swae Lee;Post Malone.
10 The Chainsmokers

Hope flac

The Chainsmokers. 2018. Writer: Kate Morgan;Chris Lyon;Alex Pall;Andrew Taggart.
11 Normani

Dancing With A Stranger flac

Normani. 2019. Writer: Mikkel S. Eriksen;Tor Hermansen;Jimmy Napes;Normani;Sam Smith.
12 Gesaffelstein

Lost In The Fire flac

Gesaffelstein. 2019. Writer: Ahmad Balshe;Nate Donmoyer;Gesaffelstein;DaHeala;The Weeknd.
13 Alan Walker

I Don't Wanna Go flac

Alan Walker. 2018.
14 Loren Gray

Anti-Everything flac

Loren Gray. 2019.
15 Backstreet Boys

No Place flac

Backstreet Boys. 2019.
16 Calvin Harris

Giant flac

Calvin Harris. 2019. Writer: Calvin Harris;Rag'n'Bone Man;Jamie Hartman;Troy Miller.
17 Ran-D

Zombie (Bassjackers Remix) flac

Ran-D. 2019.
18 Lana Del Rey

Hope Is A Dangerous Thing For A Woman Like Me To Have - But I Have It flac

Lana Del Rey. 2019. Writer: Lana Del Rey;Jack Antonoff.
19 Armin Van Buuren

Repeat After Me flac

Armin Van Buuren. 2019.
20 Lucas & Steve

Lunar flac

Lucas & Steve. 2019.

Related questions

Hot questions

Language

Popular Tags