[gst-devel] Re: Forte Solaris patch

Christian Fredrik Kalager Schaller Uraeus at linuxrising.org
Fri Jan 17 17:05:01 CET 2003


After applying the patch I get this when attempting to compile (from
disted tarball):
gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_GNU_SOURCE -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2 -pthread
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I.. -Wall -Werror
-DGST_DISABLE_DEPRECATED -g -I../libs -I../include
-DG_LOG_DOMAIN=g_log_domain_gstreamer
-DGST_CACHE_DIR=\"/var/cache/gstreamer-0.5\" -O2 -g -march=i386
-mcpu=i686 -c cothreads.c -MT libcothreads_la-cothreads.lo -MD -MP -MF
.deps/libcothreads_la-cothreads.TPlo  -fPIC -DPIC -o
.libs/libcothreads_la-cothreads.lo
cothreads.c: In function `cothread_context_init':
cothreads.c:116: parse error before "cothread_context"
cothreads.c:120: `ctx' undeclared (first use in this function)
cothreads.c:120: (Each undeclared identifier is reported only once
cothreads.c:120: for each function it appears in.)
make[4]: *** [libcothreads_la-cothreads.lo] Error 1
make[4]: Leaving directory
`/home/cschalle/rpms/BUILD/gstreamer-0.5.1.1/gst'




On Fri, 2003-01-17 at 18:13, Brian Cameron wrote:
> Updated patch.  I found out that the previous patch I sent had a problem
> which caused it to fail on patching configure.ac.  I've heard that this
> patch works better.  :)
> 
> Brian
> 
> 
> > The attached patch makes gstreamer build fine with Forte!  Finally got
> > all the issues sorted.  Could this patch be applied to gstreamer head?
> > 
> > Brian
> > 
> > 
> > Note:  things still aren't working 100% with Forte.  Running "make check"
> >        fails as follows.
> > 
> > --make check output start--
> > 
> > make[5]: Entering directory 
> > `/export/home/build/gnome/future/gstreamer/libs/ext/cothreads/tests'
> > 0: calling the pthread function directly
> > 0: spawning a new cothread
> > 
> > (process:3848): Cothreads-CRITICAL **: mmap failed, captain
> > 
> > Cothreads-ERROR **: could not allocate a new cothread stack
> > aborting...
> > FAIL: cothreads
> > 0: spawning a new cothread (iteration 1)
> > FAIL: dynamic
> > ===================
> > 2 of 2 tests failed
> > ===================
> > 
> > --make check output end--
> > 
> > Brian
> 
> 
> Brian
> 
> ______________________________________________________________________
> 
> Index: gstreamer/acconfig.h
> ===================================================================
> --- /dev/null	Fri Jan 17 10:51:52 2003
> +++ gstreamer/acconfig.h	Thu Jan 16 17:10:19 2003
> @@ -0,0 +1,2 @@
> +#undef HAVE_UCONTEXT_H
> +
> Index: gstreamer/configure.ac
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/configure.ac,v
> retrieving revision 1.203
> diff -u -p -r1.203 configure.ac
> --- gstreamer/configure.ac	11 Jan 2003 00:27:29 -0000	1.203
> +++ gstreamer/configure.ac	17 Jan 2003 16:44:51 -0000
> @@ -174,6 +174,8 @@ int main ()
>                  ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/])
>  ])
>  
> +AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H))
> +
>  dnl Check for atomic.h
>  dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
>  dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
> Index: gstreamer/gst/cothreads.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/cothreads.c,v
> retrieving revision 1.105
> diff -u -p -r1.105 cothreads.c
> --- gstreamer/gst/cothreads.c	1 Jan 2003 04:28:32 -0000	1.105
> +++ gstreamer/gst/cothreads.c	17 Jan 2003 16:44:51 -0000
> @@ -36,6 +36,11 @@
>  #include "gstarch.h"
>  #include "gstlog.h"
>  #include "gstutils.h"
> +#ifdef HAVE_MAKECONTEXT
> +#ifdef HAVE_UCONTEXT_H
> +    #include <ucontext.h>
> +#endif
> +#endif
>  
>  /* older glibc's have MAP_ANON instead of MAP_ANONYMOUS */
>  #ifndef MAP_ANONYMOUS
> @@ -101,8 +106,14 @@ cothread_get_current_context (void)
>  cothread_context *
>  cothread_context_init (void)
>  {
> +#ifndef __GNUC__
> +  char __csf;
> +  void *sp = &__csf;
> +#else
> +  void *sp = CURRENT_STACK_FRAME
> +#endif
> +
>    cothread_context *ctx;
> -  void *sp;
>  
>    /* if there already is a cotread context for this thread,
>     * just return it */
> @@ -136,7 +147,6 @@ cothread_context_init (void)
>    /* clear the cothread data */
>    memset (ctx->cothreads, 0, sizeof (ctx->cothreads));
>  
> -  sp = CURRENT_STACK_FRAME;
>    /* FIXME this may not be 64bit clean
>     *       could use casts to uintptr_t from inttypes.h
>     *       if only all platforms had inttypes.h
> @@ -158,7 +168,7 @@ cothread_context_init (void)
>    ctx->cothreads[0]->argv = NULL;
>    ctx->cothreads[0]->priv = NULL;
>    ctx->cothreads[0]->flags = COTHREAD_STARTED;
> -  ctx->cothreads[0]->sp = (void *) CURRENT_STACK_FRAME;
> +  ctx->cothreads[0]->sp = (void *) sp;
>  
>    GST_INFO (GST_CAT_COTHREADS, "0th cothread is %p at sp:%p", 
>              ctx->cothreads[0], ctx->cothreads[0]->sp);
> @@ -443,6 +453,13 @@ cothread_current (void)
>  static void
>  cothread_stub (void)
>  {
> +#ifndef __GNUC__
> +  char __csf;
> +  char *sp = &__csf;
> +#else
> +  char *sp = CURRENT_STACK_FRAME;
> +#endif
> +
>    cothread_context *ctx = cothread_get_current_context();
>    cothread_state *cothread = ctx->cothreads[ctx->current];
>  
> @@ -457,7 +474,7 @@ cothread_stub (void)
>  
>      GST_DEBUG (GST_CAT_COTHREADS, "cothread[%d] thread->func exited", ctx->current);
>  
> -    GST_DEBUG (GST_CAT_COTHREADS, "sp=%p", CURRENT_STACK_FRAME);
> +    GST_DEBUG (GST_CAT_COTHREADS, "sp=%p", sp);
>      GST_DEBUG (GST_CAT_COTHREADS, "ctx=%p current=%p", ctx,cothread_get_current_context());
>      g_assert (ctx == cothread_get_current_context());
>  
> Index: gstreamer/gst/gst.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gst.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 gst.c
> --- gstreamer/gst/gst.c	1 Jan 2003 03:09:38 -0000	1.88
> +++ gstreamer/gst/gst.c	17 Jan 2003 16:44:51 -0000
> @@ -190,18 +190,54 @@ gst_init_with_popt_table (int *argc, cha
>    gint nextopt, i, j, nstrip;
>    gchar **temp;
>    const struct poptOption *options;
> -  /* this is probably hacky, no? */
> -  const struct poptOption options_with[] = {
> -    {NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 				 0, "Help options:", NULL},
> -    {NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
> -    {NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) popt_options, 		 0, "Application options:", NULL},
> -    POPT_TABLEEND
> +  struct poptOption options_with[] = {
> +     POPT_TABLEEND,
> +     POPT_TABLEEND,
> +     POPT_TABLEEND,
> +     POPT_TABLEEND
>    };
> -  const struct poptOption options_without[] = {
> -    {NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 				 0, "Help options:", NULL},
> -    {NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
> -    POPT_TABLEEND
> +  struct poptOption options_without[] = {
> +     POPT_TABLEEND,
> +     POPT_TABLEEND,
> +     POPT_TABLEEND
>    };
> +
> +  options_with[0].longName   = NULL;
> +  options_with[0].shortName  = NUL;
> +  options_with[0].argInfo    = POPT_ARG_INCLUDE_TABLE;
> +  options_with[0].arg        = poptHelpOptions;
> +  options_with[0].val        = 0;
> +  options_with[0].descrip    = "Help options:";
> +  options_with[0].argDescrip = NULL;
> +  options_with[1].longName   = NULL;
> +  options_with[1].shortName  = NUL;
> +  options_with[1].argInfo    = POPT_ARG_INCLUDE_TABLE;
> +  options_with[1].arg        = (struct poptOption *) gst_init_get_popt_table();
> +  options_with[1].val        = 0;
> +  options_with[1].descrip    = "GStreamer options:";
> +  options_with[1].argDescrip = NULL;
> +  options_with[2].longName   = NULL;
> +  options_with[2].shortName  = NUL;
> +  options_with[2].argInfo    = POPT_ARG_INCLUDE_TABLE;
> +  options_with[2].arg        = (struct poptOption *) popt_options;
> +  options_with[2].val        = 0;
> +  options_with[2].descrip    = "Application options:";
> +  options_with[2].argDescrip = NULL;
> +
> +  options_without[0].longName   = NULL;
> +  options_without[0].shortName  = NUL;
> +  options_without[0].argInfo    = POPT_ARG_INCLUDE_TABLE;
> +  options_without[0].arg        = poptHelpOptions;
> +  options_without[0].val        = 0;
> +  options_without[0].descrip    = "Help options:";
> +  options_without[0].argDescrip = NULL;
> +  options_without[1].longName   = NULL;
> +  options_without[1].shortName  = NUL;
> +  options_without[1].argInfo    = POPT_ARG_INCLUDE_TABLE;
> +  options_without[1].arg        = (struct poptOption *) gst_init_get_popt_table();
> +  options_without[1].val        = 0;
> +  options_without[1].descrip    = "GStreamer options:";
> +  options_without[1].argDescrip = NULL;
>  
>    if (gst_initialized)
>    {
> Index: gstreamer/gst/gstarch.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gstarch.h,v
> retrieving revision 1.18
> diff -u -p -r1.18 gstarch.h
> --- gstreamer/gst/gstarch.h	11 Dec 2002 21:33:07 -0000	1.18
> +++ gstreamer/gst/gstarch.h	17 Jan 2003 16:44:51 -0000
> @@ -110,7 +110,7 @@ struct minimal_stackframe {
>  
> 
>  /***** Sun SPARC *****/
> -#elif defined(HAVE_CPU_SPARC)
> +#elif defined(HAVE_CPU_SPARC) && defined(__GNUC__)
>  
>  #define GST_ARCH_SET_SP(stackpointer) \
>      __asm__( "ta 3\n\t" \
> Index: gstreamer/gst/gstatomic_impl.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gstatomic_impl.h,v
> retrieving revision 1.1
> diff -u -p -r1.1 gstatomic_impl.h
> --- gstreamer/gst/gstatomic_impl.h	31 Dec 2002 03:21:07 -0000	1.1
> +++ gstreamer/gst/gstatomic_impl.h	17 Jan 2003 16:44:51 -0000
> @@ -206,7 +206,7 @@ gst_atomic_int_dec_and_test (GstAtomicIn
>  }
>  
>  /***** Sun SPARC *****/
> -#elif defined(HAVE_CPU_SPARC)
> +#elif defined(HAVE_CPU_SPARC) && defined(__GNUC__)
>  
>  GST_INLINE_FUNC void 	gst_atomic_int_destroy 	(GstAtomicInt *aint) { } 
>  
> Index: gstreamer/gst/gstinfo.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gstinfo.c,v
> retrieving revision 1.51
> diff -u -p -r1.51 gstinfo.c
> --- gstreamer/gst/gstinfo.c	13 Dec 2002 15:33:39 -0000	1.51
> +++ gstreamer/gst/gstinfo.c	17 Jan 2003 16:44:51 -0000
> @@ -564,7 +564,11 @@ gst_debug_print_stack_trace (void)
>  
>  #endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */
>  
> +#ifdef __GNUC__
>  inline void *
> +#else
> +void *
> +#endif
>  _gst_debug_register_funcptr (void *ptr, gchar *ptrname)
>  {
>    if (!__gst_function_pointers)
> Index: gstreamer/gst/gstinfo.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/gstinfo.h,v
> retrieving revision 1.39
> diff -u -p -r1.39 gstinfo.h
> --- gstreamer/gst/gstinfo.h	15 Jan 2003 21:42:30 -0000	1.39
> +++ gstreamer/gst/gstinfo.h	17 Jan 2003 16:44:51 -0000
> @@ -352,7 +352,11 @@ void gst_default_info_handler (gint cate
>                                 gint line,const gchar *debug_string,
>                                 void *element,gchar *string);
>  
> +#ifdef __GNUC__
>  inline void * _gst_debug_register_funcptr (void *ptr, gchar *ptrname);
> +#else
> +void * _gst_debug_register_funcptr (void *ptr, gchar *ptrname);
> +#endif
>  
>  extern GstInfoHandler _gst_info_handler;
>  extern guint32 _gst_info_categories;
> Index: gstreamer/gst/elements/gstmd5sink.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gstreamer/gst/elements/gstmd5sink.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 gstmd5sink.c
> --- gstreamer/gst/elements/gstmd5sink.c	29 Sep 2002 17:52:31 -0000	1.7
> +++ gstreamer/gst/elements/gstmd5sink.c	17 Jan 2003 16:44:51 -0000
> @@ -151,7 +151,11 @@ md5_process_bytes (const void *buffer, s
>        size_t add = 128 - left_over > len ? len : 128 - left_over;
>  
>        /* Only put full words in the buffer.  */
> +#ifdef __GNUC__
>        add -= add % __alignof__ (guint32);
> +#else
> +      add -= add % 4;
> +#endif
>  
>        memcpy (&ctx->buffer[left_over], buffer, add);
>        ctx->buflen += add;
> Index: gstreamer/libs/ext/cothreads/cothreads/Makefile.am
> ===================================================================
> RCS file: /cvsroot/gstreamer/cothreads/cothreads/Makefile.am,v
> retrieving revision 1.8
> diff -u -p -r1.8 Makefile.am
> --- gstreamer/libs/ext/cothreads/cothreads/Makefile.am	13 Aug 2002 21:53:24 -0000	1.8
> +++ gstreamer/libs/ext/cothreads/cothreads/Makefile.am	17 Jan 2003 16:44:51 -0000
> @@ -14,12 +14,12 @@ COTHREADS_FILES = cothreads.c pth_mctx.c
>  libcothreads_la_SOURCES = $(COTHREADS_FILES)
>  libcothreads_la_LIBADD = $(COTHREADS_LDFLAGS) $(GLIB_LIBS)
>  libcothreads_la_CFLAGS = $(COTHREADS_CFLAGS) $(GLIB_CFLAGS) \
> -                         -I$(top_builddir) -Wall
> +                         -I$(top_builddir)
>  
>  libcothreads_gthreads_la_SOURCES = $(COTHREADS_FILES)
>  libcothreads_gthreads_la_LIBADD = $(COTHREADS_LDFLAGS) $(GTHREAD_LIBS)
>  libcothreads_gthreads_la_CFLAGS = $(COTHREADS_CFLAGS) $(GTHREAD_CFLAGS) \
> -                                  -I$(top_builddir) -Wall
> +                                  -I$(top_builddir)
>  
>  noinst_HEADERS = cothreads-private.h cothreads.h pth_p.h \
>  	config-public.h config-private.h cothreads-pth.h \
> Index: gstreamer/libs/ext/cothreads/cothreads/cothreads.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/cothreads/cothreads/cothreads.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 cothreads.c
> --- gstreamer/libs/ext/cothreads/cothreads/cothreads.c	12 Sep 2002 19:28:28 -0000	1.21
> +++ gstreamer/libs/ext/cothreads/cothreads/cothreads.c	17 Jan 2003 16:44:51 -0000
> @@ -1,4 +1,4 @@
> -/* Pthread-friendly coroutines with pth
> +/*
>   * Copyright (C) 2002 Andy Wingo <wingo at pobox.com>
>   *
>   * cothreads.c: public API implementation
> @@ -238,7 +238,14 @@ cothreads_get_chunk (void) 
>  cothread*
>  cothread_create (cothread_func func, int argc, void **argv, cothread *main)
>  {
> -  char *low, *high, *dest;
> +#ifndef __GNUC__
> +  char __csf;
> +  char *low = &__csf;
> +#else
> +  char *low = CURRENT_STACK_FRAME
> +#endif
> +
> +  char *high, *dest;
>    cothread_private priv;
>    cothread *ret = NULL;
>    cothread_chunk *chunk;
> @@ -252,7 +259,6 @@ cothread_create (cothread_func func, int
>    if (!func) {
>      /* we are being asked to save the current thread into a new cothread. this
>       * only happens for the first cothread in a thread. */
> -    low = CURRENT_STACK_FRAME;
>  #if PTH_STACK_GROWTH > 0
>      dest = (char*) ((gulong)low | (chunk->size / chunk->nblocks - 1))
>        + 1 - getpagesize() * 2;
> @@ -302,7 +308,12 @@ cothread_create (cothread_func func, int
>  cothread*
>  cothread_self (void)
>  {
> -  char *sp = CURRENT_STACK_FRAME;
> +#ifndef __GNUC__
> +  char __csf;
> +  char *sp = &__csf;
> +#else
> +  char *sp = CURRENT_STACK_FRAME
> +#endif
>  
>    return (cothread*)cothread_private_get (cothreads_get_chunk(), sp, NULL, sizeof (cothread_private));
>  }
> @@ -542,8 +553,13 @@ static cothread_chunk*
>  cothread_chunk_new (glong size, gint nblocks)
>  {
>    cothread_chunk *ret;
> -  char *sp = CURRENT_STACK_FRAME;
> -  
> +#ifndef __GNUC__
> +  char __csf;
> +  char *sp = &__csf;
> +#else
> +  char *sp = CURRENT_STACK_FRAME
> +#endif
> +
>    ret = g_new0 (cothread_chunk, 1);
>    ret->nblocks = nblocks;
>    ret->block_states = g_new0 (cothread_block_state, ret->nblocks);
-- 
Christian Fredrik Kalager Schaller <Uraeus at linuxrising.org>





More information about the gstreamer-devel mailing list