|
From: | Peter Cooper |
Subject: | Fixing threading on NetBSD |
Date: | Tue, 24 Jun 2003 12:13:52 +0200 |
User-agent: | Mutt/1.4i |
Hi everyone I'm hoping to get some feedback on a couple of very small mods that were needed to get NetBSD back up to speed with GNUstep. One of the things that I need is thread support. While I was looking at that, I noticed a couple of other things that bugged me ;) I'm quite interested in whether this helps users of NetBSD on non-i386 platforms. Some of the changes here may help OpenBSD people in getting threading working... First off, I'm using the following packages from pkgsrc: gmake-3.79.1nb1, libiconv-1.8, jpeg-6b, png-1.2.4, tiff-3.5.7, ffcall-1.8.4, libxml2-2.4.24nb1, gmp-4.1, and pth-2.0.0 (there may be more dependencies, but these are the ones I recall). I'm using gcc version 2.95.3, which shipped with my OS distribution. Due to the unusual (for Linux people at least ;) way of placing pkg libraries into /usr/pkg/lib and so on, a little more support (-R paths) was required in make and base at config-time so that dynamic linking works properly during tests (see attached patches make-configure.ac-patch, base-configure.ac-patch). The same was true at runtime for X11-related packages (see the second part of the attached make-target.make-patch). I stronly suggest applying these as users will then not need to modify their /etc/ld.so.conf files. Every time I did a point release upgrade of NetBSD, without changing a working GNUstep environment, I'd have to recompile all of the binaries, or do funky symlinks in the object directories as the operating system identifier in GNUstep also included the NetBSD version number. A small fix for this is in the make-cleanos-patch file attached, which assumes that GNUstep binaries between different NetBSD versions will run unchanged. I think this is a workable assumption. Since the legacy objc libraries are a little broken, after first installing the makefile package and sourcing the environment, it was time to build and install the GNUstep libobjc to get ffcall support (for DO) and perhaps threading. To get the dev-apps/libobjc (btw: why is it not in dev-libs?) library to support pth 2.0, a GNU co-operative threading library that has its' own semantics as well as some POSIX support, I needed to modify thr-posix.c a little. I applied the very small change attached to this mail to thr-posix.c - NetBSD doesn't have any real sched_* support right now, and certain optional POSIX threading capabilities are missing, like priority scheduling, so a couple of things needed to be wrapped in an #if structure. To do this without breaking other platforms, I've copied thr-posix.c to thr-pth.c and applied the attached patch, libobjc-pth-patch. To support this, I also applied a patch to the makefile so that the right support file was used: libobjc-mf-patch. [This is fairly ugly, and I'm not sure how this can be rolled into the GNUstep libobjc distribution, primarily because of the awful sched_* brokenness in production releases of NetBSD. Suggestions?] Anyway, after this was installed, I reconfigured the makefile package with --with-thread-lib="-lpthread". The first part of the previously mentioned target.make patch differs from other platform support of threading a little; if you link pth into thread-unaware c source (ctools like gdomap, for example), there is an automatic core-dump when doing network IO. So, to avoid linking libpthread to ctools and so on, rather than adding the threading library options to TARGET_SYSTEM_LIBS, I added them to AUXILIARY_OBJC_LIBS. NSThread seems to work fairly well now, gdomap doesn't core dump, and I'll be looking at getting GNUmail soon. I'd very much like the non-controversial bits of these patches added to the distribution, but I'm a bit concerned that some of the changes are fairly different/ugly. Are there better ways to get some of these things working? Comments and commit announcements ;) would be very welcome. Peter
make-cleanos-patch
Description: Text document
make-target.make-patch
Description: Text document
make-configure.ac-patch
Description: Text document
libobjc-pth-patch
Description: Text document
libobjc-mf-patch
Description: Text document
base-configure.ac-patch
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |