GST-OMX插件生成错误:数组 '_GStaticAssertCompileTimeAssertion_1' 的大小为负

问题描述:

我的构建ENV:GST-OMX插件生成错误:数组 '_GStaticAssertCompileTimeAssertion_1' 的大小为负

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标签1.11.2与目标android_arm

GST-OMX build命令:

$./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库, '位置' 反映了&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编译器作为替代,这些类型的大小不能匹配。

我的结论是否正确?

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

我自己解决了这个问题。

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

首先,我做我自己的工具链与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,使配置找到它:

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

+0

顺便说一句,感谢主题[用android编译](http://stackoverflow.com/questions/14307611/problems-compiling-object-using-arm-linux-androideabi-gcc),它帮助我。 – leon