[Chicken-users] Re: Strange segfaults when linking with pthreads

2011-03-03 Thread Aleksej Saushev
Peter Bex  writes:

> I've been observing something really strange for a while and decided to
> finally dig a little deeper.  It appears that when I link to libpthread,
> even if I don't use it, Chicken segfaults.

...

> I am currently very uncertain whether this is a bug in Chicken,
> libpthread on NetBSD, the combination of the two, or something else.
>
> HELP! ;)

You do remember that when you link against libpthread, you should build
and link everything you use against libpthread too. ;)


-- 
HE CE3OH...


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Strange segfaults when linking with pthreads

2011-03-03 Thread Felix
From: Peter Bex 
Subject: Re: [Chicken-users] Strange segfaults when linking with pthreads
Date: Thu, 3 Mar 2011 22:56:26 +0100

>> What does "LD_DEBUG=all csi ..." say?
> 
> Nothing. Is that a GNU libc-only option or something?

This should be ELF-specific. I thought it is supported, but looks
like it isn't.

> 
>> What happens when you run it in gdb?
> 
> It also segfaults.  I get this:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x7f7ffcd0b884 in pthread_exit () from /usr/lib/libpthread.so.0
> (gdb) bt
> #0  0x7f7ffcd0b884 in pthread_exit () from /usr/lib/libpthread.so.0
> #1  0x7f7ffcd0b9db in pthread__cancelled () from /usr/lib/libpthread.so.0
> #2  0x7f7ffcd0661c in select () from /usr/lib/libpthread.so.0
> #3  0x7f7ffd943694 in stub285 () from /usr/pkg/lib/libchicken.so

It seems that pthread is hooking into select(2), which is called by
the chicken runtime. I think this might be a bug in the pthreads library,
but perhaps the runtime is doing something with select that it shouldn't
do.

> 
> I get the same error on my server you have access to, if you would like
> to dig in yourself.

Thanks a lot. I will try looking for what call to select(2) causes
this with a debug build. Can you create a ticket for this?  (just so
we don't forget about it - discussions I rather do over e-mail)


cheers,
felix

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Strange segfaults when linking with pthreads

2011-03-03 Thread Peter Bex
On Thu, Mar 03, 2011 at 10:48:01PM +0100, Felix wrote:
> > I've been observing something really strange for a while and decided to
> > finally dig a little deeper.  It appears that when I link to libpthread,
> > even if I don't use it, Chicken segfaults.
> > 
> 
> What does "LD_DEBUG=all csi ..." say?

Nothing. Is that a GNU libc-only option or something?

> What happens when you run it in gdb?

It also segfaults.  I get this:

Program received signal SIGSEGV, Segmentation fault.
0x7f7ffcd0b884 in pthread_exit () from /usr/lib/libpthread.so.0
(gdb) bt
#0  0x7f7ffcd0b884 in pthread_exit () from /usr/lib/libpthread.so.0
#1  0x7f7ffcd0b9db in pthread__cancelled () from /usr/lib/libpthread.so.0
#2  0x7f7ffcd0661c in select () from /usr/lib/libpthread.so.0
#3  0x7f7ffd943694 in stub285 () from /usr/pkg/lib/libchicken.so
#4  0x7f7ffd943fe9 in f_523 () from /usr/pkg/lib/libchicken.so
#5  0x7f7ffd943954 in f_519 () from /usr/pkg/lib/libchicken.so
#6  0x7f7ffd9440ba in f_514 () from /usr/pkg/lib/libchicken.so
#7  0x7f7ffd944233 in f_484 () from /usr/pkg/lib/libchicken.so
#8  0x7f7ffd7b8089 in f_17762 () from /usr/pkg/lib/libchicken.so
#9  0x7f7ffd9b4fda in C_call_cc () from /usr/pkg/lib/libchicken.so
#10 0x7f7ffd7ca75d in f_17756 () from /usr/pkg/lib/libchicken.so
#11 0x7f7ffd8bda3e in f_1854 () from /usr/pkg/lib/libchicken.so
#12 0x7f7ffd9420ae in f_1289 () from /usr/pkg/lib/libchicken.so
#13 0x7f7ffd942191 in f_1286 () from /usr/pkg/lib/libchicken.so
#14 0x7f7ffd944334 in f_1343 () from /usr/pkg/lib/libchicken.so
#15 0x7f7ffd94447b in f_1282 () from /usr/pkg/lib/libchicken.so
#16 0x7f7ffd8bf2cf in f_1851 () from /usr/pkg/lib/libchicken.so
#17 0x7f7ffd77a2e0 in f_9996 () from /usr/pkg/lib/libchicken.so
#18 0x7f7ffd7cc04a in f_21060 () from /usr/pkg/lib/libchicken.so

 lots more of those ...

I get the same error on my server you have access to, if you would like
to dig in yourself.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Strange segfaults when linking with pthreads

2011-03-03 Thread Felix
From: Peter Bex 
Subject: [Chicken-users] Strange segfaults when linking with pthreads
Date: Thu, 3 Mar 2011 21:01:04 +0100

> Hello there,
> 
> I've been observing something really strange for a while and decided to
> finally dig a little deeper.  It appears that when I link to libpthread,
> even if I don't use it, Chicken segfaults.
> 

What does "LD_DEBUG=all csi ..." say?

What happens when you run it in gdb?


cheers,
felix

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Strange segfaults when linking with pthreads

2011-03-03 Thread Mario Domenech Goulart
Hi Peter,

On Thu, 3 Mar 2011 21:01:04 +0100 Peter Bex  wrote:

> I've been observing something really strange for a while and decided to
> finally dig a little deeper.  It appears that when I link to libpthread,
> even if I don't use it, Chicken segfaults.
>
> To reproduce this, put the following in a file called "foo.scm":
> (module foo *
>   (import chicken scheme)
>   ;; Just a lot of semi-random libraries here:
>   (use srfi-1 srfi-13 srfi-4 data-structures spiffy test)
>   (print "yo"))
>
> Then when I run
> $ csc -s -lpthread foo.scm
> $ csi
> CHICKEN
> (c)2008-2010 The Chicken Team
> (c)2000-2007 Felix L. Winkelmann
> Version 4.6.0 
> netbsd-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
> compiled 2011-01-21 on langly (NetBSD)
>
> #;1> (load "foo")
> ; loading foo.so ...
> ; loading /usr/pkg/lib/chicken/5/chicken.import.so ...
> ; loading /usr/pkg/lib/chicken/5/scheme.import.so ...
> ; loading /usr/pkg/lib/chicken/5/srfi-1.import.so ...
> ; loading /usr/pkg/lib/chicken/5/srfi-13.import.so ...
> ; loading /usr/pkg/lib/chicken/5/srfi-4.import.so ...
> [ETCETERA]
> ; loading /usr/pkg/lib/chicken/5/test.so ...
> yo
> #;2> zsh: segmentation fault  csi
>
>
> This appears to happen *only* on 64-bit platforms, I don't see it on
> my 32-bit powerpc mac.  The segfault is a bit elusive because it happens
> only after I load lots of libraries.  When csi is invoked with -e or
> with -q, I generally don't get the segfault as easily, so it probably
> has something to do with the garbage collector; when it generates many
> strings it needs to clean up it fails.  Or something :)

I cannot reproduce the problem on Linux:

$ csc -s -lpthread foo.scm

$ csi -n

CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.6.2 
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2010-10-11 on monster (Linux)

#;1> (load "foo")
; loading foo.so ...
; loading /home/mario/local/chicken-4.6.2/lib/chicken/5/chicken.import.so ...
; loading /home/mario/local/chicken-4.6.2/lib/chicken/5/scheme.import.so
...
; loading /home/mario/local/chicken-4.6.2/lib/chicken/5/sendfile.so ...
; loading /home/mario/local/chicken-4.6.2/lib/chicken/5/intarweb.so ...
; loading /home/mario/local/chicken-4.6.2/lib/chicken/5/base64.so ...
; loading /home/mario/local/chicken-4.6.2/lib/chicken/5/test.so ...
yo


Best wishes.
Mario
-- 
http://parenteses.org/mario

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Strange segfaults when linking with pthreads

2011-03-03 Thread Moritz Heidkamp
Hi Peter,

Peter Bex  writes:
> This appears to happen *only* on 64-bit platforms, I don't see it on
> my 32-bit powerpc mac.  

FWIW I don't get the segfault on 32-bit Linux 2.6.37 either (only when
loading the library twice but that's more or less expected). Other than
that I am absolutely clueless, too :-)

Moritz

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Strange segfaults when linking with pthreads

2011-03-03 Thread Peter Bex
Hello there,

I've been observing something really strange for a while and decided to
finally dig a little deeper.  It appears that when I link to libpthread,
even if I don't use it, Chicken segfaults.

To reproduce this, put the following in a file called "foo.scm":
(module foo *
  (import chicken scheme)
  ;; Just a lot of semi-random libraries here:
  (use srfi-1 srfi-13 srfi-4 data-structures spiffy test)
  (print "yo"))

Then when I run
$ csc -s -lpthread foo.scm
$ csi
CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.6.0 
netbsd-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2011-01-21 on langly (NetBSD)

#;1> (load "foo")
; loading foo.so ...
; loading /usr/pkg/lib/chicken/5/chicken.import.so ...
; loading /usr/pkg/lib/chicken/5/scheme.import.so ...
; loading /usr/pkg/lib/chicken/5/srfi-1.import.so ...
; loading /usr/pkg/lib/chicken/5/srfi-13.import.so ...
; loading /usr/pkg/lib/chicken/5/srfi-4.import.so ...
[ETCETERA]
; loading /usr/pkg/lib/chicken/5/test.so ...
yo
#;2> zsh: segmentation fault  csi


This appears to happen *only* on 64-bit platforms, I don't see it on
my 32-bit powerpc mac.  The segfault is a bit elusive because it happens
only after I load lots of libraries.  When csi is invoked with -e or
with -q, I generally don't get the segfault as easily, so it probably
has something to do with the garbage collector; when it generates many
strings it needs to clean up it fails.  Or something :)

You might wonder why I'm trying to link against libpthread, but that's
not really what I'm trying to do.  For example, svn-client links against
libsvn_client, which itself links to libpthread (through apr, I think).

If this segfault happens, I simply can't work on svn-client.

I am currently very uncertain whether this is a bug in Chicken,
libpthread on NetBSD, the combination of the two, or something else.

HELP! ;)

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Mac OS X Installation

2011-03-03 Thread Stephen Eilert
2011/3/3 Andrew Pennebaker :
> At http://wiki.call-cc.org/platforms#macports, users are instructed to
> install Chicken using MacPorts, then a caveat about a missing dylib file,
> then instructions for installing Chicken using Homebrew.
> Since MacPorts Chicken is broken, why not list the Homebrew option first.
> New schemers (myself included) will do the first option listed, nevermind
> that it's the more problematic one.

Probably just because Homebrew is newer and not many people use it
(compared to MacPorts).

But the homebrew install works fine at the moment (it installs 4.6.0).
I have even added an option to install Chicken from Git head - not
sure it made upstream. It will require a previous Chicken install, as
it is not aware of any bootstrapping requirements.



--Stephen

Sent from my Emacs

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Equivalent for Python's __name__?

2011-03-03 Thread Alan Post
On Thu, Mar 03, 2011 at 05:50:26PM +0100, Thomas Chust wrote:
> 2011/3/3 Andrew Pennebaker :
> > I'd like to find out my Chicken script name programmatically.
> > [...]
> 
> Hello Andrew,
> 
> program-name [1] is a built in parameter exported from the chicken
> library unit that returns the name of the currently executing program
> or script.
> 
> Ciao,
> Thomas
> 
> 
> [1] http://wiki.call-cc.org/man/4/Parameters#program-name
> 
> 

\o/

TIL.

-Alan
-- 
.i ma'a lo bradi ku penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Equivalent for Python's __name__?

2011-03-03 Thread Thomas Chust
2011/3/3 Andrew Pennebaker :
> I'd like to find out my Chicken script name programmatically.
> [...]

Hello Andrew,

program-name [1] is a built in parameter exported from the chicken
library unit that returns the name of the currently executing program
or script.

Ciao,
Thomas


[1] http://wiki.call-cc.org/man/4/Parameters#program-name


-- 
When C++ is your hammer, every problem looks like your thumb.

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Equivalent for Python's __name__?

2011-03-03 Thread Alan Post
(car (argv))

Is what I think you get.

-Alan

On Thu, Mar 03, 2011 at 11:38:53AM -0500, Andrew Pennebaker wrote:
>I'd like to find out my Chicken script name programmatically. Something
>like Python's __name__, or Perl/Ruby's $0 would be very helpful.
>Cheers,
>Andrew Pennebaker
>[1]www.yellosoft.us
> 
> References
> 
>Visible links
>1. http://www.yellosoft.us/

> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users


-- 
.i ma'a lo bradi ku penmi gi'e du

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Equivalent for Python's __name__?

2011-03-03 Thread Andrew Pennebaker
I'd like to find out my Chicken script name programmatically. Something like
Python's __name__, or Perl/Ruby's $0 would be very helpful.

Cheers,

Andrew Pennebaker
www.yellosoft.us
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Mac OS X Installation

2011-03-03 Thread Andrew Pennebaker
At http://wiki.call-cc.org/platforms#macports, users are instructed to
install Chicken using MacPorts, then a caveat about a missing dylib file,
then instructions for installing Chicken using Homebrew.

Since MacPorts Chicken is broken, why not list the Homebrew option first.
New schemers (myself included) will do the first option listed, nevermind
that it's the more problematic one.

Cheers,

Andrew Pennebaker
www.yellosoft.us
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users