unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
       [not found] <87aafb2w68.fsf@gnu.org>
@ 2011-05-15 10:56 ` Hans Aberg
  2011-05-20 10:11   ` Andy Wingo
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Aberg @ 2011-05-15 10:56 UTC (permalink / raw)
  To: bug-guile bug

On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit, i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the error:
  Failed to get stack base for current thread.
The program 'guile' works, though. And scm_init_guile() works in Guile 2.0.0.

(On this platform, there is a later clang/llvm based compiler, that comes with Xcode 4.)

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-15 10:56 ` Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7 Hans Aberg
@ 2011-05-20 10:11   ` Andy Wingo
  2011-05-20 10:52     ` Hans Aberg
                       ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Andy Wingo @ 2011-05-20 10:11 UTC (permalink / raw)
  To: Hans Aberg; +Cc: bug-guile bug

On Sun 15 May 2011 12:56, Hans Aberg <haberg-1@telia.com> writes:

> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
> error:
>
>   Failed to get stack base for current thread.

The code in question does this:

    void
    scm_init_guile ()
    {
      struct GC_stack_base stack_base;
      
      if (GC_get_stack_base (&stack_base) == GC_SUCCESS)
        scm_i_init_thread_for_guile (&stack_base,
                                     scm_i_default_dynamic_state);
      else
        {
          fprintf (stderr, "Failed to get stack base for current thread.\n");
          exit (1);
        }
    }

As you can see we rely on libgc here, and so this is a libgc bug.  Can
you try a newer libgc, or if that still fails, bring it up on their
list?

Thanks,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 10:11   ` Andy Wingo
@ 2011-05-20 10:52     ` Hans Aberg
  2011-05-20 11:31     ` Hans Aberg
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Hans Aberg @ 2011-05-20 10:52 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 20 May 2011, at 12:11, Andy Wingo wrote:

>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>> error:
>> 
>>  Failed to get stack base for current thread.
> 
> The code in question does this:
> 
>    void
>    scm_init_guile ()
>    {
>      struct GC_stack_base stack_base;
> 
>      if (GC_get_stack_base (&stack_base) == GC_SUCCESS)
>        scm_i_init_thread_for_guile (&stack_base,
>                                     scm_i_default_dynamic_state);
>      else
>        {
>          fprintf (stderr, "Failed to get stack base for current thread.\n");
>          exit (1);
>        }
>    }
> 
> As you can see we rely on libgc here, and so this is a libgc bug.  Can
> you try a newer libgc, or if that still fails, bring it up on their
> list?

In what ways do you use it differently in guile-2.0.1? - It works in guile-2.0.0.

I was directed to use bdwgc-7_2alpha5-20110107, as gc-7.1 did not work on my platform.

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 10:11   ` Andy Wingo
  2011-05-20 10:52     ` Hans Aberg
@ 2011-05-20 11:31     ` Hans Aberg
  2011-05-20 13:10       ` Andy Wingo
  2011-05-21 12:58     ` Hans Aberg
  2011-05-21 17:20     ` Hans Aberg
  3 siblings, 1 reply; 12+ messages in thread
From: Hans Aberg @ 2011-05-20 11:31 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 20 May 2011, at 12:11, Andy Wingo wrote:

>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>> error:
>> 
>>  Failed to get stack base for current thread.
...
> As you can see we rely on libgc here, and so this is a libgc bug.  Can
> you try a newer libgc, or if that still fails, bring it up on their
> list?

On Mac OS X, one must call GC_init() (not necessary on GNU/Linux). Has that dropped out in guile-2.0.1?

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 11:31     ` Hans Aberg
@ 2011-05-20 13:10       ` Andy Wingo
  2011-05-20 13:39         ` Hans Aberg
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Wingo @ 2011-05-20 13:10 UTC (permalink / raw)
  To: Hans Aberg; +Cc: bug-guile bug

On Fri 20 May 2011 13:31, Hans Aberg <haberg-1@telia.com> writes:

> On 20 May 2011, at 12:11, Andy Wingo wrote:
>
>>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>>> error:
>>> 
>>>  Failed to get stack base for current thread.
> ...
>> As you can see we rely on libgc here, and so this is a libgc bug.  Can
>> you try a newer libgc, or if that still fails, bring it up on their
>> list?
>
> On Mac OS X, one must call GC_init() (not necessary on GNU/Linux). Has
> that dropped out in guile-2.0.1?

I really have no idea.  As you see in 2.0.1 we rely on libgc for
detecting stack boundaries in the non-scm_with_guile case, as is
appropriate I think.  As for GC_init() I don't know, and would be
surprised if that were the case.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 13:10       ` Andy Wingo
@ 2011-05-20 13:39         ` Hans Aberg
  2011-05-20 13:58           ` Andy Wingo
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Aberg @ 2011-05-20 13:39 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 20 May 2011, at 15:10, Andy Wingo wrote:

>>>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>>>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>>>> error:
>>>> 
>>>> Failed to get stack base for current thread.
>> ...
>>> As you can see we rely on libgc here, and so this is a libgc bug.  Can
>>> you try a newer libgc, or if that still fails, bring it up on their
>>> list?
>> 
>> On Mac OS X, one must call GC_init() (not necessary on GNU/Linux). Has
>> that dropped out in guile-2.0.1?
> 
> I really have no idea.  As you see in 2.0.1 we rely on libgc for
> detecting stack boundaries in the non-scm_with_guile case, as is
> appropriate I think.  As for GC_init() I don't know, and would be
> surprised if that were the case.

There is a comment in in libguile/gc.c suggesting it isn't called, there is:

void
scm_storage_prehistory ()
{
  GC_all_interior_pointers = 0;
  GC_set_free_space_divisor (scm_getenv_int ("GC_FREE_SPACE_DIVISOR", 3));

  GC_INIT ();

#if (! ((defined GC_VERSION_MAJOR) && (GC_VERSION_MAJOR >= 7))) \
    && (defined SCM_I_GSC_USE_PTHREAD_THREADS)
  /* When using GC 6.8, this call is required to initialize thread-local
     freelists (shouldn't be necessary with GC 7.0).  */
  GC_init ();
#endif
...
}

The presumption is wrong, because it does not work on Mac OS X without calling GC_init() - I have tried.

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 13:39         ` Hans Aberg
@ 2011-05-20 13:58           ` Andy Wingo
  2011-05-20 16:21             ` Hans Aberg
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Wingo @ 2011-05-20 13:58 UTC (permalink / raw)
  To: Hans Aberg; +Cc: bug-guile bug

Hello,

On Fri 20 May 2011 15:39, Hans Aberg <haberg-1@telia.com> writes:

> There is a comment in in libguile/gc.c suggesting it isn't called, there is:
>
> void
> scm_storage_prehistory ()
> {
>   GC_all_interior_pointers = 0;
>   GC_set_free_space_divisor (scm_getenv_int ("GC_FREE_SPACE_DIVISOR", 3));
>
>   GC_INIT ();
>
> #if (! ((defined GC_VERSION_MAJOR) && (GC_VERSION_MAJOR >= 7))) \
>     && (defined SCM_I_GSC_USE_PTHREAD_THREADS)
>   /* When using GC 6.8, this call is required to initialize thread-local
>      freelists (shouldn't be necessary with GC 7.0).  */
>   GC_init ();
> #endif
> ...
> }
>
> The presumption is wrong, because it does not work on Mac OS X without calling GC_init() - I have tried.

Did you enable threads? `grep PTHREAD scmconfig.h` to check.

Here is the current definition of GC_INIT ():

    /* Portable clients should call this at the program start-up.  More     */
    /* over, some platforms require this call to be done strictly from the  */
    /* primordial thread.                                                   */
    #define GC_INIT() { GC_INIT_CONF_DONT_EXPAND; /* pre-init */ \
                        GC_INIT_CONF_FORCE_UNMAP_ON_GCOLLECT; \
                        GC_INIT_CONF_MAX_RETRIES; \
                        GC_INIT_CONF_FREE_SPACE_DIVISOR; \
                        GC_INIT_CONF_FULL_FREQ; \
                        GC_INIT_CONF_TIME_LIMIT; \
                        GC_INIT_CONF_MAXIMUM_HEAP_SIZE; \
                        GC_init(); /* real GC initialization */ \
                        GC_INIT_CONF_ROOTS; /* post-init */ \
                        GC_INIT_CONF_IGNORE_WARN; \
                        GC_INIT_CONF_INITIAL_HEAP_SIZE; }

So you see it does GC_init().  That was not always the case in previous
versions, AFAIK.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 13:58           ` Andy Wingo
@ 2011-05-20 16:21             ` Hans Aberg
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Aberg @ 2011-05-20 16:21 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 20 May 2011, at 15:58, Andy Wingo wrote:

> Did you enable threads? `grep PTHREAD scmconfig.h` to check.

$ grep PTHREAD libguile/scmconfig.h
#define SCM_USE_PTHREAD_THREADS 1 /* 0 or 1 */
/* Define to 1 if need braces around PTHREAD_ONCE_INIT (for Solaris). */
#define SCM_NEED_BRACES_ON_PTHREAD_ONCE_INIT 0 /* 0 or 1 */
/* Define to 1 if need braces around PTHREAD_MUTEX_INITIALIZER
#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER 0 /* 0 or 1 */
#define SCM_HAVE_GC_PTHREAD_CANCEL 0 /* 0 or 1 */
#define SCM_HAVE_GC_PTHREAD_EXIT 0 /* 0 or 1 */
#define SCM_HAVE_GC_PTHREAD_SIGMASK 0 /* 0 or 1 */

> Here is the current definition of GC_INIT ():
> 
>    /* Portable clients should call this at the program start-up.  More     */
>    /* over, some platforms require this call to be done strictly from the  */
>    /* primordial thread.                                                   */
>    #define GC_INIT() { GC_INIT_CONF_DONT_EXPAND; /* pre-init */ \
>                        GC_INIT_CONF_FORCE_UNMAP_ON_GCOLLECT; \
>                        GC_INIT_CONF_MAX_RETRIES; \
>                        GC_INIT_CONF_FREE_SPACE_DIVISOR; \
>                        GC_INIT_CONF_FULL_FREQ; \
>                        GC_INIT_CONF_TIME_LIMIT; \
>                        GC_INIT_CONF_MAXIMUM_HEAP_SIZE; \
>                        GC_init(); /* real GC initialization */ \
>                        GC_INIT_CONF_ROOTS; /* post-init */ \
>                        GC_INIT_CONF_IGNORE_WARN; \
>                        GC_INIT_CONF_INITIAL_HEAP_SIZE; }
> 
> So you see it does GC_init().  That was not always the case in previous
> versions, AFAIK.

And adding it does not help.

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 10:11   ` Andy Wingo
  2011-05-20 10:52     ` Hans Aberg
  2011-05-20 11:31     ` Hans Aberg
@ 2011-05-21 12:58     ` Hans Aberg
  2011-05-21 17:20     ` Hans Aberg
  3 siblings, 0 replies; 12+ messages in thread
From: Hans Aberg @ 2011-05-21 12:58 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 20 May 2011, at 12:11, Andy Wingo wrote:

>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>> error:
>> 
>>  Failed to get stack base for current thread.
> 
> The code in question does this:
> 
>    void
>    scm_init_guile ()
>    {
>      struct GC_stack_base stack_base;
> 
>      if (GC_get_stack_base (&stack_base) == GC_SUCCESS)
>        scm_i_init_thread_for_guile (&stack_base,
>                                     scm_i_default_dynamic_state);
>      else
>        {
>          fprintf (stderr, "Failed to get stack base for current thread.\n");
>          exit (1);
>        }
>    }
> 
> As you can see we rely on libgc here, and so this is a libgc bug.

In the file libguile/threads.c, there is a GC_get_stack_base() defined, always returning GC_SUCCESS, if HAVE_PTHREAD_GET_STACKADDR_NP is defined. I changed both occurrences to GC_get_stack_base0, and get a linker error.

So what happens is that the linker gets hold of another GC_get_stack_base() in the bdwgc-7_2alpha5-20110107 package.

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-20 10:11   ` Andy Wingo
                       ` (2 preceding siblings ...)
  2011-05-21 12:58     ` Hans Aberg
@ 2011-05-21 17:20     ` Hans Aberg
  2011-06-17  9:26       ` Andy Wingo
  3 siblings, 1 reply; 12+ messages in thread
From: Hans Aberg @ 2011-05-21 17:20 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 20 May 2011, at 12:11, Andy Wingo wrote:

>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>> error:
>> 
>>  Failed to get stack base for current thread.

> As you can see we rely on libgc here, and so this is a libgc bug.  Can
> you try a newer libgc, or if that still fails, bring it up on their
> list?

One must take down the CVS version, and building with threads say by using
  ./configure --enable-threads=posix && make

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-05-21 17:20     ` Hans Aberg
@ 2011-06-17  9:26       ` Andy Wingo
  2011-06-17 15:58         ` Hans Aberg
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Wingo @ 2011-06-17  9:26 UTC (permalink / raw)
  To: Hans Aberg; +Cc: bug-guile bug

On Sat 21 May 2011 19:20, Hans Aberg <haberg-1@telia.com> writes:

> On 20 May 2011, at 12:11, Andy Wingo wrote:
>
>>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>>> error:
>>> 
>>>  Failed to get stack base for current thread.
>
>> As you can see we rely on libgc here, and so this is a libgc bug.  Can
>> you try a newer libgc, or if that still fails, bring it up on their
>> list?
>
> One must take down the CVS version, and building with threads say by using
>   ./configure --enable-threads=posix && make

Thank you for tracking this down.  There should be a new libgc snapshot
very shortly.  (One would hope for an actual 7.2 release, but hey.)

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7
  2011-06-17  9:26       ` Andy Wingo
@ 2011-06-17 15:58         ` Hans Aberg
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Aberg @ 2011-06-17 15:58 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile bug

On 17 Jun 2011, at 11:26, Andy Wingo wrote:

>>>> On Mac OS X 10.6.7, compiled using Xcode Version 3.2.6 64-bit,
>>>> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, scm_init_guile() gives the
>>>> error:
>>>> 
>>>> Failed to get stack base for current thread.
>> 
>>> As you can see we rely on libgc here, and so this is a libgc bug.  Can
>>> you try a newer libgc, or if that still fails, bring it up on their
>>> list?
>> 
>> One must take down the CVS version, and building with threads say by using
>>  ./configure --enable-threads=posix && make
> 
> Thank you for tracking this down.  There should be a new libgc snapshot
> very shortly.  (One would hope for an actual 7.2 release, but hey.)

Actually, the --enable-threads=posix is unnecessary on Mac OS X (which now is changing name to OS X, it seems), that is, for the CVS version at the time. There is a now a snapshot gc-7.2alpha6.tar.gz from 14-Jun-2011, so that should work - we discussed it in May.

Hans





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-06-17 15:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87aafb2w68.fsf@gnu.org>
2011-05-15 10:56 ` Guile 2.0.1: scm_init_guile() broken on Mac OS X 10.6.7 Hans Aberg
2011-05-20 10:11   ` Andy Wingo
2011-05-20 10:52     ` Hans Aberg
2011-05-20 11:31     ` Hans Aberg
2011-05-20 13:10       ` Andy Wingo
2011-05-20 13:39         ` Hans Aberg
2011-05-20 13:58           ` Andy Wingo
2011-05-20 16:21             ` Hans Aberg
2011-05-21 12:58     ` Hans Aberg
2011-05-21 17:20     ` Hans Aberg
2011-06-17  9:26       ` Andy Wingo
2011-06-17 15:58         ` Hans Aberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).