Reputation: 1
I am trying to build the GStreamer tutorial example 5 on Android Studio using Mac OS X v10.8.5 (Mountain Lion).
I have downloaded the tutorial from GStreamer 1.0 example "tutorial 5" for Android Studio with Gradle
I have downloaded the NDK "android-ndk-r11c" from
I have downloaded the GStreamer Android library gstreamer-1.0-android-arm-1.8.0 from https://gstreamer.freedesktop.org/data/pkg/android/1.8.0/
I have edited local.properties - set SDK and NDK paths
I have edited the src/main/jni/Android.mk file and set GSTREAMER_ROOT_ANDROID to the path where I extracted the GStreamer library
I have created a gradle.properties file in order to set the flag android.useDeprecatedNdk=true
I have added:
sourceSets.main { jni.srcDirs = [] }
under Android in order not to let Android Studio override the .mk file
The Gradle console is showing several of:
/bin/bash: i: command not found
make: [genstatic_armeabi] Error 127 (ignored)
Here below is the complete console log:
bin/bash: - : invalid option
Usage: /bin/bash [GNU long option] [option] ...
/bin/bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
/bin/bash: - : invalid option
Usage: /bin/bash [GNU long option] [option] ...
/bin/bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
--wordexp
......
GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
/bin/bash: i: command not found
make: [genstatic_armeabi] Error 127 (ignored)
/bin/bash: i: command not found
make: [genstatic_armeabi] Error 127 (ignored)
/bin/bash: i: command not found
make: [genstatic_armeabi] Error 127 (ignored)
/bin/bash: i: command not found
make: [genstatic_armeabi] Error 127 (ignored)
GStreamer : [COMPILE] => gst-build-armeabi/gstreamer_android.c
gst-build-armeabi/gstreamer_android.c:17:2: error: stray '@' in program
@PLUGINS_DECLARATION@
^
gst-build-armeabi/gstreamer_android.c:17:22: error: stray '@' in program
@PLUGINS_DECLARATION@
^
gst-build-armeabi/gstreamer_android.c:20:2: error: stray '@' in program
@G_IO_MODULES_DECLARE@
^
gst-build-armeabi/gstreamer_android.c:17:3: error: unknown type name 'PLUGINS_DECLARATION'
@PLUGINS_DECLARATION@
^
gst-build-armeabi/gstreamer_android.c:20:23: error: stray '@' in program
@G_IO_MODULES_DECLARE@
^
gst-build-armeabi/gstreamer_android.c:23:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
void
^
gst-build-armeabi/gstreamer_android.c:26:2: error: stray '@' in program
@PLUGINS_REGISTRATION@
^
gst-build-armeabi/gstreamer_android.c:26:23: error: stray '@' in program
@PLUGINS_REGISTRATION@
^
gst-build-armeabi/gstreamer_android.c: In function 'gst_android_load_gio_modules':
gst-build-armeabi/gstreamer_android.c:33:2: error: stray '@' in program
@G_IO_MODULES_LOAD@
^
gst-build-armeabi/gstreamer_android.c:33:20: error: stray '@' in program
@G_IO_MODULES_LOAD@
^
gst-build-armeabi/gstreamer_android.c:33:3: error: 'G_IO_MODULES_LOAD' undeclared (first use in this function)
@G_IO_MODULES_LOAD@
^
gst-build-armeabi/gstreamer_android.c:33:3: note: each undeclared identifier is reported only once for each function it appears in
gst-build-armeabi/gstreamer_android.c:34:1: error: expected ';' before '}' token
}
^
gst-build-armeabi/gstreamer_android.c: In function 'gst_android_init':
gst-build-armeabi/gstreamer_android.c:497:3: error: implicit declaration of function 'gst_android_register_static_plugins' [-Werror=implicit-function-declaration]
gst_android_register_static_plugins ();
^
cc1: all warnings being treated as errors
make: *** [gst-build-armeabi/gstreamer_android.o] Error 1
:app:ndkBuild FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:ndkBuild'.
> Process 'command '/Users/vincenzodigiovambattista/AndroidStudioProjects/android-ndk-r11c/ndk-build'' finished with non-zero exit value 2
Any suggestion?
I know that building GStreamer for Android Studio is painful, checking around there is not a complete guide for such a purpose and I would like to use this post to create one!
Upvotes: 0
Views: 886
Reputation: 1667
HOST_SED is only defined on the Windows platform (see the beginning of the excerpt of gstreamer-1.0.mk below).
We need to define HOST_SED as needed.
# Host tools
ifeq ($(HOST_OS),windows)
HOST_SED := $(GSTREAMER_NDK_BUILD_PATH)/tools/windows/sed
GSTREAMER_LD :=
else
HOST_SED := sed //linux
endif
....
@$(HOST_ECHO) "GStreamer : [GEN] => $(PRIV_C)"
@$(call host-mkdir,$(PRIV_B_DIR))
@$(call host-cp,$(PRIV_C_IN),$(PRIV_C))
@$(HOST_SED) -i "s/@PLUGINS_DECLARATION@/$(PRIV_P_D)/g" $(PRIV_C)
@$(HOST_SED) -i "s/@PLUGINS_REGISTRATION@/$(PRIV_P_R)/g" $(PRIV_C)
@$(HOST_SED) -i "s/@G_IO_MODULES_LOAD@/$(PRIV_G_L)/g" $(PRIV_C)
@$(HOST_SED) -i "s/@G_IO_MODULES_DECLARE@/$(PRIV_G_R)/g" $(PRIV_C)
Upvotes: -1
Reputation: 36
First, on GStreamer 1.8 Release Notes, under known issues, you can see that building with NDK r11 is not possible. Use NDK r10 instead.
If you get the same error, go to the share/gst-android/ndk-build folder in the GStreamer package and look at gstreamer-1.0.mk file. Search for genstatic_$(TARGET_ARCH_ABI). There you will see the definition of that command and can inspect if there is anything wrong with it.
With this error, Bash basically tells you that it encountered an unknown command "i" when executing the genstatic_armeabi command.
Upvotes: 1