I'm running into a number of issues attempting to build the GStreamer Android tutorials.
My environment is:
I am able to build and run the NDK samples both in Eclipse and from the command line.
I have downloaded http://cdn.gstreamer.com/android/arm/gstreamer-sdk-android-arm-debug-2012.11.tar.bz2 and added the GSTREAMER_SDK_ROOT_ANDROID environment variable to my .bash_profile.
When I try to build android-tutorial-1 via Eclipse I get the following error:
12:12:05 **** Incremental Build of configuration Default for project Tutorial1 ****
/apps/tools/android-ndk-r8d/ndk-build all
jni/Android.mk:13: *** GSTREAMER_SDK_ROOT_ANDROID is not defined!. Stop.
12:12:05 Build Finished (took 104ms)
I have tried adding GSTREAMER_SDK_ROOT_ANDROID to the C++ build variables in Eclispe but it makes no difference.
When I try to build via the command line I get the following error:
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
gst-build/gstreamer_android.c:2:21: fatal error: gst/gst.h: No such file or directory
compilation terminated.
make: *** [gst-build/gstreamer_android.o] Error 1
What I can't figure out is gst/gst.h can not be resolved?
Here you faced with two problem
Can be easily solved by set GSTREAMER_SDK_ROOT_ANDROID
environment variable (in eclipse or Android.mk
file) in my case I have specified this variable like this
GSTREAMER_VERSION := 1.4.1
GSTREAMER_SDK_ROOT := /Volumes/Data/Developers/Library/gstreamer-1.0-sdk-android/$(TARGET_ARCH_ABI)-$(APP_OPTIM)-$(GSTREAMER_VERSION)
TARGET_ARCH_ABI
- predefined variable (in my case armeabi-v7a
)APP_OPTIM
- predefined variable release
or debug
In your case GSTREAMER_SDK_ROOT
will be different of course but using predefined vars help a lot if you need support multiple archs
pkg-confing
is not in PATH
As you may see by default there is using sh
shell
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
It can't find pkg-config
because initially PATH=/usr/bin:/bin:/usr/sbin:/sbin
. In case when you installed pkg-config
by brew
on OSX it has been placed to /usr/local/bin
bash-3.2$ which pkg-config
/usr/local/bin/pkg-config
To fix PATH
you can specify own shell
SHELL := PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin /bin/bash
This is not perfect solution but it works
Since 2.2.0-alpha3
gradle android plugin support external build systems like this (add it in build.gradle
inside android
definition)
android {
...
externalNativeBuild {
ndkBuild {
path "${projectDir.absolutePath}/src/main/jni/Android.mk"
}
}
}
Don't forget cleanup jni.srcDirs
because bad plugin will start first, to cleanup jni.srcDirs
at runtime add
android {
...
task disableDefaultNdkBuild << {
android.sourceSets.main.jni.srcDirs = []
android.sourceSets.main.jniLibs.srcDir 'src/main/libs'
}
preBuild.dependsOn disableDefaultNdkBuild
}
Official guide now available https://gstreamer.freedesktop.org/documentation/tutorials/android/link-against-gstreamer.html
I posted the above question on the GStreamer Android mailing list and got the following response:
Hi, Unfortunately we forgot to include
pkg-config
in this release for Mac OS X. You can download it from here: http://macpkg.sourceforge.net/
I used homebrew to install pkg-config
and was able to build all of the Android Tutorials via the command line using ndk-build
.
I still have a number of issues in Eclipse:
GSTREAMER_SDK_ROOT_ANDROID
is not defined! - I can not get Eclipse to pick up this variable/bin/sh: pkg-config: command not found
- pkg-config is installed and working via the CLII believe some of the issues are related to Android Issue 33788 and I have attempted to resolve them using CDT 8.0.2 instead of CDT 8.10 but it did not solve either of the above issues.
I have worked around the problem for now by doing the following:
for error1: jni/Android.mk:13: * GSTREAMER_SDK_ROOT_ANDROID is not defined!. Stop.
you can defind GSTREAMER_SDK_ROOT_ANDROID := XXXXX(your Gstreamer_Android_SDK Path) in your Android.mk files!
for error2: fatal error: gst/gst.h: No such file or directory
you can include the (Gstreamer_Android_SDK Path)/include/gstreamer0.10/ in the C/C++ General -> Paths and Symbols -> inlude!
Hope that would help:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With