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

Gradle Android presets only for old Arm & x86? #754

Closed
anonym24 opened this issue Aug 2, 2017 · 48 comments
Closed

Gradle Android presets only for old Arm & x86? #754

anonym24 opened this issue Aug 2, 2017 · 48 comments

Comments

@anonym24
Copy link

anonym24 commented Aug 2, 2017

ndk {
	abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}

dependencies {
	...
	compile('org.bytedeco:javacv-platform:1.3.3') { exclude group: 'org.bytedeco.javacpp-presets' }
	compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm' // old armeabi
	compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-x86' 

What about presets for 'x86_64', 'armeabi-v7a', 'arm64-v8a'? So after compilation only armeabi & x86 folders have .so files (in app.apk/lib)

I don't even want to support old armeabi (it should be at least armeabi-v7a)

Do I have to compile libraries by myself? No predefined libraries for all modern architectures?
How to do it?

@saudet
Copy link
Member

saudet commented Aug 2, 2017 via email

@anonym24
Copy link
Author

anonym24 commented Aug 2, 2017

so I can put .so files from "android-arm" to 'armeabi-v7a', 'arm64-v8a' folders (jniLibs) and from "android-x86" to 'x86_64'?

@anonym24
Copy link
Author

anonym24 commented Aug 2, 2017

no, it won't work if I just copy .so files from arm to arm64
I get Unsatisfied link error

So it only works if I set to use only 32 bit libraries in my app:

ndk {
	abiFilters 'x86', 'armeabi-v7a'
}

but I don't want to solve the problem like this because I have other libraries (not just javacv) and I prefer to use 64 bit compiled .so files, only this javacv library in my project lacks those files
how can I compile libraries for arm64 and x86_64?

@saudet
Copy link
Member

saudet commented Aug 3, 2017

Yes of course it's possible. If you have any issues creating 64-bit binaries, let me know and I will help!

Also, please consider making a contribution with those binaries once you create them. Thank you

In any case, making this as a duplicate of bytedeco/javacpp-presets#52

@saudet saudet marked this as a duplicate of bytedeco/javacpp-presets#52 Aug 3, 2017
@saudet saudet closed this as completed Aug 3, 2017
@saudet
Copy link
Member

saudet commented Aug 3, 2017

FYI, build instructions are in the README.md file:
https://github.com/bytedeco/javacpp-presets#build-instructions
Simply adjust the scripts for 64-bit platforms and run the build as instructed.

@anonym24
Copy link
Author

anonym24 commented Aug 7, 2017

Firstly I tried to build ffmpeg libs just for arm (not arm64) ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm install
I got next .so files in ~/Android/javacpp-presets/ffmpeg/cppbuild/android-arm/lib:

INSTALL libavdevice/libavdevice.so
INSTALL libavfilter/libavfilter.so
INSTALL libavformat/libavformat.so
INSTALL libavcodec/libavcodec.so
INSTALL libpostproc/libpostproc.so
INSTALL libswresample/libswresample.so
INSTALL libswscale/libswscale.so
INSTALL libavutil/libavutil.so

(8 files)

but it seems there should be more .so files like from http://central.maven.org/maven2/org/bytedeco/javacpp-presets/ffmpeg/3.2.1-1.3/ffmpeg-3.2.1-1.3.jar:

Directory of ffmpeg libs\armeabi-v7a

07.12.2016 13:45 16 064 024 libavcodec.so
07.12.2016 13:45 59 336 libavdevice.so
07.12.2016 13:45 1 836 540 libavfilter.so
07.12.2016 13:45 3 563 888 libavformat.so
07.12.2016 13:46 427 372 libavutil.so
07.12.2016 13:45 603 600 libjniavcodec.so
07.12.2016 13:45 161 232 libjniavdevice.so
07.12.2016 13:45 267 728 libjniavfilter.so
07.12.2016 13:45 554 448 libjniavformat.so
07.12.2016 13:46 509 388 libjniavutil.so
07.12.2016 13:46 140 828 libjnipostproc.so
07.12.2016 13:46 140 828 libjniswresample.so
07.12.2016 13:46 165 324 libjniswscale.so
07.12.2016 13:46 50 520 libpostproc.so
07.12.2016 13:46 83 288 libswresample.so
07.12.2016 13:46 365 912 libswscale.so

(17 files)

Also tried to compile arm64

In cppbuild.sh I changed

export ANDROID_NDK
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/"
case $PLATFORM in
    android-x86)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/x86-4.9/prebuilt/$KERNEL-$ARCH/bin/i686-linux-android"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-x86/"
        ;;
    *)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$KERNEL-$ARCH/bin/arm-linux-androideabi"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-arm/"
        ;;
esac

to (changed lines for arm)

export ANDROID_NDK
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/"
case $PLATFORM in
    android-x86)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/x86-4.9/prebuilt/$KERNEL-$ARCH/bin/i686-linux-android"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-x86/"
        ;;
    *)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/aarch64-linux-android-4.9/prebuilt/$KERNEL-$ARCH/bin/aarch64-linux-android"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-arm64/"
        ;;
esac

but when I run ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm instal

I get an error:

Detected platform "linux-x86_64"
Building for platform "android-arm"
Installing "ffmpeg"
~/Android/javacpp-presets/ffmpeg/cppbuild ~/Android/javacpp-presets
Decompressing archives...
Total bytes read: 3205120 (3.1MiB, 16MiB/s)
Total bytes read: 6072320 (5.8MiB, 19MiB/s)
Total bytes read: 3635200 (3.5MiB, 10MiB/s)
Total bytes read: 5857280 (5.6MiB, 21MiB/s)
Total bytes read: 24770560 (24MiB, 19MiB/s)
Total bytes read: 50135040 (48MiB, 4.8MiB/s)
Total bytes read: 4915200 (4.7MiB, 14MiB/s)
Total bytes read: 11141120 (11MiB, 26MiB/s)
Total bytes read: 16230400 (16MiB, 40MiB/s)
Total bytes read: 64808960 (62MiB, 4.1MiB/s)
Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting.

So I have two problems:

  • for arm I got not all files
  • for arm64 I didn't success in building libraries

@saudet
Copy link
Member

saudet commented Aug 7, 2017 via email

@anonym24
Copy link
Author

anonym24 commented Aug 8, 2017

Is this write a command? ~/Android/javacpp-presets$ mvn clean install -Djavacpp.platform=android-xxx -Djavacpp.platform.root=~/Android/android-ndk/ -Djavacpp.platform.compiler=~/Android/android-ndk/toolchains/arm-linux-androideabi-4.9/ path for g++ is correct?

I tried it but build failed:

~/Android/javacpp-presets$ mvn clean install -Djavacpp.platform=android-xxx -Djavacpp.platform.root=~/Android/android-ndk/ -Djavacpp.platform.compiler=~/Android/android-ndk/toolchains/arm-linux-androideabi-4.9/
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:opencv:jar:3.2.0-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:opencv:3.2.0-${project.parent.version}, /home/osboxes/Android/javacpp-presets/opencv/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:ffmpeg:jar:3.3.2-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:ffmpeg:3.3.2-${project.parent.version}, /home/osboxes/Android/javacpp-presets/ffmpeg/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:flycapture:jar:2.11.3.121-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:flycapture:2.11.3.121-${project.parent.version}, /home/osboxes/Android/javacpp-presets/flycapture/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:libdc1394:jar:2.2.5-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:libdc1394:2.2.5-${project.parent.version}, /home/osboxes/Android/javacpp-presets/libdc1394/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:libfreenect:jar:0.5.3-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:libfreenect:0.5.3-${project.parent.version}, /home/osboxes/Android/javacpp-presets/libfreenect/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:libfreenect2:jar:0.2.0-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:libfreenect2:0.2.0-${project.parent.version}, /home/osboxes/Android/javacpp-presets/libfreenect2/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:librealsense:jar:1.9.6-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:librealsense:1.9.6-${project.parent.version}, /home/osboxes/Android/javacpp-presets/librealsense/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:videoinput:jar:0.200-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:videoinput:0.200-${project.parent.version}, /home/osboxes/Android/javacpp-presets/videoinput/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:artoolkitplus:jar:2.3.1-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:artoolkitplus:2.3.1-${project.parent.version}, /home/osboxes/Android/javacpp-presets/artoolkitplus/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:chilitags:jar:master-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:chilitags:master-${project.parent.version}, /home/osboxes/Android/javacpp-presets/chilitags/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:flandmark:jar:1.07-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:flandmark:1.07-${project.parent.version}, /home/osboxes/Android/javacpp-presets/flandmark/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:hdf5:jar:1.10.1-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:hdf5:1.10.1-${project.parent.version}, /home/osboxes/Android/javacpp-presets/hdf5/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:mkl:jar:2017.2-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:mkl:2017.2-${project.parent.version}, /home/osboxes/Android/javacpp-presets/mkl/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:openblas:jar:0.2.19-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:openblas:0.2.19-${project.parent.version}, /home/osboxes/Android/javacpp-presets/openblas/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:fftw:jar:3.3.6-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:fftw:3.3.6-${project.parent.version}, /home/osboxes/Android/javacpp-presets/fftw/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:gsl:jar:2.4-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:gsl:2.4-${project.parent.version}, /home/osboxes/Android/javacpp-presets/gsl/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:llvm:jar:4.0.0-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:llvm:4.0.0-${project.parent.version}, /home/osboxes/Android/javacpp-presets/llvm/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:leptonica:jar:1.74.4-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:leptonica:1.74.4-${project.parent.version}, /home/osboxes/Android/javacpp-presets/leptonica/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:tesseract:jar:3.05.01-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:tesseract:3.05.01-${project.parent.version}, /home/osboxes/Android/javacpp-presets/tesseract/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:caffe:jar:1.0-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:caffe:1.0-${project.parent.version}, /home/osboxes/Android/javacpp-presets/caffe/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:cuda:jar:8.0-6.0-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:cuda:8.0-6.0-${project.parent.version}, /home/osboxes/Android/javacpp-presets/cuda/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:mxnet:jar:0.10.0-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:mxnet:0.10.0-${project.parent.version}, /home/osboxes/Android/javacpp-presets/mxnet/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:tensorflow:jar:1.2.1-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:tensorflow:${tensorflow.version}-${project.parent.version}, /home/osboxes/Android/javacpp-presets/tensorflow/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:ale:jar:20170702-5c7dfa5-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:ale:20170702-5c7dfa5-${project.parent.version}, /home/osboxes/Android/javacpp-presets/ale/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:liquidfun:jar:20150401-0708ce1-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:liquidfun:20150401-0708ce1-${project.parent.version}, /home/osboxes/Android/javacpp-presets/liquidfun/pom.xml, line 14, column 12
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.bytedeco.javacpp-presets:skia:jar:20170511-53d6729-1.3.4-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.bytedeco.javacpp-presets:skia:20170511-53d6729-${project.parent.version}, /home/osboxes/Android/javacpp-presets/skia/pom.xml, line 14, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] Inspecting build with total of 27 modules...
[INFO] Not installing Nexus Staging features:
[INFO]  * Preexisting staging related goal bindings found in 27 modules.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] JavaCPP Presets
[INFO] JavaCPP Presets for OpenCV
[INFO] JavaCPP Presets for FFmpeg
[INFO] JavaCPP Presets for FlyCapture
[INFO] JavaCPP Presets for libdc1394
[INFO] JavaCPP Presets for libfreenect
[INFO] JavaCPP Presets for libfreenect2
[INFO] JavaCPP Presets for librealsense
[INFO] JavaCPP Presets for videoInput
[INFO] JavaCPP Presets for ARToolKitPlus
[INFO] JavaCPP Presets for Chilitags
[INFO] JavaCPP Presets for flandmark
[INFO] JavaCPP Presets for HDF5
[INFO] JavaCPP Presets for MKL
[INFO] JavaCPP Presets for OpenBLAS
[INFO] JavaCPP Presets for FFTW
[INFO] JavaCPP Presets for GSL
[INFO] JavaCPP Presets for LLVM
[INFO] JavaCPP Presets for Leptonica
[INFO] JavaCPP Presets for Tesseract
[INFO] JavaCPP Presets for Caffe
[INFO] JavaCPP Presets for CUDA
[INFO] JavaCPP Presets for MXNet
[INFO] JavaCPP Presets for TensorFlow
[INFO] JavaCPP Presets for ALE
[INFO] JavaCPP Presets for LiquidFun
[INFO] JavaCPP Presets for Skia
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaCPP Presets 1.3.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ javacpp-presets ---
[INFO] 
[INFO] --- maven-javadoc-plugin:2.10.4:jar (attach-javadocs) @ javacpp-presets ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ javacpp-presets ---
[INFO] Installing /home/osboxes/Android/javacpp-presets/pom.xml to /home/osboxes/.m2/repository/org/bytedeco/javacpp-presets/1.3.4-SNAPSHOT/javacpp-presets-1.3.4-SNAPSHOT.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JavaCPP Presets for OpenCV 3.2.0-1.3.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/bytedeco/javacpp/1.3.4-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata org.bytedeco:javacpp:1.3.4-SNAPSHOT/maven-metadata.xml from/to sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots): oss.sonatype.org: Temporary failure in name resolution
[WARNING] Failure to transfer org.bytedeco:javacpp:1.3.4-SNAPSHOT/maven-metadata.xml from https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of sonatype-nexus-snapshots has elapsed or updates are forced. Original error: Could not transfer metadata org.bytedeco:javacpp:1.3.4-SNAPSHOT/maven-metadata.xml from/to sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots): oss.sonatype.org: Temporary failure in name resolution
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.7/maven-resources-plugin-2.7.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] JavaCPP Presets .................................... SUCCESS [  2.277 s]
[INFO] JavaCPP Presets for OpenCV ......................... FAILURE [  0.909 s]
[INFO] JavaCPP Presets for FFmpeg ......................... SKIPPED
[INFO] JavaCPP Presets for FlyCapture ..................... SKIPPED
[INFO] JavaCPP Presets for libdc1394 ...................... SKIPPED
[INFO] JavaCPP Presets for libfreenect .................... SKIPPED
[INFO] JavaCPP Presets for libfreenect2 ................... SKIPPED
[INFO] JavaCPP Presets for librealsense ................... SKIPPED
[INFO] JavaCPP Presets for videoInput ..................... SKIPPED
[INFO] JavaCPP Presets for ARToolKitPlus .................. SKIPPED
[INFO] JavaCPP Presets for Chilitags ...................... SKIPPED
[INFO] JavaCPP Presets for flandmark ...................... SKIPPED
[INFO] JavaCPP Presets for HDF5 ........................... SKIPPED
[INFO] JavaCPP Presets for MKL ............................ SKIPPED
[INFO] JavaCPP Presets for OpenBLAS ....................... SKIPPED
[INFO] JavaCPP Presets for FFTW ........................... SKIPPED
[INFO] JavaCPP Presets for GSL ............................ SKIPPED
[INFO] JavaCPP Presets for LLVM ........................... SKIPPED
[INFO] JavaCPP Presets for Leptonica ...................... SKIPPED
[INFO] JavaCPP Presets for Tesseract ...................... SKIPPED
[INFO] JavaCPP Presets for Caffe .......................... SKIPPED
[INFO] JavaCPP Presets for CUDA ........................... SKIPPED
[INFO] JavaCPP Presets for MXNet .......................... SKIPPED
[INFO] JavaCPP Presets for TensorFlow ..................... SKIPPED
[INFO] JavaCPP Presets for ALE ............................ SKIPPED
[INFO] JavaCPP Presets for LiquidFun ...................... SKIPPED
[INFO] JavaCPP Presets for Skia ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.432 s
[INFO] Finished at: 2017-08-08T13:15:17+03:00
[INFO] Final Memory: 25M/189M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.7: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.7 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Temporary failure in name resolution: Unknown host repo.maven.apache.org: Temporary failure in name resolution -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

@anonym24
Copy link
Author

anonym24 commented Aug 8, 2017

Also I want to build only for ffmpeg, not opencv or something else

@saudet
Copy link
Member

saudet commented Aug 8, 2017 via email

@anonym24
Copy link
Author

anonym24 commented Aug 16, 2017

screenshot_3

screenshot_4

I did all of this:

in my ~/Android folder (which has ndk, javacpp and javacpp-presets folders)

git clone https://github.com/bytedeco/javacpp.git --branch master
git clone https://github.com/bytedeco/javacpp-presets.git --branch master
cd javacpp
mvn clean install

get back to Android folder

cd javacpp-presets
ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm install ffmpeg
mvn clean install -Djavacpp.platform=android-arm -Djavacpp.platform.root=~/Android/android-ndk/ -Djavacpp.platform.compiler=~/Android/android-ndk/toolchains/arm-linux-androideabi-4.9/

@anonym24
Copy link
Author

I run mvn install --projects .,ffmpeg and build failed after 4 min:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] JavaCPP Presets .................................... SUCCESS [  3.226 s]
[INFO] JavaCPP Presets for FFmpeg ......................... FAILURE [04:11 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:18 min
[INFO] Finished at: 2017-08-16T13:52:44+03:00
[INFO] Final Memory: 30M/194M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.bytedeco:javacpp:1.3.4-SNAPSHOT:build (javacpp.cppbuild.install) on project ffmpeg: Execution javacpp.cppbuild.install of goal org.bytedeco:javacpp:1.3.4-SNAPSHOT:build failed: Process exited with an error: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :ffmpeg



@saudet
Copy link
Member

saudet commented Aug 16, 2017

Could you show me the error that you get?

@saudet
Copy link
Member

saudet commented Aug 16, 2017

Just post the whole log, thanks!

@anonym24
Copy link
Author

how to do it?

commands with &>> log.txt or & tee -a log.txt doesn't work for me (ubuntu)

ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm clean ffmpeg &>> log.txt
ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm install ffmpeg &>> log.txt
mvn clean install --projects .,ffmpeg &>> log.txt

@saudet
Copy link
Member

saudet commented Aug 17, 2017

Just copy/paste from the console maybe?

@anonym24
Copy link
Author

anonym24 commented Aug 17, 2017

but it doesn't show full log (from the start), and quite hard to copy all of it, ctrl+a won't work, only mouse left click + mouse scroll to the start of console output

@anonym24
Copy link
Author

So here my stuff

screenshot_1

I run

cd javacpp-presets
ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm clean ffmpeg
ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm install ffmpeg
mvn clean install --projects .,ffmpeg

I got (but it doesn't show some logs from the start)

logs.txt

@saudet
Copy link
Member

saudet commented Aug 18, 2017

Found no assembler
Minimum version is yasm-1.2.0
If you really want to compile without asm, configure with --disable-asm.

Looks like x264 wants to use yasm here. Could you try to install it or add that flag to the cppbuild.sh script?

@anonym24
Copy link
Author

anonym24 commented Aug 19, 2017

I installed and it fixed building, but something weird I got:

screenshot_4

again I'm not sure if I got all needed .so files, also when I zipped all of them and opened tar I see that many of them == 0 bytes

@saudet
Copy link
Member

saudet commented Aug 19, 2017

yes, that's normal

@anonym24
Copy link
Author

so again I got only 8 files (which != 0 bytes):

screenshot_2

in original libraries (for arm v7) there are 16 .so files:

screenshot_1

(http://central.maven.org/maven2/org/bytedeco/javacpp-presets/ffmpeg/3.2.1-1.3/ffmpeg-3.2.1-1.3.jar)

so it won't work with only those 8 files (ffmpeg video recording in android, app will crash with some Unsatisfied Link Error)

@saudet
Copy link
Member

saudet commented Aug 19, 2017 via email

@anonym24
Copy link
Author

anonym24 commented Aug 19, 2017

Do you mean this?
screenshot_1
So I can use them with any android processor?

And again it was mine first successful build for arm v7 (32 bit)

Now I want to try to build for arm v8 (64 bit)

As I already mention I didn't success to build it for 64:

In cppbuild.sh I changed

export ANDROID_NDK
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/"
case $PLATFORM in
    android-x86)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/x86-4.9/prebuilt/$KERNEL-$ARCH/bin/i686-linux-android"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-x86/"
        ;;
    *)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$KERNEL-$ARCH/bin/arm-linux-androideabi"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-arm/"
        ;;
esac

to (changed lines for arm)

export ANDROID_NDK
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/"
case $PLATFORM in
    android-x86)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/x86-4.9/prebuilt/$KERNEL-$ARCH/bin/i686-linux-android"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-14/arch-x86/"
        ;;
    *)
        export ANDROID_BIN="$ANDROID_NDK/toolchains/aarch64-linux-android-4.9/prebuilt/$KERNEL-$ARCH/bin/aarch64-linux-android"
        export ANDROID_ROOT="$ANDROID_NDK/platforms/android-21/arch-arm64/"
        ;;
esac

but when I run ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm instal

I get an error:

Detected platform "linux-x86_64"
Building for platform "android-arm"
Installing "ffmpeg"
~/Android/javacpp-presets/ffmpeg/cppbuild ~/Android/javacpp-presets
Decompressing archives...
Total bytes read: 3205120 (3.1MiB, 16MiB/s)
Total bytes read: 6072320 (5.8MiB, 19MiB/s)
Total bytes read: 3635200 (3.5MiB, 10MiB/s)
Total bytes read: 5857280 (5.6MiB, 21MiB/s)
Total bytes read: 24770560 (24MiB, 19MiB/s)
Total bytes read: 50135040 (48MiB, 4.8MiB/s)
Total bytes read: 4915200 (4.7MiB, 14MiB/s)
Total bytes read: 11141120 (11MiB, 26MiB/s)
Total bytes read: 16230400 (16MiB, 40MiB/s)
Total bytes read: 64808960 (62MiB, 4.1MiB/s)
Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting.

Is edited script looks ok?

@saudet
Copy link
Member

saudet commented Aug 19, 2017 via email

@rubi-sharma
Copy link

Please help to generate arm v8 (64 bit) for android .

@anonym24
Copy link
Author

anonym24 commented Sep 1, 2017

I stopped for a while this process.
I just didn't know what to do.
From the last comment @saudet says I need to check the NDK's documentation, but what exactly? And which part of script (cppbuild.sh) is wrong? or is it not just about script?

@saudet
Copy link
Member

saudet commented Sep 1, 2017 via email

@rubi-sharma
Copy link

Where is the source code for linjniopencv_core.so and libjniopencv_imagproc.so ? So that we can rebuild it.

@saudet
Copy link
Member

saudet commented Sep 7, 2017

They are generated at build time and deleted upon success. Set the "deleteJniFiles" plugin configuration option or the "javacpp.deleteJniFiles" system property to "false" to keep them around for debugging purposes.

@anonym24
Copy link
Author

anonym24 commented Sep 14, 2017

Seems I almost succeeded in building arm64-v8a for FFMPEG 3.2.1:

@saudet could you please take a look?

Script (.sh) - automatically downloads ffmpeg library code:

# don't forget to install yasm.

# ffmpeg arm64-v8a build script

set -e 

BUILD_DIR=`pwd`/ffmpeg-android

# FFMPEG_VERSION="2.8.3"

FFMPEG_VERSION="3.2.1"

if [ ! -e "ffmpeg-$FFMPEG_VERSION.tar.bz2" ]; then
    echo "Downloading ffmpeg-$FFMPEG_VERSION.tar.bz2"
    curl -LO http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2
else
    echo "Using ffmpeg-$FFMPEG_VERSION.tar.bz2"
fi

tar -xvf ffmpeg-$FFMPEG_VERSION.tar.bz2

CPU=arm64-v8a
ARCH=arm64
OPTIMIZE_CFLAGS=
PREFIX=$BUILD_DIR/$CPU
ADDITIONAL_CONFIGURE_FLAG=
PLATFORM=/home/osboxes/Android/android-ndk/platforms/android-23/arch-arm64/
PREBUILT=/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
HOST=aarch64-linux-android

pushd ffmpeg-$FFMPEG_VERSION
./configure --target-os=linux \
    --incdir=$BUILD_DIR/include \
    --libdir=$BUILD_DIR/lib/$CPU \
    --enable-cross-compile \
    --arch=$ARCH \
    --cc=$PREBUILT/bin/$HOST-gcc \
    --cross-prefix=$PREBUILT/bin/$HOST- \
    --nm=$PREBUILT/bin/$HOST-nm \
    --sysroot=$PLATFORM \
    --extra-cflags="-I$BUILD_DIR/include -fPIC -DANDROID -Wfatal-errors -Wno-deprecated $OPTIMIZE_CFLAGS" \
    --enable-small \
    --extra-ldflags="-L$BUILD_DIR/lib/$CPU" \
    --enable-shared \
    --disable-doc \
    --disable-programs \
    --disable-stripping \
    --disable-symver \
    --disable-static \
    --pkg-config=/usr/local/bin/pkg-config \
    $ADDITIONAL_CONFIGURE_FLAG

make clean
make -j8
make install
$PREBUILT/bin/$HOST-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/$HOST-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -soname libffmpeg.so -shared -nostdlib  -z noexecstack -Bsymbolic --whole-archive --no-undefined -o libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog  --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/$HOST/4.9.x/libgcc.a
popd
# libpostproc/libpostproc.a 

screenshot_2

I got 7 .so files (not 8)
libjnipostproc.so is missing
because it's not even has source c files:

screenshot_3

I don't know if we need this one (in my case do I need it for ffmpeg recording - FFmpegFrameRecorder?)

But at the end of my build I got some errors (though it built all 7 .so files):

/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar: creating libavcodec/libavcodec.a
/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld: cannot find libavformat/libavformat.a: No such file or directory
/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld: cannot find libavutil/libavutil.a: No such file or directory
/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld: cannot find libswscale/libswscale.a: No such file or directory

What could be wrong and why did it still build all .so files?

And also, what about other 8 .so files? For arm-v7 as @saudet said we can find it in the target folder of javacpp - #754 (comment) (javacpp-presets/ffmpeg/target/classes/org/bytedeco/javacpp/linux-x86_64/)

but will they suit for arm64-v8a or do we also need to build those .so files differently (also for 64 bit architecture) ?

Or they fit/suit for any architecture? (arm32 or arm64, or x86 or x86_64) even if I got them during building for arm-v7a (32 bit)?

I tried to add my 7 .so files (which I have built using that script, removed numbers in filename for each .so files of cousre) and other .so files from "javacpp-presets/ffmpeg/target/classes/org/bytedeco/javacpp/linux-x86_64" folder to \app\src\main\jniLibs\arm64-v8a

in "javacpp-presets/ffmpeg/target/classes/org/bytedeco/javacpp/linux-x86_64" there were 15 files (also it had libpostproc.so), I copied those files to my "...\jniLibs\arm64-v8a" without replace (because some files from 7 .so arm64-v8a building already there)

at end I got next picture:

screenshot_4

but when I run my app (start recording video using FFmpegFrameRecorder) I get runtime error:

E/AndroidRuntime: FATAL EXCEPTION: Thread-61912
                                                 Process: com.example.driverassistance, PID: 8089
                                                 java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil

yeah, building log also mentioned avutil (as I said above) - "cannot find libavutil/libavutil.a: No such file or directory":

/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar: creating libavcodec/libavcodec.a
/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld: cannot find libavformat/libavformat.a: No such file or directory
/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld: cannot find libavutil/libavutil.a: No such file or directory
/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld: cannot find libswscale/libswscale.a: No such file or directory

Full Log when building for arm64-v8a:

ffmpeg arm64-v8a.txt

@saudet
Copy link
Member

saudet commented Sep 14, 2017

To get the same set of files and features, reuse as much of the commands from the cppbuild.sh file for android-arm, but change the flags required for android-arm64.

@anonym24
Copy link
Author

anonym24 commented Sep 15, 2017

@saudet

I edited javacpp-presets/cppbuild.sh like this

#!/bin/bash
# Scripts to build and install native C++ libraries
set -eu

which cmake3 &> /dev/null && CMAKE3="cmake3" || CMAKE3="cmake"
[[ -z ${CMAKE:-} ]] && CMAKE=$CMAKE3
[[ -z ${MAKEJ:-} ]] && MAKEJ=4
[[ -z ${OLDCC:-} ]] && OLDCC="gcc"
[[ -z ${OLDCXX:-} ]] && OLDCXX="g++"
[[ -z ${OLDFC:-} ]] && OLDFC="gfortran"

KERNEL=(`uname -s | tr [A-Z] [a-z]`)
ARCH=(`uname -m | tr [A-Z] [a-z]`)
case $KERNEL in
    darwin)
        OS=macosx
        ;;
    mingw32*)
        OS=windows
        KERNEL=windows
        ARCH=x86
        ;;
    mingw64*)
        OS=windows
        KERNEL=windows
        ARCH=x86_64
        ;;
    *)
        OS=$KERNEL
        ;;
esac
ARCH=arm64
PLATFORM=$OS-$ARCH
echo "Detected platform \"$PLATFORM\""

while [[ $# > 0 ]]; do
    case "$1" in
        -platform)
            shift
            PLATFORM="$1"
            ;;
        install)
            OPERATION=install
            ;;
        clean)
            OPERATION=clean
            ;;
        *)
            PROJECTS+=("$1")
            ;;
    esac
    shift
done
echo "Building for platform \"$PLATFORM\""

if [[ -z ${OPERATION:-} ]]; then
    echo "Usage: ANDROID_NDK=/path/to/android-ndk/ bash cppbuild.sh [-platform <name>] <install | clean> [projects]"
    echo "where possible platform names are: android-arm, android-x86, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64, etc."
    exit 1
fi

if [[ -z ${ANDROID_NDK:-} ]]; then
    ANDROID_NDK=~/Android/android-ndk/
fi
export ANDROID_NDK
export ANDROID_CPP="$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.9/"
export ANDROID_BIN="/home/osboxes/Android/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android"
export ANDROID_ROOT="/home/osboxes/Android/android-ndk/platforms/android-23/arch-arm64/"

TOP_PATH=`pwd`

function download {
    mkdir -p "$TOP_PATH/downloads"
    if [[ ! -e "$TOP_PATH/downloads/$2" ]]; then
        echo "Downloading $1"
        curl -L "$1" -o "$TOP_PATH/downloads/$2" --fail
        DOWNLOADSTATUS=$?
        if [ "$DOWNLOADSTATUS" -eq 28 ]
        then
		echo "Download timed out, waiting 5 minutes then trying again"
		rm "$TOP_PATH/downloads/$2"
		sleep 600
        	curl -L "$1" -o "$TOP_PATH/downloads/$2" --fail
        	if [ $? -ne 0 ]
        	then
			echo "File still could not be downloaded!"
			rm "$TOP_PATH/downloads/$2"
			exit 1
    		fi
        elif [ "$DOWNLOADSTATUS" -ne 0 ]
        then
		echo "File could not be downloaded!"
		rm "$TOP_PATH/downloads/$2"
		exit 1
        fi
    fi
    ln -sf "$TOP_PATH/downloads/$2" "$2"
}

    case $OPERATION in
        install)
                echo "Installing \"ffmpeg\""
                mkdir -p ffmpeg/cppbuild
                pushd ffmpeg/cppbuild
                source ../cppbuild.sh
                popd

            ;;
        clean)
            echo "Cleaning \"$PROJECT\""
            rm -Rf ffmpeg/cppbuild
            ;;
    esac

here is everything normal for arm64-v8a?

but as I understood I also have to edit cppbuild.sh in ffmpeg folder - javacpp-presets/ffmpeg/cppbuild.sh
right?

find everything related to arm-v7a and replace with what arm64-v8a needs?

@anonym24
Copy link
Author

anonym24 commented Sep 15, 2017

is there any logging so I could read which errors (in flags) happened?

Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting.

it's hard to debug script when I don't know where error happens (javacpp-presets/ffmpeg/cppbuild.sh)

#!/bin/bash
# This file is meant to be included by the parent cppbuild.sh script
if [[ -z "$PLATFORM" ]]; then
    pushd ..
    bash cppbuild.sh "$@" ffmpeg
    popd
    exit
fi

DISABLE="--disable-w32threads --disable-iconv --disable-opencl --disable-sdl --disable-bzlib --disable-lzma"
ENABLE="--enable-pthreads --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-openssl --enable-libopenh264 --enable-libx264 --enable-libx265 --enable-libvpx"

ZLIB=zlib-1.2.11
LAME=lame-3.99.5
SPEEX=speex-1.2.0
OPENCORE_AMR=opencore-amr-0.1.5
OPENSSL=openssl-1.1.0f
OPENH264_VERSION=1.7.0
X265=x265_2.4
VPX_VERSION=v1.6.1
ALSA_VERSION=1.1.4.1
FFMPEG_VERSION=3.3.2
download http://zlib.net/$ZLIB.tar.gz $ZLIB.tar.gz
download http://downloads.sourceforge.net/project/lame/lame/3.99/$LAME.tar.gz $LAME.tar.gz
download http://downloads.xiph.org/releases/speex/$SPEEX.tar.gz $SPEEX.tar.gz
download http://sourceforge.net/projects/opencore-amr/files/opencore-amr/$OPENCORE_AMR.tar.gz/download $OPENCORE_AMR.tar.gz
download https://www.openssl.org/source/$OPENSSL.tar.gz $OPENSSL.tar.gz
download https://github.com/cisco/openh264/archive/v$OPENH264_VERSION.tar.gz openh264-$OPENH264_VERSION.tar.gz
download ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2 last_stable_x264.tar.bz2
download https://ftp.videolan.org/pub/videolan/x265/$X265.tar.gz $X265.tar.gz
download https://chromium.googlesource.com/webm/libvpx/+archive/$VPX_VERSION.tar.gz libvpx-$VPX_VERSION.tar.gz
download ftp://ftp.alsa-project.org/pub/lib/alsa-lib-$ALSA_VERSION.tar.bz2 alsa-lib-$ALSA_VERSION.tar.bz2
download http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 ffmpeg-$FFMPEG_VERSION.tar.bz2

mkdir -p $PLATFORM
cd $PLATFORM
INSTALL_PATH=`pwd`
echo "Decompressing archives..."
tar --totals -xzf ../$ZLIB.tar.gz
tar --totals -xzf ../$LAME.tar.gz
tar --totals -xzf ../$SPEEX.tar.gz
tar --totals -xzf ../$OPENCORE_AMR.tar.gz
tar --totals -xzf ../$OPENSSL.tar.gz
tar --totals -xzf ../openh264-$OPENH264_VERSION.tar.gz
tar --totals -xjf ../last_stable_x264.tar.bz2
tar --totals -xzf ../$X265.tar.gz
mkdir -p libvpx-$VPX_VERSION
tar --totals -xzf ../libvpx-$VPX_VERSION.tar.gz -C libvpx-$VPX_VERSION
tar --totals -xjf ../ffmpeg-$FFMPEG_VERSION.tar.bz2
X264=`echo x264-snapshot-*`


export AR="$ANDROID_BIN-ar"
export CPP="$ANDROID_BIN-cpp"
export CC="$ANDROID_BIN-gcc"
export CXX="$ANDROID_BIN-g++"
export RANLIB="$ANDROID_BIN-ranlib"
export STRIP="$ANDROID_BIN-strip"
export CPPFLAGS="--sysroot=$ANDROID_ROOT -DANDROID"
export CFLAGS="$CPPFLAGS -fPIC -ffunction-sections -funwind-tables -fstack-protector -march=armv8-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-nostdlib -Wl,--fix-cortex-a8 -z text"
export LIBS="-lgcc -ldl -lz -lm -lc"
cd $ZLIB
./configure --prefix=$INSTALL_PATH --static --uname=aarch64-linux
make -j $MAKEJ
make install
cd ../$LAME
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=aarch64-linux-android
make -j $MAKEJ
make install
cd ../$SPEEX
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=aarch64-linux-android
cd libspeex
make -j $MAKEJ
make install
cd ../include
make install
cd ../../$OPENCORE_AMR
./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=aarch64-linux-android
make -j $MAKEJ
make install
cd ../$OPENSSL
./Configure --prefix=$INSTALL_PATH android-arm64-v8a $CFLAGS no-shared
ANDROID_DEV="$ANDROID_ROOT/usr" make # fails with -j > 1
make install_sw
cd ../openh264-$OPENH264_VERSION
LDFLAGS= make -j $MAKEJ PREFIX=$INSTALL_PATH OS=android ARCH=arm64 USE_ASM=No NDKROOT="$ANDROID_NDK" TARGET="$ANDROID_ROOT" libraries install-static
cd ../$X264
./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-cli --cross-prefix="$ANDROID_BIN-" --sysroot="$ANDROID_ROOT" --host=aarch64-linux-android --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS $LIBS"
make -j $MAKEJ
make install
cd ../$X265
patch -Np1 < ../../../$X265-android.patch || true
$CMAKE -DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DCMAKE_TOOLCHAIN_FILE=android-arm64.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source
make -j $MAKEJ x265-static
make install
cd ../libvpx-$VPX_VERSION
LDFLAGS= ./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-examples --sdk-path=$ANDROID_NDK --disable-tools --target=aarch64-linux-android-gcc --disable-runtime-cpu-detect --disable-neon --disable-neon-asm
make -j $MAKEJ
make install
cd ../ffmpeg-$FFMPEG_VERSION
patch -Np1 < ../../../ffmpeg-$FFMPEG_VERSION-android.patch
./configure --prefix=.. $DISABLE $ENABLE --enable-cross-compile --cross-prefix="$ANDROID_BIN-" --ranlib="$ANDROID_BIN-ranlib" --sysroot="$ANDROID_ROOT" --target-os=linux --arch=arm64 --extra-cflags="-I../include/ $CFLAGS" --extra-ldflags="$ANDROID_ROOT/usr/lib/crtbegin_so.o -L../lib/ -L$ANDROID_CPP/libs/arm64-v8a/ $LDFLAGS" --extra-libs="-lgnustl_static $LIBS" --disable-symver --disable-programs
make -j $MAKEJ
make install
cd ../..

@saudet
Copy link
Member

saudet commented Sep 17, 2017

You found some flags that appear to work in your comment above (#754 (comment)), so start by trying those out!

@luzengqi
Copy link

Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
/
./configure aborting.**

about this error,the cause was that you didn't actually have the appropriate GNU C compilers installed or GCC path is not properly。

you can do this sudo apt-get install build-essential
If the problem persists, check this: ANDROID_NDK=~/Android/android-ndk/ bash cppbuild.sh -platform android-arm install ffmpeg ,make sure you ANDROID_NDK path is correct,Use absolute path instead of ~/Android/android-ndk/ relative pathCheck the same as cppbuild.sh

@anonym24
Copy link
Author

anonym24 commented Sep 20, 2017

@luzengqi and? did you do everything it suggested to do?

@luzengqi
Copy link

@anonym24 I met this mistake before and now solved it。I recently began to compile, in the process of compiling encountered a lot of the same problem with you。arm64 I have not compiled out,
I'm trying to provide you with the script . i got a lot of help from you issue ,thx bro.

@luzengqi
Copy link

@saudet Which is the directory for the output of the so file?
ijbcx6ij8461 ni_w __w 2
51qcm4h m uvcydq slmmk

@saudet
Copy link
Member

saudet commented Sep 22, 2017 via email

@luzengqi
Copy link

@saudet i mean is that i use your build tools to build armv7 and arm64 v8 so file ,when i completed built,What is the output directory? i want to use these on my android project.

@saudet
Copy link
Member

saudet commented Sep 25, 2017 via email

@luzengqi
Copy link

@saudet sorry, i can't find this ~/.m2 directory.
Is it under javacpp-presets?

@saudet
Copy link
Member

saudet commented Sep 25, 2017

No, learn more about Maven: http://maven.apache.org/

@luzengqi
Copy link

@saudet

I mean, in which directory can I get the following file after I compile。
image

@saudet
Copy link
Member

saudet commented Oct 25, 2017

@luzengqi Before they are packaged in artifacts, they are all found under the target subdirectory, as you have noted yourself above.

@saudet
Copy link
Member

saudet commented Feb 27, 2018

64-bit builds for Android (as the "android-arm64" and "android-x86_64" platforms) are now available, so please give it a try! Binaries for 1.4.1-SNAPSHOT can be downloaded from the snapshot repository: http://bytedeco.org/builds/

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

No branches or pull requests

4 participants