Apalis TK1 GStreamer error build

I want to make program, that grabs video from CSI camera module with gstreamer library. I try examples from official site (GStreamer). I have a compiling error, there’s no file “glib.h”. What it can be? Are there some examples of code for TK1 to grab video?

11:26:58 **** Incremental Build of configuration Release for project example_csi ****
make all 
Building file: ../src/example_csi.c
Invoking: Cross GCC Compiler
arm-angstrom-linux-gnueabi-gcc  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types  -c -MMD -MP -MF"src/example_csi.d" -MT"src/example_csi.o" -o "src/example_csi.o" "../src/example_csi.c"
In file included from ../src/example_csi.c:16:0:
/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/glib-2.0/glib.h:30:10: fatal error: glib/galloca.h: No such file or directory
 #include <glib/galloca.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [src/subdir.mk:20: src/example_csi.o] Ошибка 1

11:27:23 Build Failed. 2 errors, 0 warnings. (took 25s.33ms)

Source code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include <glib-2.0/glib.h>
#include <gstreamer-0.10/gst/gst.h>

d

int main(int   argc,
	      char *argv[]) {
	const gchar *nano_str;
	  guint major, minor, micro, nano;
	  gst_init (&argc, &argv);

	  gst_version (&major, &minor, &micro, &nano);

	  if (nano == 1)
	    nano_str = "(CVS)";
	  else if (nano == 2)
	    nano_str = "(Prerelease)";
	  else
	    nano_str = "";

	  printf ("This program is linked against GStreamer %d.%d.%d %s\n",
	          major, minor, micro, nano_str);

	  return 0;
}

What exact toolchain/SDK are you using?

angstrom-glibc-x86_64-armv7at2hf-neon-v2017.12-toolchain.sh

Where you got this toolchain? Could you provide a link?

https://developer1.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/SDKs/2.8/apalis-tk1/angstrom-lxde-image/angstrom-glibc-x86_64-armv7at2hf-neon-v2017.12-toolchain.sh
from Getting Started Guide

I’ve tried to include gstreamer from my host system to project, configurated for cross compile, it give following error:

/usr/include/glib-2.0/glib/gtypes.h: In function ‘_GLIB_CHECKED_ADD_U64’:
/usr/include/glib-2.0/glib/gtypes.h:423:3: error: size of array ‘_GStaticAssertCompileTimeAssertion_0’ is negative
   G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));

As i understand, gstreamer is platform-specific, and i can’t take from another place, except from the sdk, provided by toradex?

You are right. You need to use the gstreamer version for arm. Could you look for the file glib.h in the SDK folder? If it is not there, then you will need to create a custom SDK file for you.

I found only in this folder:

/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi/usr/include/glib-2.0/glib.h

Threre’s no “glib.h” in:

/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/

Is there manual how to create sdk?

Hi

The error which gets reported complains about the missing glib/galloca.h file.
This can be fixed by adding the required include paths for the glib-2.0 package.

One way to do this is to by using pkg-config output, e.g. adding the following to your compiler call, note the back-ticks which first execute the program and then inserts the program output into the compiler cmdline:

`pkg-config --cflags glib-2.0`

So that the above cmdline becomes:

arm-angstrom-linux-gnueabi-gcc  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types `pkg-config --cflags glib-2.0` -c -MMD -MP -MF"src/example_csi.d" -MT"src/example_csi.o" -o "src/example_csi.o" "../src/example_csi.c"

Likely you need additonally add to the linker flags a similar call:

`pkg-config --libs glib-2.0`

While trying this out I found that the gstreamer 0.10 header files are actually missing in the released SDK, so you get an error at '#include '. I’m still working on why this happened and how to work around it.

Max

Hi

My bad. I did mix up paths and checked for gstreamer 0.10 in a SDK for an i.MX device which does not have them.

With the right sysroot path for apalis-tk1 in my installation and by adding gstreamer-0.10 to pkg-config it compiles and then links for me.

arm-angstrom-linux-gnueabi-gcc  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types `pkg-config --cflags glib-2.0 gstreamer-0.10` -c -MMD -MP -MF"src/example_csi.d" -MT"src/example_csi.o" -o "src/example_csi.o" "../src/example_csi.c"

arm-angstrom-linux-gnueabi-gcc  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types `pkg-config --libs glib-2.0 gstreamer-0.10` -o src/example_csi src/example_csi.o

file src/example_csi  
   src/example_csi: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.1.10, BuildID[sha1]=22e48f567e5abb1307e76cce6ecf1f33ec166faa, with debug_info, not stripped

Max