Skip to contentSkip to conversation

gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

PATCH New Peter Seiderer 4 participants 9 messages Feb 25, 2014 – Oct 6, 2014

lore
Share & tools
lore
#0 lore raw

cover gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

The freescale specific gst-fsl-plugins-3.0.1/src/misc/v4l_source/src/mfw_gst_v4lsrc.c compile depends on the VIDIOC_DBG_G_CHIP_IDENT ioctl (which was removed from linux kernel in version 3.11). This breaks compile with toolchains based on actual linux kernel headers (e.g. buildroot/glibc toolchain).

Which is the right way to fix this problem?

- fix include precedence from sysroot to custom linux kernel headers as done in the following patch (latest freescale custom kernel is 3.10 based)

- add comment/hint in package description about this dependency

- and/or add dependency (or check) for sysroot linux kernel headers version <= 3.10.x (any hint how to do this?)

Peter Seiderer (1):
gst-fsl-plugins: fix compile for sysroot based on newer linux kernel
headers

 package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/1 gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

The v4l2 ioctl VIDIOC_DBG_G_CHIP_IDENT was removed in linux-3.11 (see [1]/[2]).

To avoid build failure of the gst-fsl-plugins/mfw_gst_v4lsrc with toolchains based on newer linux kernel headers this patch gives the include of the custom linux kernel headers precedence over the sysroot linux kernel headers (oposed to the previous behavior).

Fixes the following compile error with buildroot/glibc toolchain:

mfw_gst_v4lsrc.c: In function 'mfw_gst_v4lsrc_capture_setup':
mfw_gst_v4lsrc.c:452:10: error: variable 'chip' has initializer but incomplete type

   struct v4l2_dbg_chip_ident chip = {0};
          ^
mfw_gst_v4lsrc.c:452:10: warning: excess elements in struct initializer [enabled by default]
mfw_gst_v4lsrc.c:452:10: warning: (near initialization for 'chip') [enabled by default]
mfw_gst_v4lsrc.c:452:30: error: storage size of 'chip' isn't known
   struct v4l2_dbg_chip_ident chip = {0};
                              ^
mfw_gst_v4lsrc.c:464:22: error: 'VIDIOC_DBG_G_CHIP_IDENT' undeclared (first use in this function)
   if (ioctl (fd_v4l, VIDIOC_DBG_G_CHIP_IDENT, &chip)) {
                      ^

[1] http://www.spinics.net/lists/linux-media/msg64081.html
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/videodev2.h?id=b71c99801e18eb172ae34851daf25044a3bf644a

---
 package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk +1 -1
index ccdb521..610bd78 100644
@@ -23,7 +23,7 @@ GST_FSL_PLUGINS_CONF_ENV = PLATFORM=$(BR2_PACKAGE_GST_FSL_PLUGINS_PLATFORM)
 
 # needs access to imx-specific kernel headers
 GST_FSL_PLUGINS_DEPENDENCIES += linux
-GST_FSL_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -idirafter $(LINUX_DIR)/include"
+GST_FSL_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -I$(LINUX_DIR)/include"
 
 ifeq ($(BR2_PACKAGE_XLIB_LIBX11),y)
 GST_FSL_PLUGINS_DEPENDENCIES += xlib_libX11
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 1/1 gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

Arnout,

Since you originally added the package with -idirafter, can you comment on the below patch? To me it makes sense that if the package needs special kernel headers, it should use first the headers from the kernel and then only the sysroot headers. Am I missing something that lead you to the usage of -idirafter?

See the patch below.

Thanks!

Thomas

Quoted 43 lines · Peter Seiderer

The v4l2 ioctl VIDIOC_DBG_G_CHIP_IDENT was removed in linux-3.11 (see [1]/[2]).

To avoid build failure of the gst-fsl-plugins/mfw_gst_v4lsrc with toolchains based on newer linux kernel headers this patch gives the include of the custom linux kernel headers precedence over the sysroot linux kernel headers (oposed to the previous behavior).

Fixes the following compile error with buildroot/glibc toolchain:

mfw_gst_v4lsrc.c: In function 'mfw_gst_v4lsrc_capture_setup':
mfw_gst_v4lsrc.c:452:10: error: variable 'chip' has initializer but incomplete type

   struct v4l2_dbg_chip_ident chip = {0};
          ^
mfw_gst_v4lsrc.c:452:10: warning: excess elements in struct initializer [enabled by default]
mfw_gst_v4lsrc.c:452:10: warning: (near initialization for 'chip') [enabled by default]
mfw_gst_v4lsrc.c:452:30: error: storage size of 'chip' isn't known
   struct v4l2_dbg_chip_ident chip = {0};
                              ^
mfw_gst_v4lsrc.c:464:22: error: 'VIDIOC_DBG_G_CHIP_IDENT' undeclared (first use in this function)
   if (ioctl (fd_v4l, VIDIOC_DBG_G_CHIP_IDENT, &chip)) {
                      ^

[1] http://www.spinics.net/lists/linux-media/msg64081.html
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/videodev2.h?id=b71c99801e18eb172ae34851daf25044a3bf644a

---
 package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk +1 -1
index ccdb521..610bd78 100644
@@ -23,7 +23,7 @@ GST_FSL_PLUGINS_CONF_ENV = PLATFORM=$(BR2_PACKAGE_GST_FSL_PLUGINS_PLATFORM)
 
 # needs access to imx-specific kernel headers
 GST_FSL_PLUGINS_DEPENDENCIES += linux
-GST_FSL_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -idirafter $(LINUX_DIR)/include"
+GST_FSL_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -I$(LINUX_DIR)/include"
 
 ifeq ($(BR2_PACKAGE_XLIB_LIBX11),y)
 GST_FSL_PLUGINS_DEPENDENCIES += xlib_libX11
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

Quoted 7 lines · Thomas Petazzoni

Arnout,

Since you originally added the package with -idirafter, can you comment on the below patch? To me it makes sense that if the package needs special kernel headers, it should use first the headers from the kernel and then only the sysroot headers. Am I missing something that lead you to the usage of -idirafter?

Ow yes good that you remind me...

The problem is that the kernel headers in /usr/include/linux are not the
same as the ones in $(LINUX_DIR)/include/linux: headers_install does some fixups on them. Also, $(LINUX_DIR)/include/net is completely different from /usr/include/net. So putting $(LINUX_DIR)/include in front of the system dirs is a bad idea. As in, it didn't work for me :-)

Maybe a generic solution for packages that require specific kernel
headers is to include a headers_install in the kernel's build?

Anyway, for this one, if it works with -I with all our external
toolchains and with an internal uClibc and glibc toolchain, then I guess it's OK. Perhaps something got fixed in the gst-fsl-plugins bump.

Regards,
Arnout

Quoted 54 lines

See the patch below.

Thanks!

Thomas

Quoted 43 lines · Peter Seiderer

The v4l2 ioctl VIDIOC_DBG_G_CHIP_IDENT was removed in linux-3.11 (see [1]/[2]).

To avoid build failure of the gst-fsl-plugins/mfw_gst_v4lsrc with toolchains based on newer linux kernel headers this patch gives the include of the custom linux kernel headers precedence over the sysroot linux kernel headers (oposed to the previous behavior).

Fixes the following compile error with buildroot/glibc toolchain:

mfw_gst_v4lsrc.c: In function 'mfw_gst_v4lsrc_capture_setup':
mfw_gst_v4lsrc.c:452:10: error: variable 'chip' has initializer but incomplete type

   struct v4l2_dbg_chip_ident chip = {0};
          ^
mfw_gst_v4lsrc.c:452:10: warning: excess elements in struct initializer [enabled by default]
mfw_gst_v4lsrc.c:452:10: warning: (near initialization for 'chip') [enabled by default]
mfw_gst_v4lsrc.c:452:30: error: storage size of 'chip' isn't known
   struct v4l2_dbg_chip_ident chip = {0};
                              ^
mfw_gst_v4lsrc.c:464:22: error: 'VIDIOC_DBG_G_CHIP_IDENT' undeclared (first use in this function)
   if (ioctl (fd_v4l, VIDIOC_DBG_G_CHIP_IDENT, &chip)) {
                      ^

[1] http://www.spinics.net/lists/linux-media/msg64081.html
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/videodev2.h?id=b71c99801e18eb172ae34851daf25044a3bf644a

---
 package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk +1 -1
index ccdb521..610bd78 100644
@@ -23,7 +23,7 @@ GST_FSL_PLUGINS_CONF_ENV = PLATFORM=$(BR2_PACKAGE_GST_FSL_PLUGINS_PLATFORM)
 
 # needs access to imx-specific kernel headers
 GST_FSL_PLUGINS_DEPENDENCIES += linux
-GST_FSL_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -idirafter $(LINUX_DIR)/include"
+GST_FSL_PLUGINS_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -I$(LINUX_DIR)/include"
 
 ifeq ($(BR2_PACKAGE_XLIB_LIBX11),y)
 GST_FSL_PLUGINS_DEPENDENCIES += xlib_libX11
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#4 lore raw

PATCH 1/1 gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

Dear Arnout Vandecappelle,

Quoted 5 lines · Arnout Vandecappelle

The problem is that the kernel headers in /usr/include/linux are not the
same as the ones in $(LINUX_DIR)/include/linux: headers_install does some fixups on them. Also, $(LINUX_DIR)/include/net is completely different from /usr/include/net. So putting $(LINUX_DIR)/include in front of the system dirs is a bad idea. As in, it didn't work for me :-)

Ok.

Quoted 2 lines

Maybe a generic solution for packages that require specific kernel
headers is to include a headers_install in the kernel's build?

But will it work properly? I mean, most of the time, the packages that need this are vendor-specific packages, that want to access specific definitions in vendor-specific kernels. And the quality of vendor-specific kernels is usually quite low, so there are quite some chances that headers_install might not necessarily do the right thing as it will not have been properly tested...

Quoted 3 lines

Anyway, for this one, if it works with -I with all our external
toolchains and with an internal uClibc and glibc toolchain, then I guess it's OK. Perhaps something got fixed in the gst-fsl-plugins bump.

Is this a Acked-by for the patch?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 1/1 gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

Arnout,

Quoted 10 lines · Thomas Petazzoni
Quoted 2 lines

Maybe a generic solution for packages that require specific kernel
headers is to include a headers_install in the kernel's build?

But will it work properly? I mean, most of the time, the packages that need this are vendor-specific packages, that want to access specific definitions in vendor-specific kernels. And the quality of vendor-specific kernels is usually quite low, so there are quite some chances that headers_install might not necessarily do the right thing as it will not have been properly tested...

Quoted 5 lines
Quoted 3 lines

Anyway, for this one, if it works with -I with all our external
toolchains and with an internal uClibc and glibc toolchain, then I guess it's OK. Perhaps something got fixed in the gst-fsl-plugins bump.

Is this a Acked-by for the patch?

Ping ? :-)

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

In reply to Peter Seiderer

Dear Peter Seiderer,

Quoted 22 lines · Peter Seiderer

The v4l2 ioctl VIDIOC_DBG_G_CHIP_IDENT was removed in linux-3.11 (see [1]/[2]).

To avoid build failure of the gst-fsl-plugins/mfw_gst_v4lsrc with toolchains based on newer linux kernel headers this patch gives the include of the custom linux kernel headers precedence over the sysroot linux kernel headers (oposed to the previous behavior).

Fixes the following compile error with buildroot/glibc toolchain:

mfw_gst_v4lsrc.c: In function 'mfw_gst_v4lsrc_capture_setup':
mfw_gst_v4lsrc.c:452:10: error: variable 'chip' has initializer but incomplete type

   struct v4l2_dbg_chip_ident chip = {0};
          ^
mfw_gst_v4lsrc.c:452:10: warning: excess elements in struct initializer [enabled by default]
mfw_gst_v4lsrc.c:452:10: warning: (near initialization for 'chip') [enabled by default]
mfw_gst_v4lsrc.c:452:30: error: storage size of 'chip' isn't known
   struct v4l2_dbg_chip_ident chip = {0};
                              ^
mfw_gst_v4lsrc.c:464:22: error: 'VIDIOC_DBG_G_CHIP_IDENT' undeclared (first use in this function)
   if (ioctl (fd_v4l, VIDIOC_DBG_G_CHIP_IDENT, &chip)) {
                      ^
Quoted 7 lines

[1] http://www.spinics.net/lists/linux-media/msg64081.html
[2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/videodev2.h?id=b71c99801e18eb172ae34851daf25044a3bf644a

---
 package/gstreamer/gst-fsl-plugins/gst-fsl-plugins.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I believe this problem has been fixed by the following commit:

commit daf3708be46d7eb7e9352ee987f37e32eb00c6bd

Author: Gary Bisson <[email protected]>
Date:   Fri Jul 25 22:34:30 2014 -0700

gst-fsl-plugins: fix build for kernel headers >= 3.10

This package couldn't build using a toolchain with kernel headers >= 3.10 because of the use of VIDIOC_DBG_G_CHIP_IDENT. As stated in videodev2.h, this ioctl should never be used.

Therefore, I'm marking your patch as Superseded in our patch tracking system.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

cover gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

In reply to Peter Seiderer
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Seiderer <[email protected]> writes:

The freescale specific gst-fsl-plugins-3.0.1/src/misc/v4l_source/src/mfw_gst_v4lsrc.c compile depends on the VIDIOC_DBG_G_CHIP_IDENT ioctl (which was removed from linux kernel in version 3.11). This breaks compile with toolchains based on actual linux kernel headers (e.g. buildroot/glibc toolchain).

Which is the right way to fix this problem?

Quoted 8 lines

- fix include precedence from sysroot to custom linux kernel headers as done in the following patch (latest freescale custom kernel is 3.10 based)

- add comment/hint in package description about this dependency

- and/or add dependency (or check) for sysroot linux kernel headers version <= 3.10.x (any hint how to do this?)

How about just patching mfw_gst_v4lsrc.c to use a local definition for VIDIOC_DBG_G_CHIP_IDENT if the kernel headers don't provide it (E.G. in a #ifndef VIDIOC_DBG_G_CHIP_IDENT conditional)?

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

cover gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

Quoted 19 lines

Gesendet: Dienstag, 25. Februar 2014 um 23:28 Uhr
Von: "Peter Korsgaard" <[email protected]>
An: "Peter Seiderer" <[email protected]>
Cc: buildroot at busybox.net
Betreff: Re: [RFC/PATCH 0/1] gst-fsl-plugins: fix compile for sysroot based on newer linux kernel headers

Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Seiderer <[email protected]> writes:

The freescale specific gst-fsl-plugins-3.0.1/src/misc/v4l_source/src/mfw_gst_v4lsrc.c compile depends on the VIDIOC_DBG_G_CHIP_IDENT ioctl (which was removed from linux kernel in version 3.11). This breaks compile with toolchains based on actual linux kernel headers (e.g. buildroot/glibc toolchain).

Which is the right way to fix this problem?

- fix include precedence from sysroot to custom linux kernel headers as done in the following patch (latest freescale custom kernel is 3.10 based)

Quoted 12 lines
Quoted 4 lines

- add comment/hint in package description about this dependency

- and/or add dependency (or check) for sysroot linux kernel headers version <= 3.10.x (any hint how to do this?)

How about just patching mfw_gst_v4lsrc.c to use a local definition for VIDIOC_DBG_G_CHIP_IDENT if the kernel headers don't provide it (E.G. in a #ifndef VIDIOC_DBG_G_CHIP_IDENT conditional)?

Signature · 1 line
Bye, Peter Korsgaard

Was my first thought too, but the gst-fsl-plugins logic seems to be that sysroot and runnign kernel are different ones. The running/custoom kernel needs the imx/freescale-specific extensions.

The #ifndef VIDIOC_DBG_G_CHIP_IDENT conditional solution would give the wrong/sysroot based result instead the right/custom kernel based one (a plugin without VIDIOC_DBG_G_CHIP_IDENT ioctl, a running kernel with existing VIDIOC_DBG_G_CHIP_IDENT ioctl).

Best solution would be consistent versions of toolchain and custom kernel...

Bye, Peter Seiderer