build openh264 for android under linux - android

I'm trying to build openh264 to use on android
-I've the latest openh264 source from git
-I've ndk 17
-I'm using ubuntu 16.04
running
make OS=android NDKROOT=/home/r/aff/ndk TARGET=android-27 NDKLEVEL=27 sysroot=/home/r/aff/ndk/sysroot
I get the error:
r#r:~/aff/openh264$ make OS=android NDKROOT=/home/r/aff/ndk TARGET=android-27 NDKLEVEL=27 sysroot=/home/r/aff/ndk/sysroot/home/r/aff/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -O3 -DNDEBUG -DHAVE_NEON -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -DANDROID_NDK -fpic --sysroot=/home/r/aff/ndk/platforms/android-27/arch-arm -MMD -MP -DGENERATED_VERSION_HEADER -I./codec/api/svc -I./codec/common/inc -Icodec/common/inc -I/home/r/aff/ndk/sysroot -Dandroid_getCpuIdArm=wels_getCpuIdArm -Dandroid_setCpuArm=wels_setCpuArm -Dandroid_getCpuCount=wels_getCpuCount -Dandroid_getCpuFamily=wels_getCpuFamily -Dandroid_getCpuFeatures=wels_getCpuFeatures -Dandroid_setCpu=wels_setCpu -I/home/r/aff/ndk/sources/android/cpufeatures -c -o codec/common/src/cpu-features.o /home/r/aff/ndk/sources/android/cpufeatures/cpu-features.c
In file included from /home/r/aff/ndk/sources/android/cpufeatures/cpu-features.c:64:0:
/home/r/aff/ndk/sources/android/cpufeatures/cpu-features.h:31:23: fatal error: sys/cdefs.h: No such file or directory
#include <sys/cdefs.h>
^
compilation terminated.
build/platform-android.mk:96: recipe for target 'codec/common/src/cpu-features.o' failed
make: *** [codec/common/src/cpu-features.o] Error 1

When in doubt, stop rolling your own build configurations and use a standalone toolchain (pay particular attention to the section at the bottom about "Building open source projects using standalone toolchains": https://developer.android.com/ndk/guides/standalone_toolchain

Changing from
TARGET=android-27 NDKLEVEL=27
to
TARGET=android-21 NDKLEVEL=21
solved this issue for me.

Related

ocr tutorial ndk-build command error

I am following this tutorial for OCR implementation in my project and i went step by step .
best OCR (Optical character recognition) example in android
I set the path of the ndk in environment system variables as suggested. When i run the command ndk-build when going to tess-tw directory from command prompt, i am getting following error :
C:\Users\manpsing>cd eclipsework
C:\Users\manpsing\eclipsework>cd tess-two
C:\Users\manpsing\eclipsework\tess-two>ndk-build [armeabi] Compile
: jpgt <= jaricom.c process_begin: CreateProcess(NULL,
C:/64Software/android-ndk-r11b/build//../tool
chains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androidea bi-gcc -MMD -MP -MF ./obj/local/armeabi/objs/jpgt/jaricom.o.d
-Ijni/libjpeg -DAN DROID -Wa,--noexecstack -Wformat -Werror=format-security -isystem C:/64Software/ android-ndk-r11b/build//../platforms/android-8/arch-arm/usr/include -c
jni/libjp eg/jaricom.c -o ./obj/local/armeabi/objs/jpgt/jaricom.o,
...) failed. make (e=2): The system cannot find the file specified.
make: *** [obj/local/armeabi/objs/jpgt/jaricom.o] Error 2
C:\Users\manpsing\eclipsework\tess-two>
Please help me to resolve this issue. Thanks.
You need to use NDK r10e instead of r11.
reference:
https://github.com/rmtheis/tess-two/issues/152

Error when compiling the Python bindings of libtorrent

I'm currently trying to compile the libtorrent source files with Python bindings for Android. To do this, I have my custom toolchain with a compiled Boost library.
I use the following command to configure the libtorrent installation:
./configure --host=$CROSSHOST --prefix=$CROSSHOME --with-boost=$CROSSHOME --with-boost-libdir=$CROSSHOME/lib --enable-static --disable-shared --enable-debug --enable-logging --enable-python-binding
The variables are setup as follow:
export ANDROIDNDK='/home/martijn/Documenten/android-ndk-r9d'
export SYSROOT=$ANDROIDNDK/platforms/android-14/arch-arm
export PYTHON=/home/martijn/Documenten/python-for-android/build/python/Python-2.7.2/hostpython
export PYTHON_CPP_FLAGS="-I/home/martijn/Documenten/python-for-android/build/python/Python-2.7.2 -I/home/martijn/Documenten/python-for-android/build/python/Python-2.7.2/Include"
# Custom ARM toolchain
export SYSROOT=$ANDROIDNDK/platforms/android-14/arch-arm
export PATH=/usr/local/gcc-4.8.0-arm-linux-androideabi/bin:$PATH
export CC=arm-linux-androideabi-gcc
export CXX=arm-linux-androideabi-g++
export CROSSHOST=arm-linux-androideabi
export CROSSHOME=/usr/local/gcc-4.8.0-arm-linux-androideabi
# Set ARM v5 architecture with debug flag!
export CFLAGS="-g"
export CXXFLAGS=$CLFAGS
Compiling without the --enable-python-binding flag gives no problem and I correctly get a libtorrent.so file. At the end of the compilation, I get the following error:
creating build/lib.linux-x86_64-2.7
arm-linux-androideabi-g++ arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/martijn/Documenten/android-ndk-r9d/platforms/android-14/arch-arm -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -shared -lm -L/home/martijn/Documenten/python-for-android/build/openssl/openssl-1.0.1g/ -g -fvisibility=hidden build/temp.linux-x86_64-2.7/src/alert.o build/temp.linux-x86_64-2.7/src/error_code.o build/temp.linux-x86_64-2.7/src/module.o build/temp.linux-x86_64-2.7/src/datetime.o build/temp.linux-x86_64-2.7/src/fingerprint.o build/temp.linux-x86_64-2.7/src/entry.o build/temp.linux-x86_64-2.7/src/session.o build/temp.linux-x86_64-2.7/src/torrent_info.o build/temp.linux-x86_64-2.7/src/magnet_uri.o build/temp.linux-x86_64-2.7/src/converters.o build/temp.linux-x86_64-2.7/src/string.o build/temp.linux-x86_64-2.7/src/utility.o build/temp.linux-x86_64-2.7/src/session_settings.o build/temp.linux-x86_64-2.7/src/create_torrent.o build/temp.linux-x86_64-2.7/src/big_number.o build/temp.linux-x86_64-2.7/src/torrent_handle.o build/temp.linux-x86_64-2.7/src/torrent_status.o build/temp.linux-x86_64-2.7/src/version.o build/temp.linux-x86_64-2.7/src/ip_filter.o build/temp.linux-x86_64-2.7/src/peer_info.o -L../../src/.libs -L/usr/local/ssl/lib -L. -ltorrent-rasterbar -lboost_system -lboost_python -lssl -lcrypto -lpython2.7 -o build/lib.linux-x86_64-2.7/libtorrent.so -L/usr/local/gcc-4.8.0-arm-linux-androideabi/lib
arm-linux-androideabi-g++: error: arm-linux-androideabi-gcc: No such file or directory
error: command 'arm-linux-androideabi-g++' failed with exit status 1
I'm not sure what's causing this error. I think have I my arm-linux-androieabi-g++ command setup correctly but maybe there's a setting that I oversee. Anyone here who can help me?

/usr/include/machine/types.h:37:10: fatal error: 'arm/types.h' file not found

I have spent half a day killing the error. I'm really bored and teared.
The project is converting iPhone App to Android apk by Stella SDK.
The IDE is xCode 4.6.
CompileC build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/Objects-normal/x86_64/main.o main.m normal x86_64 objective-c com.yeecco.compilers.android.clang.1.0
cd /Users/anna/samples/GLSprite
setenv LANG en_US.US-ASCII
/opt/StellaSDK/bin/android-clang -x objective-c -arch x86_64 -fmessage-length=0 -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.8 -g -Wno-sign-conversion -I/Users/anna/samples/GLSprite/build-arm-google-android/Debug/include -I/opt/StellaSDK/arm-google-android/usr/include -I/opt/StellaSDK/arm-google-android/System/Library/Frameworks/cocos2d.framework/Headers -I/opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaMedia.framework/Headers -I/opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaStore.framework/Headers -I/Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/DerivedSources/x86_64 -I/Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/DerivedSources -F/Users/anna/samples/GLSprite/build-arm-google-android/Debug -F/opt/StellaSDK/arm-google-android/System/Library/Frameworks -stella_target arm-google-android -D__STELLA_NANDROID -D__STELLA_VERSION_MAX_ALLOWED -MMD -MT dependencies -MF /Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/Objects-normal/x86_64/main.d -c /Users/anna/samples/GLSprite/main.m -o /Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/Objects-normal/x86_64/main.o
warning: unknown warning option '-Wreceiver-is-weak' [-Wunknown-warning-option]
warning: unknown warning option '-Wint-conversion' [-Wunknown-warning-option]
warning: unknown warning option '-Wenum-conversion' [-Wunknown-warning-option]
In file included from /Users/anna/samples/GLSprite/main.m:49:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:17:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaKit.framework/Headers/StellaKit.h:7:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaKit.framework/Headers/SVAcceleration.h:5:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:11:
In file included from /usr/include/sys/types.h:78:
/usr/include/machine/types.h:37:10: fatal error: 'arm/types.h' file not found
#include "arm/types.h"
^
3 warnings and 1 error generated.
Command /opt/StellaSDK/bin/android-clang failed with exit code 1
The error message is shown because the compiler is looking for types.h in arm folder. If you could provide the file, the compiler will not show this error and continue. Check the documentation of StellaSDK, they should have a "guide" on how to cross compile

Use build_libstagefright in ffmpeg to build file .so for android

In order to use ffmpeg in android , I tried to build ffmpeg by using build_libstagefright in
ffmpeg/tools/lib_stagefright
but it alwalys appear a error which i coundn't solve it.
the message in the bottom of ffmpeg/config.log is
arm-linux-androideabi-g++ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I../android-source/frameworks/base/include -I../android-source/system/core/include -I../android-source/frameworks/base/media/libstagefright -I../android-source/frameworks/base/include/media/stagefright/openmax -I/home/user/android-ndk/sources/cxx-stl/gnu-libstdc++/include -I/home/user/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include -march=armv7-a -mfloat-abi=softfp -mfpu=neon -march=armv7-a -std=c99 -fomit-frame-pointer -fPIC -marm -Wno-multichar -fno-exceptions -fno-rtti -D__STDC_CONSTANT_MACROS -c -o /tmp/ffconf.6ZzEMs87.o /tmp/ffconf.5jbfvJxK.cpp
./configure: line 701: /home/user/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++: cannot execute binary file
ERROR: libstagefright_h264 not found
Anyone have the solution of this ??
my Build Environment is
Window 7
Cygwin
android-NDK-r8b linux version
I found a method ,let me cross this error.
In file of ffmpeg/configure
origin :
enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
fixed :
enabled libstagefright && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
When I fix libstagefright_h264 to libstagefright here, it seems be normal until the next error.
CC libavcodec/lagarithrac.o
CC libavcodec/latm_parser.o
CXX libavcodec/libstagefright.o
/bin/sh: /home/user/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux- x86/bin/arm-linux-androideabi-g++: cannot execute binary file
CC libavcodec/lcldec.o
common.mak:51: recipe for target `libavcodec/libstagefright.o' failed
make: *** [libavcodec/libstagefright.o] Error 126
make: *** Waiting for unfinished jobs....
PS: ffmpeg version is 1.0
Take a look at ffmpeg/config.log - there has to be an error description on the last line.
PS. On windows i used MinGW|MSYS to successfully compile ffmpeg

Android ndk-r8 "error trying to exec 'cc1plus': execvp: No such file or directory"

I am trying to use the Android NDK on Mountain Lion to build a library for Android, following this guide
http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/
When it comes time to compile the library, I run:
cd <path to jni>
<ndk>/ndk-build
I get the following error:
Compile++ thumb : echoprint-jni <= AndroidCodegen.cpp
arm-linux-androideabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory
make: *** [/Users/wingdom/Desktop/obj/local/armeabi/objs/echoprint-jni/AndroidCodegen.o] Error 1
I believe I have added everything I need to to my path variable:
export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Developer/android-sdk/tools:/Developer/android-sdk/platform-tools:/Developer/android-ndk:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin
What else do I need to do in order to get this to compile? I am using the r8b NDK currently, but have tried it with versions all the way back to 6.
EDIT:
I tried this solution: Error while building android ndk sample project
adding
export PATH=$PATH:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2
to my path gets me this error:
cc1plus: error: unrecognized command line option "-mbionic"
cc1plus: error: unrecognized command line option "-mthumb"
cc1plus: error: unrecognized command line option "-mfpu=vfp"
/Users/wingdom/Desktop/jni/AndroidCodegen.cpp:1: error: bad value (armv5te) for -march= switch
/Users/wingdom/Desktop/jni/AndroidCodegen.cpp:1: error: bad value (xscale) for -mtune= switch
make: *** [/Users/wingdom/Desktop/obj/local/armeabi/objs/echoprint-jni/AndroidCodegen.o] Error 1
but adding
export CROSS_COMPILER=$PATH:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin
doesn't help, like it did in the link above.
I have experienced same error.
I was not able to execute even 'gcc, g++' command. So I have googled a lot to find solution, but nothing helped for me.
Then, I found that some filename in ndk is not correct, with tailing _ on some filename.. (In my case, in toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/arm-linux-androideabi/bin folder, there are gcc_, g++_, c++_ instead of gcc, g++, c++.)
I used The unarchiver to extract NDK archive, so I think there are something wrong with unarchiving procedure.
So I re-downloaded NDK and checked MD5 checksum, then extracted archive using Mac's default archive utility.
Now, the problem has solved.
Sounds like you have a bad download/unpack of the NDK. The cc1plus binary that it's looking for should be in $NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/libexec/gcc/arm-linux-androideabi/4.4.3/. If it's not there, try re-downloading the SDK and/or unpacking it again.
If it is there, be sure to build passing V=1 to ndk-build, and see if there are any odd -B options passed to the compiler. The -B option tells gcc where to find its "sub-programs" (of which cc1plus is one). Pretty sure there shouldn't be any on the command lines for r8, so if there are, something somewhere is passing bad flags. For example, on my system, a C++ NDK command line ends up looking something like this:
/opt/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi-v7a/objs/sometarget/SomeCppFile.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-exceptions -fno-rtti -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/opt/android-ndk/sources/cxx-stl/stlport/stlport -I/opt/android-ndk/sources/cxx-stl//gabi++/include -DANDROID -Wall -Wa,--noexecstack -frtti -O2 -DNDEBUG -g -I/opt/android-ndk/platforms/android-8/arch-arm/usr/include -c jni/SomeCppFile.cpp -o ./obj/local/armeabi-v7a/objs/sometarget/SomeCppFile.o
Maybe you need to install the g++:
$sudo apt-get install g++
I have spent about a day to find root cause of this
arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file...
and others issues.
The issues were that I unpacked NDK and SDK with 7z which removed executable permission for all binaries and Eclipse was not able to start cc1.
Once I unpacked tar files of SDK and NDK using tar, everything started working well.

Categories

Resources