Discussion:
[PATCH] Use -pthread on OpenBSD
Donovan Watteau
2011-07-05 18:18:09 UTC
Permalink
On OpenBSD, the -pthread option should be used instead of -lpthread to
link threaded code.

See:
http://www.openbsd.org/cgi-bin/man.cgi?query=gcc-local&format=html
---
scripts/checks.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/checks.sh b/scripts/checks.sh
index c2f048f..64cbbf3 100644
--- a/scripts/checks.sh
+++ b/scripts/checks.sh
@@ -639,6 +639,12 @@ check_x11()
# adds PTHREAD_CFLAGS and PTHREAD_LIBS to config.mk
check_pthread()
{
+ case `uname -s` in
+ OpenBSD)
+ PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
+ ;;
+ esac
+
for __libs in "$PTHREAD_LIBS" -lpthread -lc_r -lkse
do
test -z "$__libs" && continue
--
1.7.5
Gregory Petrosyan
2011-07-05 20:53:19 UTC
Permalink
Post by Donovan Watteau
On OpenBSD, the -pthread option should be used instead of -lpthread to
link threaded code.
http://www.openbsd.org/cgi-bin/man.cgi?query=gcc-local&format=html
Thanks a lot, merged!

Gregory
Johannes Weißl
2011-07-05 21:02:51 UTC
Permalink
Hello Donovan,
Post by Donovan Watteau
On OpenBSD, the -pthread option should be used instead of -lpthread to
link threaded code.
OpenBSD is the only one of the major BSDs that has no cmus package yet.
It would be cool to have one :-) (if it is possible now...).


Johannes
Donovan Watteau
2011-07-05 22:01:00 UTC
Permalink
Post by Johannes Weißl
Hello Donovan,
OpenBSD is the only one of the major BSDs that has no cmus package yet.
It would be cool to have one :-) (if it is possible now...).
Hi,

Well, actually, I've made one, and I even wrote a backend for sndio (which
is what the OpenBSD people use instead of ALSA / OSS / whatever).

I wrote it thanks to the sun.c backend and the patches which were written
for the other OpenBSD ports needing an sndio backend.

It seems to work nicely (I tested it on my 5 boxes running OpenBSD), but
I'm not much familiar with cmus' internals or with the way sndio really
works. So I think it'd need some review from the OpenBSD people and you :)

There are also some other problems -- I find OpenBSD's ports a bit
frustrating to use, compared to Slackware's SlackBuilds of ArchLinux's
PKGBUILD. I like OpenBSD's simplicity a lot, but I think their ports
system is really too much complicated. I'm still unsure about the way of
doing some things, and so I don't think I could maintain it.
But anyway, I think I'm going to post my "work in progress" on their ML
some day.

Actually, I wrote that about a year ago, but I'm only starting to have
some free time now...

Oh, and thanks for cmus, BTW. I like it so much. I've been using it for 5
years or something, and I really find it wonderful. And the code seems
excellent, I think I'm going to study it during my holidays (along with
tmux's sourcecode).

--
Donovan
Johannes Weißl
2011-07-05 22:09:25 UTC
Permalink
Hello Donovan,
Post by Donovan Watteau
Well, actually, I've made one, and I even wrote a backend for sndio (which
is what the OpenBSD people use instead of ALSA / OSS / whatever).
I wrote it thanks to the sun.c backend and the patches which were written
for the other OpenBSD ports needing an sndio backend.
Great, I wasn't aware of that (I thought they use something roughly
compatible to OSSv4?). If it works for you, you can just send in a
patch, since it won't break anything for anybody. We can than review it,
and people that have access to OpenBSD systems can test it!
Post by Donovan Watteau
There are also some other problems -- I find OpenBSD's ports a bit
frustrating to use, compared to Slackware's SlackBuilds of ArchLinux's
PKGBUILD. I like OpenBSD's simplicity a lot, but I think their ports
system is really too much complicated. I'm still unsure about the way of
doing some things, and so I don't think I could maintain it.
Well, I also thought about submitting a package, but since I only run
OpenBSD in a virtual box for testing, I'm probably not the right person
either...


Johannes
Donovan Watteau
2011-07-06 20:11:50 UTC
Permalink
Post by Johannes Weißl
Great, I wasn't aware of that (I thought they use something roughly
compatible to OSSv4?).
Actually they have some compatibility with OSS and SUN but they patch all
their ports to use sndio, from what I can see.
Post by Johannes Weißl
If it works for you, you can just send in a
patch, since it won't break anything for anybody. We can than review it,
and people that have access to OpenBSD systems can test it!
OK, but since I wrote this backend with what was written for some
other ports by the OpenBSD devs, I think I need to find their names first
(and I need to make sure there's no problem with the license).
Johannes Weißl
2011-07-06 20:23:50 UTC
Permalink
Hello Donovan,
Post by Donovan Watteau
Post by Johannes Weißl
If it works for you, you can just send in a
patch, since it won't break anything for anybody. We can than review it,
and people that have access to OpenBSD systems can test it!
OK, but since I wrote this backend with what was written for some
other ports by the OpenBSD devs, I think I need to find their names first
(and I need to make sure there's no problem with the license).
Hmm, that is of course true... I found something interesting here:
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html

So if the code is BSD licensed, it might be still possible to include it
in cmus (but since the document is pretty long, this sounds
complicated). Another option would be to base the code on GPLv2
software, or ask the Copyright holders if they agree the code to be
relicensed under GPLv2 (maybe the best option?).


Johannes
Donovan Watteau
2011-07-07 14:08:39 UTC
Permalink
Hi,
Post by Johannes Weißl
So if the code is BSD licensed, it might be still possible to include it
in cmus (but since the document is pretty long, this sounds
complicated). Another option would be to base the code on GPLv2
software, or ask the Copyright holders if they agree the code to be
relicensed under GPLv2 (maybe the best option?).
Well, I've contacted the author of the patch I used to write mine, and I'm
waiting for his reply. I guess I'll ask for some review from the OpenBSD
ports people as well, after that. I think it's better this way.

Of course, I'll keep you informed :)

Loading...