I am trying to build pjsip project with openh264 lib. Everything works fine except openh264 is not being detected by pjsip ./configure-android
this is my config_site.h
/* Activate Android specific settings in the 'config_site_sample.h' */
#define PJ_CONFIG_ANDROID 1
#include <pj/config_site_sample.h>
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_HAS_OPENH264_CODEC 1
I am getting following log
Using OpenH264 prefix... /home/user_name/PJSIPTOOLS/openh264-1.0.0/openlib/
checking OpenH264 usability... no
As it is not detected by ./configure-android my app is crashing at runtime saying lib not found for openh264.
I am on ubuntu 14.04 32 bit.
Any suggestions.
I just encountered a similar issue. In the following, I refer to the directory, I downloaded and extracted OpenH264 to, as path-to-openh264. I created a subdirectory android within that folder and modified OpenH264's Makefile by setting PREFIX=android. Afterwards running the following commands to build OpenH264 solved the issue for me:
make OS=android NDKROOT=<path-to-ndk> TARGET=android-14 APP_ABI=armeabi ARCH=arm
make OS=android NDKROOT=<path-to-ndk> TARGET=android-14 APP_ABI=armeabi ARCH=arm clean
make install OS=android NDKROOT=<path-to-ndk> TARGET=android-14 APP_ABI=armeabi ARCH=arm
The resulting libopenh264.so file should end up in the directory path-to-openh264/android/lib/. In order to configure pjsip I used the following command:
APP_PLATFORM=android-14 ./configure-android --with-openh264=<path-to-openh264>/android
The following StackOverflow thread lead me to the right direction:
building openh264 for android platform in x86
The reason for this issue was, that I ran the make install command without the command line parameters at first. This caused the native library file to be created for the wrong ABI (the default one, which is armeabi-v7a). When building pjsip for the armeabi ABI, it didn't recognize the library, because it was built for a different ABI. At least this is what I suppose.
Actually i faced that problem too.
Solution:
step 1:go to your openh264 directory and create a folder named "android"
step 2: open makefile and set prefix
PREFIX=/your_path/openh264-1.0.0/android
step3:then build openh264 using this command
make OS=android NDKROOT=/your_path/android-ndk-r10d TARGET=android-17 APP_ABI=armeabi
step4: now build pjsip using this command
TARGET_ABI=armeabi APP_PLATFORM=android-12 ./configure-android --use-ndk-cflags --with-openh264=/your_path/openh264-1.0.0/android
hope this time you will see
Using OpenH264 prefix...
/home/user_name/PJSIPTOOLS/openh264-1.0.0/openlib/
checking OpenH264 usability... ok
http://trac.pjsip.org/repos/ticket/1758
modify the "prefix" in Makefile
run "make install ARCH=armeabi"
run "./configure-android --with_openh264=/path/to/prefix/folder"
Related
I'm trying to build PJSIP with FFMPEG for Android.
For building FFMPEG with rtmp and openssl, I use this project:
https://github.com/cine-io/android-ffmpeg-with-rtmp
and it compiles pretty well.
Then I'm compiling pjsip 2.6 with ffmpeg. Here is the part from my build file:
APP_PLATFORM=android-${TARGET_ANDROID_API} NDK_TOOLCHAIN_VERSION=4.9 TARGET_ABI=$arch ./configure-android --use-ndk-cflags \
--with-ssl="${OPENSSL_BUILD_OUT_PATH}/libs/${arch}" \
--with-ffmpeg="${BASE_DIR}/ffmpeg-output"
>>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1
My target ABI is armeabi.
Also, i've defined these two flags:
#define PJMEDIA_HAS_VIDEO 1
#define PJMEDIA_HAS_FFMPEG 1
But the build failed with a bunch of these two errors:
error: cannot find -lbz2
error: cannot find -lasound
A have libasound2-dev and bzip2 installed on my Ubuntu 16.04 LTS VM.
Before that, I've successfully made pjsip builds with OpenH264 with no errors like this.
Is there any way to tell linker(or whatever it is) how to find those packages?
Solve that problem (thx #NandhaKumar) by compiling .a libs for each library above and adding them to pjsip library path:
Build .a libs.
Copy libs to {PJPROJECT}/third_party/lib/ folder.
Go to the build.mak.in file in your PJSIP project folder.
Add the following lines:
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libbz2.a
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libasound.a
In my case (and I still don't know why) second line and defining another line
(APP_THIRD_PARTY_LIBS += -lsound or APP_THIRD_PARTY_LIBS += -lasound) doesn't help, so I just copied this library into the android_ndk folder:
android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/libasound.a
I'm trying to build pjsip for android with NDK r13b.
Standard build like ./configure-android --with-opus=/home/user/pjsip/pjproject/opus-dev-lib works perfect. But i need several TARGET_ABI and all my tries to do it ends with configure-android error: compiler not found, please check environment settings (TARGET_ABI, etc)
Commands as
TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags --with-opus=/home/user/pjsip/pjproject/opus-dev-lib
TARGET_ABI=armeabi-v7a APP_PLATFORM=android-21 ./configure-android --use-ndk-cflags --with-opus=/home/user/pjsip/pjproject/opus-dev-lib
return the same error.
I'm search a lot of links but no result.
I know that error is in configure-android file and throwing by
if test "x${CC}" = "x" || test ! -e ${CC}; then
echo "$F error: compiler not found, please check environment
settings (TARGET_ABI, etc)"
exit 1
fi
But i have no idea how to solve it.
Thanks in advance.
So, i'm finished with build.
Using Alex Gotev build and modify config.conf, prepare-build-system and build for needed configuration and latest pjsip source.
Also i had to use latest libyuv from googlesource and NDK r10e.
UPDATED
Using android-ndk-r13 or later use NDK_TOOLCHAIN_VERSION=4.9 TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags. At the moment it's able to build pjsip 2.6
I am currently trying to debug native code in Android via ndk-gdb but I am having some troubles.
Even if I start a very simple project (let's say for example a default cocos2d-x v3 project) and run
ndk-build NDK_DEBUG=1
I end up with the following folder structure inside my android project
...
libs/
armeabi/
libcocos2dcpp.so
...
instead of the expected:
...
libs/
armeabi/
gdb.setup
gdbserver
libcocos2dcpp.so
...
In order to use ndk-gdb I need those two gdb files.
I am using cocos version 3.2 and Android NDK version r9d.
Isn't NDK_DEBUG=1enough for the gdb files to be generated? I have also tried withandroid:debuggable="true" inside my manifest file but it didn't work.
Edit
After running the command suggested by Digit I found a very suspicious line
Android NDK: Application 'local' forced *not* debuggable through NDK_DEBUG
when running the command ndk-build NDK_LOG=1 NDK_DEBUG=1
BUT
if I change to ndk-build NDK_LOG=1 NDK_DEBUG=true I get
Android NDK: Application 'local' forced debuggable through NDK_DEBUG
So it is ok now, really weird though how =1 is not considered true.
Can you paste the output of 'ndk-build NDK_LOG=1 NDK_DEBUG=1', this should contain more information about what ndk-build is doing, and is likely to provide an explanation.
I'm trying to build PJSIP on Android with SSL/TLS support.
I successfully built OpenSSL following this answer (without fips, as shared-.so libraries) and installed it in ~/android (which created the ~/android/ssl directory).
Now, when i do
./configure-android --with-ssl=/home/andrea/android/ssl
and look at the config.log, the first error states
<ndk-directories-and-stuff>/arm-linux-androideabi/bin/ld: warning: libdl.so, needed by /home/andrea/android/ssl/lib/libcrypto.so, not found (try using -rpath or -rpath-link)
a lot of undefined references follow.
As consequence SSL support is disabled:
aconfigure:7012: result: ** OpenSSL libraries not found, disabling SSL support **
ac_cv_header_openssl_ssl_h=yes
ac_cv_lib_ssl_SSL_library_init=no
CFLAGS=' -I/home/andrea/android/android-ndk-r8e/platforms/android-14/arch-arm/usr/include -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -I/home/andrea/android/ssl/include'
LDFLAGS=' -nostdlib -L/home/andrea/android/android-ndk-r8e/platforms/android-14/arch-arm/usr/lib/ -L/home/andrea/android/ssl/lib'
ac_no_ssl=''
libssl_present=''
openssl_h_present='1'
but libdl.so exists in the ndk's directory:
<ndk-dir>/platforms/android-14/arch-arm/usr/lib/
I guess I have to tell ld where the other libraries are,
what does ld's suggestion mean?
try using -rpath or -rpath-link
I can't understand what -rpath or rpath-link are or where to apply them .
any ideas?
I successfully built PJSIP with OpenSSL. please follow the following steps:
First download openssl-android and compile it by reading ReadMe File. (Put your android-ndk to PATH and execute command ndk-build in openssl-android root) then just copy libcrypto.so and libssl.so from libs/armeabi/ folder to lib/ folder in root of openssl-android (you can create this folder). your directory structure now should be like:
openssl-android/
->apps
->crypto
->include
->jni
->lib
->libs
->...
now just execute in root directory of pjsip:
./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir
for confirmation that openssl is included just pipe this command to grep like:
./configure-android --with-ssl=/home/your-user-name/path-to-openssl-android-dir | grep -wi ssl
then you will see this line result: OpenSSL library found, SSL support enabled. This means, OpenSSL is now enabled for your PJSIP. Now you can continue normal.
hope this helps.
I am working on an android project that requires the cryptographic libraries that are present in the application to be FIPS certified. To my knowledge there are no FIPS validated JAVA security libraries. Boucy Castle is good but its not validated. After reading some forum posts, I found out that OpenSSL's FIPS module can be used with the help of NDK.
Right now I am trying to build the fips-openssl module for Android, to do that I have created a script for the environment variables for cross compiling.
I am using openssl-fips, and ndk-r8 for this project. I followed the fips guideline I found on google. I hope this gives a clear picture of what I am trying to do.
#! /bin/sh
export ANDROID_NDK="~/Android/android-ndk-r8"
export FIPS_SIG="${ANDROID_NDK}/incore"
export GCC_C1="/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/"
export PATH=$PATH:"${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin";
export MACHINE=armv71
export ARCH=arm.
export CROSS_COMPILE="arm-linux-androideabi-"
export SYSTEM=android
#export RELEASE=2.6.32.GMU
export ANDROID_DEV="$ANDROID_NDK/platforms/android-14/arch-arm/usr"
export HOSTCC=/usr/bin/gcc
when doing the make this is the error that i get.
arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
make[1]: *** [cryptlib.o] Error 1
make[1]: Leaving directory `/home/abhiram/fips/openssl-fips-1.2.3/crypto'
make: *** [build_crypto] Error 1
When i do a "find", the cc1 executable is present in this specific directory.
find . -name cc1
./toolchains/mipsel-linux-android-4.4.3/prebuilt/linux-x86/libexec/gcc/mipsel-linux-android/4.4.3/cc1
./toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/libexec/gcc/arm-linux-androideabi/4.4.3/cc1
./toolchains/x86-4.4.3/prebuilt/linux-x86/libexec/gcc/i686-android-linux/4.4.3/cc1
Looks like the problem is in the export statement, there is a blank space where a dash should be in the PATH line. Change this:
export PATH=$PATH:"${ANDROID_NDK}/toolchains/arm-linux-androideabi 4.4.3/prebuilt/linux-x86/bin";
to this:
export PATH=$PATH:"${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin";
Also, your find shows that the cc1 executable is not in the path, so add its location to the path export as well:
export PATH=$PATH:"${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin":"${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/libexec/gcc/arm-linux-androideabi/4.4.3/";
Right now I am trying to build the fips-openssl module for Android, to do that I have created a script for the environment variables for cross compiling.
OpenSSL provides a script for Android, if you are interested. You can find it on the OpenSSL wiki: FIPS Library and Android.
when doing the make this is the error that i get:
arm-linux-androideabi-gcc: error trying to exec 'cc1'
It looks like your PATH does not include the cross-compile toolchain.
How are you invoking the script? You need to include a leading dot (".") to ensure the changes are applied to the current shell (and not the sub-shell that executes the script (which simply exits)).
Here' the first step of OpenSSL's build procedures for Android located at FIPS Library and Android. Notice the leading dot:
$ . .setenv-android.sh
The results of running the script set a bunch of variables used by the OpenSSL build system:
$ . ./setenv-android.sh
ANDROID_NDK_ROOT: /opt/android-ndk-r9
ANDROID_EABI: arm-linux-androideabi-4.6
ANDROID_API: android-14
ANDROID_SYSROOT: /opt/android-ndk-r9/platforms/android-14/arch-arm
ANDROID_TOOLCHAIN: /opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin
FIPS_SIG:
CROSS_COMPILE: arm-linux-androideabi-
ANDROID_DEV: /opt/android-ndk-r9/platforms/android-14/arch-arm/usr
"${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/libexec/gcc/arm-linux-androideabi/4.4.3/"
I don't believe this is needed.
export ANDROID_NDK="~/Android/android-ndk-r8"
According to the folks on the Android NDK user list, you should set both ANDROID_NDK_ROOT and ANDROID_SDK_ROOT. The various NDK and SDK tools use those environmental variables. I suppose the SDK value would be "~/Android/android-sdk" for your installation.
See Recommended NDK Directory? for details.
I also think you should be using ANDROID_SYSROOT. Its not used by the NDK or SDK tools; rather, its used by OpenSSL and passed as sysroot during compile.