Subject: Building GNUstep shared on NetBSD?
To: None <netbsd-help@netbsd.org>
From: David Wetzel <dave@turbocat.de>
List: netbsd-help
Date: 01/23/2000 17:28:11
Hi,

unfortunately, most of the GNUstep hackers are using Linux. Some are using  
Solaris and very few FreeBSD.
I can write programs using the GNUstep libs, but I cannot us threads [see my  
other mail] and the resulting programs are huge because all attempts to  
build it shared on NetBSD failed.

To get the latest GS sources do this:

     $ CVSROOT=:pserver:anoncvs:@cvs.net-community.com:/gnustep
     $ export CVSROOT
     $ cvs login (password anoncvs)
     $ cvs -z3 checkout core

in .../core/make/target.make, you can set the link and cc options. My latest  
attempt was:

(....)

####################################################
#
# NetBSD
#
ifeq ($(findstring netbsd, $(GNUSTEP_TARGET_OS)), netbsd)
# This is disabled temporarily, because I don't know exactly how
# to link shared libs. Everything seems to link correctly now but
# constructor functions in the shared lib failed to get called
# when the lib is loaded in. I don't know why. ASF.

# (At least on FreeBSD a.out c++rt0.o just has to be linked first.  -nox)
HAVE_SHARED_LIBS        = no
 SHARED_LD		= ld
 SHARED_LIB_LINK_CMD     = \
         $(SHARED_LD) -x -Bshareable -Bforcearchive \
           -o $(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE) /usr/lib/c++rt0.o $^;\
         (cd $(GNUSTEP_OBJ_DIR); \
           rm -f $(LIBRARY_FILE); \
           $(LN_S) $(VERSION_LIBRARY_FILE) $(LIBRARY_FILE))

SHARED_CFLAGS   += -fPIC
SHARED_LIBEXT   = .so

HAVE_BUNDLES    = yes
BUNDLE_LD	= $(CC)
BUNDLE_CFLAGS   += -fPIC
BUNDLE_LDFLAGS  += -shared
#ADDITIONAL_LDFLAGS += -rdynamic
endif
#
# end NetBSD
#
####################################################

(...)

This builds the lib but any resulting program dumps core...

The one who figures out the correct settings gets a botte of Bordeaux  
Superior vine incl Shipping.

---
   _  _
 _(_)(_)_  David Wetzel, Turbocat's Development,
(_) __ (_) Buchhorster Strasse 23, D-16567 Muehlenbeck/Berlin, FRG,
  _/  \_   Fax +49 33056 82835 NeXTmail dave@turbocat.de
 (______)  http://www.turbocat.de/
           DEVELOPMENT * CONSULTING * ADMINISTRATION