diff mbox

[1/1] package/libdrm: fix building if GCC's C standard is not gnu99

Message ID 1435860302-16176-1-git-send-email-bernd.kuhls@t-online.de
State Accepted
Headers show

Commit Message

Bernd Kuhls July 2, 2015, 6:05 p.m. UTC
Fixes
checking for /home/fli4l/buildroot/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc option to accept ISO C99... unsupported
configure: error: Building libdrm requires C99 enabled compiler

using this defconfig
BR2_KERNEL_HEADERS_4_0=y
BR2_BINUTILS_VERSION_2_25=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_LIBDRM=y

Patch inspired by
http://git.buildroot.net/buildroot/commit/?id=5cf5b390385fb6325485e37dc9d38e1e3ac1f091

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/libdrm/libdrm.mk |    2 ++
 1 file changed, 2 insertions(+)

Comments

Yann E. MORIN July 2, 2015, 8:40 p.m. UTC | #1
Bernd, all,

On 2015-07-02 20:05 +0200, Bernd Kuhls spake thusly:
> Fixes
> checking for /home/fli4l/buildroot/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc option to accept ISO C99... unsupported
> configure: error: Building libdrm requires C99 enabled compiler
> 
> using this defconfig
> BR2_KERNEL_HEADERS_4_0=y
> BR2_BINUTILS_VERSION_2_25=y
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_PACKAGE_LIBDRM=y
> 
> Patch inspired by
> http://git.buildroot.net/buildroot/commit/?id=5cf5b390385fb6325485e37dc9d38e1e3ac1f091
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/libdrm/libdrm.mk |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/libdrm/libdrm.mk b/package/libdrm/libdrm.mk
> index 4cca645..1768214 100644
> --- a/package/libdrm/libdrm.mk
> +++ b/package/libdrm/libdrm.mk
> @@ -19,6 +19,8 @@ LIBDRM_CONF_OPTS = \
>  	--disable-cairo-tests \
>  	--disable-manpages
>  
> +LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
> +
>  ifeq ($(BR2_PACKAGE_LIBDRM_INTEL),y)
>  LIBDRM_CONF_OPTS += --enable-intel
>  LIBDRM_DEPENDENCIES += libatomic_ops libpciaccess
> -- 
> 1.7.10.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Peter Seiderer July 2, 2015, 9:12 p.m. UTC | #2
Hello Bernd,

On Thu,  2 Jul 2015 20:05:02 +0200, Bernd Kuhls <bernd.kuhls@t-online.de> wrote:

> Fixes
> checking for /home/fli4l/buildroot/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc option to accept ISO C99... unsupported
> configure: error: Building libdrm requires C99 enabled compiler
> 
> using this defconfig
> BR2_KERNEL_HEADERS_4_0=y
> BR2_BINUTILS_VERSION_2_25=y
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_PACKAGE_LIBDRM=y
> 
> Patch inspired by
> http://git.buildroot.net/buildroot/commit/?id=5cf5b390385fb6325485e37dc9d38e1e3ac1f091
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  package/libdrm/libdrm.mk |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/libdrm/libdrm.mk b/package/libdrm/libdrm.mk
> index 4cca645..1768214 100644
> --- a/package/libdrm/libdrm.mk
> +++ b/package/libdrm/libdrm.mk
> @@ -19,6 +19,8 @@ LIBDRM_CONF_OPTS = \
>  	--disable-cairo-tests \
>  	--disable-manpages
>  
> +LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
> +
>  ifeq ($(BR2_PACKAGE_LIBDRM_INTEL),y)
>  LIBDRM_CONF_OPTS += --enable-intel
>  LIBDRM_DEPENDENCIES += libatomic_ops libpciaccess

Same problem with libv4l (with raspberrypi_defconfig):

  libv4l2rds.c:256:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    for (int i = 0; i < tuning->station_cnt; i++) {
    ^
  libv4l2rds.c:256:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

From build/libv4l-1.6.2/config.log:

configure:4709: checking for .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc option to accept ISO C99
configure:4858: .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
conftest.c:54:9: error: unknown type name 'wchar_t'
   const wchar_t *name;


The C99 detection problem seems more related to missing wchar_t type support than the compiler option?


Adding LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=c99' gives a lot of compile errors like:

libv4lconvert.c: In function 'dev_ioctl':
processing/../libv4lsyscall-priv.h:85:10: error: 'SYS_ioctl' undeclared (first use in this function)
  syscall(SYS_ioctl, (int)(fd), (unsigned long)(cmd), (void *)(arg))
          ^
libv4lconvert.c:43:9: note: in expansion of macro 'SYS_IOCTL'
  return SYS_IOCTL(fd, cmd, arg);
         ^
processing/../libv4lsyscall-priv.h:85:10: note: each undeclared identifier is reported only once for each function it appears in
  syscall(SYS_ioctl, (int)(fd), (unsigned long)(cmd), (void *)(arg))
          ^
libv4lconvert.c:43:9: note: in expansion of macro 'SYS_IOCTL'
  return SYS_IOCTL(fd, cmd, arg);
         ^

Adding LIBV4L_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' solves all configure/compile errors.

Maybe it is a uclibc-ng and/or autoconf related problem (and there is a better/more general) solution
other than to overwrite ac_cv_prog_cc_c99 for a lot of packages?

Regards,
Peter
Arnout Vandecappelle July 2, 2015, 9:46 p.m. UTC | #3
On 07/02/15 23:12, Peter Seiderer wrote:
[snip]
> From build/libv4l-1.6.2/config.log:
> 
> configure:4709: checking for .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc option to accept ISO C99
> configure:4858: .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
> conftest.c:54:9: error: unknown type name 'wchar_t'
>    const wchar_t *name;
> 
> 
> The C99 detection problem seems more related to missing wchar_t type support than the compiler option?

 Good catch!

[Adding Waldemar for uClibc input]

 The configure script does include wchar.h, but it seems that wchar_t doesn't
get defined after all... Waldemar, any idea?


 Regards,
 Arnout

[snip]
Yann E. MORIN July 2, 2015, 10:05 p.m. UTC | #4
Arnout, All,

On 2015-07-02 23:46 +0200, Arnout Vandecappelle spake thusly:
> On 07/02/15 23:12, Peter Seiderer wrote:
> [snip]
> > From build/libv4l-1.6.2/config.log:
> > 
> > configure:4709: checking for .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc option to accept ISO C99
> > configure:4858: .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
> > conftest.c:54:9: error: unknown type name 'wchar_t'
> >    const wchar_t *name;
> > 
> > 
> > The C99 detection problem seems more related to missing wchar_t type support than the compiler option?
> 
>  Good catch!
> 
> [Adding Waldemar for uClibc input]
> 
>  The configure script does include wchar.h, but it seems that wchar_t doesn't
> get defined after all... Waldemar, any idea?

No wchar support in the toolchain, maybe?

Peter, can you confirm your toolchain is missing wchar (BR2_USE_WCHAR)?

Note: I am *not* saying those packages should depend on whar, just that
this would explain the failing (and broken!) autoconf test.

Regards,
Yann E. MORIN.
Peter Seiderer July 2, 2015, 10:19 p.m. UTC | #5
Hello Yann,

On Fri, 3 Jul 2015 00:05:34 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Arnout, All,
> 
> On 2015-07-02 23:46 +0200, Arnout Vandecappelle spake thusly:
> > On 07/02/15 23:12, Peter Seiderer wrote:
> > [snip]
> > > From build/libv4l-1.6.2/config.log:
> > > 
> > > configure:4709: checking for .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc option to accept ISO C99
> > > configure:4858: .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
> > > conftest.c:54:9: error: unknown type name 'wchar_t'
> > >    const wchar_t *name;
> > > 
> > > 
> > > The C99 detection problem seems more related to missing wchar_t type support than the compiler option?
> > 
> >  Good catch!
> > 
> > [Adding Waldemar for uClibc input]
> > 
> >  The configure script does include wchar.h, but it seems that wchar_t doesn't
> > get defined after all... Waldemar, any idea?
> 
> No wchar support in the toolchain, maybe?
> 
> Peter, can you confirm your toolchain is missing wchar (BR2_USE_WCHAR)?
>

Used up to date raspberrypi_defconfig, no wchar support enabled:
# BR2_TOOLCHAIN_BUILDROOT_WCHAR is not set

Regards,
Peter

> Note: I am *not* saying those packages should depend on whar, just that
> this would explain the failing (and broken!) autoconf test.
> 
> Regards,
> Yann E. MORIN.
>
Yann E. MORIN July 2, 2015, 10:22 p.m. UTC | #6
Peter, All,

On 2015-07-03 00:19 +0200, Peter Seiderer spake thusly:
> On Fri, 3 Jul 2015 00:05:34 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> > On 2015-07-02 23:46 +0200, Arnout Vandecappelle spake thusly:
> > > On 07/02/15 23:12, Peter Seiderer wrote:
> > > [snip]
> > > > From build/libv4l-1.6.2/config.log:
> > > > 
> > > > configure:4709: checking for .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc option to accept ISO C99
> > > > configure:4858: .../host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
> > > > conftest.c:54:9: error: unknown type name 'wchar_t'
> > > >    const wchar_t *name;
> > > > 
> > > > 
> > > > The C99 detection problem seems more related to missing wchar_t type support than the compiler option?
> > > 
> > >  Good catch!
> > > 
> > > [Adding Waldemar for uClibc input]
> > > 
> > >  The configure script does include wchar.h, but it seems that wchar_t doesn't
> > > get defined after all... Waldemar, any idea?
> > 
> > No wchar support in the toolchain, maybe?
> > 
> > Peter, can you confirm your toolchain is missing wchar (BR2_USE_WCHAR)?
> >
> 
> Used up to date raspberrypi_defconfig, no wchar support enabled:

Note that I just updated it two days ago. ;-)

> # BR2_TOOLCHAIN_BUILDROOT_WCHAR is not set

OK, thanks; that explains it.

Still ,that autoconf test is broken... :-(

Regards,
Yann E. MORIN.
Thomas Petazzoni July 4, 2015, 12:14 p.m. UTC | #7
Dear Bernd Kuhls,

On Thu,  2 Jul 2015 20:05:02 +0200, Bernd Kuhls wrote:
> Fixes
> checking for /home/fli4l/buildroot/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc option to accept ISO C99... unsupported
> configure: error: Building libdrm requires C99 enabled compiler
> 
> using this defconfig
> BR2_KERNEL_HEADERS_4_0=y
> BR2_BINUTILS_VERSION_2_25=y
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_PACKAGE_LIBDRM=y
> 
> Patch inspired by
> http://git.buildroot.net/buildroot/commit/?id=5cf5b390385fb6325485e37dc9d38e1e3ac1f091
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  package/libdrm/libdrm.mk |    2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks.

Thomas
diff mbox

Patch

diff --git a/package/libdrm/libdrm.mk b/package/libdrm/libdrm.mk
index 4cca645..1768214 100644
--- a/package/libdrm/libdrm.mk
+++ b/package/libdrm/libdrm.mk
@@ -19,6 +19,8 @@  LIBDRM_CONF_OPTS = \
 	--disable-cairo-tests \
 	--disable-manpages
 
+LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+
 ifeq ($(BR2_PACKAGE_LIBDRM_INTEL),y)
 LIBDRM_CONF_OPTS += --enable-intel
 LIBDRM_DEPENDENCIES += libatomic_ops libpciaccess