gst-omx插件构建错误:数组'_GStaticAssertCompileTimeAssertion_1'的大小为负

时间:2017-04-12 08:01:49

标签: gstreamer glib

我的构建环境:

gst-omx Version: Tag 1.11.2
OS Description: Ubuntu 16.04.2 LTS 64bit
Cerbero version: Tag 1.11.2

在构建gst-omx之前,我已经成功构建了gstreamer sdk 1.0 for tag 1.11.2 with target android_arm

gst-omx构建命令:

$./autogen.sh --host=arm-linux-androideabi --disable-gtk-doc --with-omx-target=generic --enable-static --prefix=/home/leon/tools/cerbero/omx --enable-static-plugins --disable-fatal-warnings
$make

然后我收到错误消息:

gstomxbufferpool.c: In function ‘gst_omx_memory_allocator_get_type’:
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/glib/gmacros.h:232:53: error: size of array ‘_GStaticAssertCompileTimeAssertion_1’ is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                                     ^
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/glib/gmacros.h:229:47: note: in definition of macro ‘G_PASTE_ARGS’
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
                                               ^
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/glib/gmacros.h:232:44: note: in expansion of macro ‘G_PASTE’
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                            ^
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/glib/gthread.h:249:5: note: in expansion of macro ‘G_STATIC_ASSERT’
     G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));       \
     ^
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/gobject/gtype.h:1961:7: note: in expansion of macro ‘g_once_init_enter’
   if (g_once_init_enter (&g_define_type_id__volatile))  \
       ^
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/gobject/gtype.h:1732:60: note: in expansion of macro ‘_G_DEFINE_TYPE_EXTENDED_BEGIN’
#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)     _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
                                                            ^
/home/leon/tools/cerbero/build/dist/android_arm/include/glib-2.0/gobject/gtype.h:1590:43: note: in expansion of macro ‘G_DEFINE_TYPE_EXTENDED’
#define G_DEFINE_TYPE(TN, t_n, T_P)       G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
                                           ^
gstomxbufferpool.c:97:1: note: in expansion of macro ‘G_DEFINE_TYPE’
G_DEFINE_TYPE (GstOMXMemoryAllocator, gst_omx_memory_allocator,
^

此问题可能位于此问题上 G_STATIC_ASSERT (sizeof *(location) == sizeof (gpointer));

我检查了cerbero build文件夹中的glib库,' location'反映到&g_define_type_id_volatile

原始定义为static volatile gsize g_define_type_id_volatile = 0;,类型定义为:

gtypes.h(77):  typedef void* gpointer;
glibconfig.h(60): typedef unsigned int gsize;

但我不知道发生了什么,以及如何避免这个问题。 有人能帮帮我吗?非常感谢!

4月14日更新:

我认为这可能是由于未能识别正确的工具链,因为配置显示:

./configure --enable-maintainer-mode --enable-gtk-doc --host=arm-linux-androideabi --disable-gtk-doc --with-omx-target=generic --enable-static --prefix=/home/leon/tools/cerbero/omx --enable-static-plugins --disable-fatal-warnings PKG_CONFIG_PATH=/home/leon/tools/cerbero/build/dist/android_arm/lib/pkgconfig
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking nano version... 0 (release)
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for arm-linux-androideabi-gcc... no   <-------
checking for gcc... gcc                        <-------
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep

从箭头标记的位置,我怀疑NDK工具链无法识别。所以它使用原生的64位gcc编译器作为替换,并且这些类型的sizeof无法匹配。

我的结论是否正确?

如果它是对的,如何让gst-omx知道工具链在哪里? 感谢大家〜

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题。

没错,这是工具链的问题,但{ndkroot} / toolchains中的工具链不能直接使用,否则会出现各种编译错误。

首先,我使用ndk:

提供的工具制作自己的工具链
cd ~/tools/android-ndk-r13b/build/tools/
./make-standalone-toolchain.sh --platform=android-21 --install-dir=/home/leon/tools/android-toolchain --toolchain=arm-linux-androideabi-4.9

其次,我将新的crosstool路径添加到env,以使configure能够找到它:

export PATH=/home/leon/tools/android-toolchain/bin:$PATH

最后修改配置参数:

./autogen.sh --host=arm-linux-androideabi --disable-gtk-doc --with-omx-target=generic --enable-static --prefix=/home/leon/tools/cerbero/omx --enable-static-plugins --disable-fatal-warnings PKG_CONFIG_PATH=/home/leon/tools/cerbero/build/dist/android_arm/lib/pkgconfig --with-sysroot=/home/leon/tools/android-toolchain/sysroot
make & make install

最终,gst-omx插件文件将在/home/leon/tools/cerbero/omx

中生成