【问题标题】:gst-omx plugin build error: size of array ‘_GStaticAssertCompileTimeAssertion_1’ is negativegst-omx 插件构建错误:数组“_GStaticAssertCompileTimeAssertion_1”的大小为负
【发布时间】:2017-04-12 08:01:49
【问题描述】:

我的构建环境:

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 构建文件夹中的 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知道toolchain在哪里? 谢谢大家~

【问题讨论】:

    标签: gstreamer glib


    【解决方案1】:

    我自己解决了这个问题。

    没错,是工具链的问题,但是{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
    

    其次,我将新的交叉工具路径添加到 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
    

    最终会在/home/leon/tools/cerbero/omx中生成gst-omx插件文件

    【讨论】:

    猜你喜欢
    • 2013-06-18
    • 2016-02-18
    • 2016-09-14
    • 1970-01-01
    • 2018-04-01
    • 2020-07-22
    • 1970-01-01
    • 2013-03-07
    • 1970-01-01
    相关资源
    最近更新 更多