Bug 64807 - xcb-util-0.3.9 Solaris 10 pre U10 requires <stdio.h> for src/atoms.c
Summary: xcb-util-0.3.9 Solaris 10 pre U10 requires <stdio.h> for src/atoms.c
Status: RESOLVED FIXED
Alias: None
Product: XCB
Classification: Unclassified
Component: Utils (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Solaris
: medium normal
Assignee: xcb mailing list dummy
QA Contact: xcb mailing list dummy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-21 03:25 UTC by mark
Modified: 2013-06-01 01:03 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description mark 2013-05-21 03:25:12 UTC
/etc/release: Solaris 10 10/09 s10x_u8wos_08a X86
uname -a    : SunOS host 5.10 Generic_142901-13 i86pc i386 i86pc
# cc -V
cc: Sun C 5.12 SunOS_i386 2011/11/16

On Solaris 10 before Update 10 release there wasn't a vasprintf(). This invokes a new code stream in the source.

The src/atoms.c program fails to compile as there's a missing <stdio.h> at the top.

The recipe:

    cd /var/tmp
    rm -rf xcb-util-0.3.9
    untgz /usr/local/src/x11/xcb-util-0.3.9.tar.gz
    cd xcb-util-0.3.9
    /bin/perl -pe "s%^LIBTOOL=.*%LIBTOOL='/usr/local/bin/libtool'%" -i configure
    ./configure --prefix=/usr/local \
        --disable-silent-rules
    gmake

Making all in src
gmake[1]: Entering directory `/var/tmp/xcb-util-0.3.9/src'
source='atoms.c' object='atoms.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../depcomp \
/usr/local/bin/libtool  --tag=CC   --mode=compile cc -D_STDC_C99= -DPACKAGE_NAME=\"xcb-util\" -DPACKAGE_TARNAME=\"xcb-util\" -DPACKAGE_VERSION=\"0.3.9\" -DPACKAGE_STRING=\"xcb-util\ 0.3.9\" -DPACKAGE_BUGREPORT=\"xcb@lists.freedesktop.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"xcb-util\" -DVERSION=\"0.3.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE_VERSION_MAJOR=0 -DPACKAGE_VERSION_MINOR=3 -DPACKAGE_VERSION_PATCHLEVEL=9 -I.  -I/usr/local/include    -v -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED -errwarn=E_FUNC_HAS_NO_RETURN_STMT -errwarn=E_BAD_PTR_INT_COMBINATION -g -c -o atoms.lo atoms.c
libtool: compile:  cc -D_STDC_C99= -DPACKAGE_NAME=\"xcb-util\" -DPACKAGE_TARNAME=\"xcb-util\" -DPACKAGE_VERSION=\"0.3.9\" "-DPACKAGE_STRING=\"xcb-util 0.3.9\"" -DPACKAGE_BUGREPORT=\"xcb@lists.freedesktop.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"xcb-util\" -DVERSION=\"0.3.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE_VERSION_MAJOR=0 -DPACKAGE_VERSION_MINOR=3 -DPACKAGE_VERSION_PATCHLEVEL=9 -I. -I/usr/local/include -v -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED -errwarn=E_FUNC_HAS_NO_RETURN_STMT -errwarn=E_BAD_PTR_INT_COMBINATION -g -c atoms.c  -KPIC -DPIC -o .libs/atoms.o
"atoms.c", line 30: implicit function declaration: vsnprintf
cc: acomp failed for atoms.c
gmake[1]: *** [atoms.lo] Error 1
gmake[1]: Leaving directory `/var/tmp/xcb-util-0.3.9/src'
gmake: *** [all-recursive] Error 1


# man vsnprintf
SYNOPSIS
     #include <stdio.h>
     #include <stdarg.h>

     int vsnprintf(char *s, size_t n, const char *format, va_list ap);


src/atoms.c includes <stdio.h> if _GNU_SOURCE is defined. This might not be true for a non gcc compiler.

Simply adding a #include <stdio.h> at the top lets the compile finish. I can't see why it shouldn't be there by default?

I use this line to insert the include:

    /bin/perl -pe '($. == 1) && s%^%#include <stdio.h>\n%' -i src/atoms.c


New recipe:
    cd /var/tmp
    rm -rf xcb-util-0.3.9
    untgz /usr/local/src/x11/xcb-util-0.3.9.tar.gz
    cd xcb-util-0.3.9
    /bin/perl -pe "s%^LIBTOOL=.*%LIBTOOL='/usr/local/bin/libtool'%" -i configure
    ./configure --prefix=/usr/local \
        --disable-silent-rules
    /bin/perl -pe '($. == 1) && s%^%#include <stdio.h>\n%' -i src/atoms.c
    gmake
    gmake install
Comment 1 Alan Coopersmith 2013-05-21 04:58:33 UTC
(In reply to comment #0)
> src/atoms.c includes <stdio.h> if _GNU_SOURCE is defined. This might not be
> true for a non gcc compiler.

Actually it includes it if HAVE_VASPRINTF is defined, and doesn't require the
_GNU_SOURCE flag (which refers to GNU libc, not the GNU compilers).

Fix submitted for code review:
http://lists.freedesktop.org/archives/xcb/2013-May/008280.html
Comment 2 Alan Coopersmith 2013-06-01 01:03:13 UTC
Fix pushed to git master:
To ssh://git.freedesktop.org/git/xcb/util
   d5a1a62..658d289  master -> master
http://cgit.freedesktop.org/xcb/util/commit/?id=658d289f643769e3398470e9b85df16c3568e6f9


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.