chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] PATCH: fix pthread on BSD


From: Christian Kellermann
Subject: Re: [Chicken-hackers] PATCH: fix pthread on BSD
Date: Sun, 2 Oct 2011 11:20:37 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Timo!

* Timo Myyrä <address@hidden> [110928 18:35]:
> BSD's seem to use -pthread flag instead of -lpthread to use POSIX threads.
> You can verify this by looking the -pthread flag from gcc man page of
> BSD systems.

Thanks for the patch! I would restrict this change of flags to
OpenBSDs (or gcc versions) older than 4.9 (or gcc 4.2.1 respectively)
since the 4.9 compiler *does* support this flag (despite its
documentation):

[11:16:20] address@hidden:/tmp
$ echo "int main(int a, char** b){}" > main.c  
[11:16:28] address@hidden:/tmp
$ gcc main.c -lpthread                         
[11:16:32] address@hidden:/tmp
$ ldd a.out                                    
a.out:
        Start    End      Type Open Ref GrpRef Name
        1c000000 3c004000 exe  1    0   0      a.out
        07ae3000 27aec000 rlib 0    1   0      /usr/lib/libpthread.so.13.1
        02292000 222c6000 rlib 0    1   0      /usr/lib/libc.so.58.0
        0be24000 0be24000 rtld 0    1   0      /usr/libexec/ld.so
[11:16:34] address@hidden:/tmp
$ gcc --version                                
gcc (GCC) 4.2.1 20070719 
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The patch still makes sense for architectures with older gcc versions.
I think we should test for it and wrap it then (this may also apply
to the -fwrap switch).

How do other BSDs deal with this?
I would prefer to divert from the "mainstream" flags as little as possible.

What do you think?

Kind regards,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]