[Top][All Lists]

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

[Gcl-devel] Re: Porting to NetBSD x86

From: Richard M Kreuter
Subject: [Gcl-devel] Re: Porting to NetBSD x86
Date: Sat, 18 Dec 2004 21:35:00 -0500
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (berkeley-unix)

Richard M Kreuter <address@hidden> writes:

> By randomly hacking on the FreeBSD and OpenBSD defs and headers, I
> can get part way through the build, but compiling the lisp files
> fails at gcl_sloop.lsp, with this error message and backtrace:
> | Error: The storage for STRING is exhausted.
> |        Currently, 30 pages are allocated.
> |        Use ALLOCATE to expand the space.

I should've googled more before sending the previous message.
Increasing the data size with the following shell command made this
problem go away:

$ ulimit -S -d 262144

There are a few other problems getting all the way through the build
of gcl cvs on NetBSD 2.0 on x86:

* When I include tcl/tk libraries in LIBS in h/NetBSD.defs, the link
  command for gcltkaux includes "libtk84.la", which doesn't make

| gcc -pipe -O2 -fwritable-strings -fomit-frame-pointer -DVOL=volatile
| -I/home/kreuter/lisp/impl/gcl/gclcvs/o -I/usr/local/lib/gcl-2.3/h
| -I../h -I/usr/pkg/include -I/usr/X11R6/include -fsigned-char
| -L/usr/pkg/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib
| -Wl,-R/usr/X11R6/lib guis.o tkAppInit.o tkMain.o -o gcltkaux
| -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -ltk84 libtk84.la -L/usr/X11R6/lib
| -Wl,-R/usr/X11R6/lib -lX11 -I/usr/X11R6/include -Wl,-R/usr/pkg/lib
| -L/usr/pkg/lib -ltcl84 `echo -lpthread -lm | sed -e s:-lieee::g` -lm
| -ltk84 -ltcl84 -lX11 -lXt -lintl -lcurses -lreadline -lpthread
| ../o/gcllib.a
| gcc: libtk84.la: No such file or directory

  I'm not too familiar with libtool; what's supposed to be going on
  here?  Removing ${TK_BUILD_LIB_SPEC} from the gcltkaux target in
  gcl-tk/makefile makes this problem go away, at any rate, and the tk
  binding still seems to work with this change.
* NetBSD doesn't ship with ncurses, but a curses library instead.
  This only becomes an issue when trying to build with readline
  support.  The rl_completion_matches test in configure fails, because
  "-lcurses" is needed.  Modifying the configure script makes this
  problem go away, but is obviously the wrong way to do things.

Anyhow, here are the NetBSD.defs and NetBSD.h files I've cobbled
together.  I've been able to build both gcl-2.6.5 and gcl-2.7.0 with
these files, given the local tweaking just mentioned.  There may be
unnecessary stuff in these files, but the resulting gcl seems to work.


-- NetBSD.defs --
# Machine dependent makefile definitions for intel 386,486 running 386bsd
# Ported to OpenBSD 2.7 by Justin Smith 
# 10/3/2000
# Modified a little for NetBSD 2.0 by Richard M Kreuter
# 12/18/2004

OFLAG   = -O2 -pipe
# As of tcl/tk in NetBSD's package system are at version 8.4.  intl is
# needed for gettext, curses is needed for readline, pthread is needed
# for tcl/tk.
LIBS    = -lm -ltk84 -ltcl84 -lX11 -lXt -lintl -lcurses -lreadline -lpthread 

# This CC string will be used for compilation of the system,
# and also in the compiler::*cc* variable for later compilation of
# lisp files.

# Since we're using pkgsrc's tcl/tk, use /usr/pkg/ include and lib,
# added gcc/ld flags for rpath locations of pkg and X11 libs.  -- RmK
CC = gcc -pipe -O2 -fwritable-strings -fomit-frame-pointer -DVOL=volatile 
-I$(GCLDIR)/o -I/usr/local/lib/gcl-2.3/h -I../h -I/usr/pkg/include 
-I/usr/X11R6/include -fsigned-char -L/usr/pkg/lib -L/usr/X11R6/lib 
-Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib

LDCC = $(CC)  -static -L/usr/local/lib -L/usr/X11R6/lib

#  Use the mp.s file on 68k machine 
MPFILES= $(MPDIR)/mpi-386.o $(MPDIR)/libmport.a

# Enable the fastloading mechanism which does not use ld -A
# requires c/rel_.. machine dependent code.
RSYM    = rsym
ifneq ($(findstring bfd,$(LIBS)),) 
RSYM    = 
ifneq ($(BUILD_BFD),) 
RSYM    = 
SFASL   = $(ODIR)/sfasl.o

# When using SFASL it is good to have (si::build-symbol-table)

# Use symbolic links


# the  make to use for saved_kcp the profiler.

-- NetBSD.h --
 * NetBSD.h for gcl 2.7 cvs, 18 Dec 2004.
 * This file began with the text of OpenBSD.h, and then started
 * mixing FreeBSD.h in.

/* We #include linux.h, which #includes bsd.h. */
/* #include "bsd.h" */

#ifndef __ELF__
#error NetBSD systems use ELF

#if !defined(ElfW)
#define ElfW(a) Mjoin(Elf,Mjoin(__ELF_NATIVE_CLASS,Mjoin(_,a)))
#define ELFW(a) Mjoin(ELF,Mjoin(__ELF_NATIVE_CLASS,Mjoin(_,a)))
/* OpenBSD needs sys/types.h included before link.h, which is included
   in linux.h */
#include <sys/types.h>
#if defined(HAVE_ELF_H)
#include <elf.h>
#elif defined(HAVE_ELF_ABI_H)
#include <elf_abi.h>
#include "linux.h"

#define LD_COMMAND(command,main,start,input,ldarg,output) \
  sprintf(command, "ld -dc -N -x -A %s -T %x %s %s -o %s", \


#if defined(__i386__)
#define __ELF_NATIVE_CLASS 32

#if defined(__i386__)
#define I386

/* we don't need to worry about zeroing fp->_base, to prevent what??? */

#undef HAVE_XDR

#define USE_ATT_TIME

#define LISTEN_FOR_INPUT(fp)                                    \
do {                                                            \
        int c = 0;                                              \
        if (                                                    \
                (fp)->_r <= 0 &&                                \
                    (ioctl((fp)->_file, FIONREAD, &c), c <= 0)  \
        )                                                       \
                return(FALSE);                                  \
} while (0)

#ifdef IN_GBC
#include <sys/types.h>

/* Undefine this here to get rid of some distracting, wordy warnings. */
#define DATA_BEGIN (char *) N_DATADDR(header);
#define A_TEXT_OFFSET(x) (sizeof (struct exec))
#define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
#define start_of_data() &etext
#define start_of_text() ((char *)(sizeof(struct exec) + getpagesize()))

#define UNIXSAVE "unexelf.c"
/*#undef UNIXSAVE
#ifdef UNIXSAVE 
 extern char etext;
#endif */

#define RELOC_FILE "rel_sun3.c" /* for SFASL - enabled in bsd.h */

/* Undefine this here to get rid of some distracting, wordy warnings. */
#undef HZ
#define HZ 128
#define ss_base ss_sp

/* begin for GC */
#define PAGEWIDTH 12            /* i386 sees 4096 byte pages */
/* end for GC */

#define SIG_STACK_SIZE (SIGSTKSZ/sizeof(double))
/* Undefine this here to get rid of some distracting, wordy warnings. */
/* First compile failed because estack_buf wasn't defined. */
  {                                        \
    static struct sigaltstack estack;      \
    double estack_buf[SIG_STACK_SIZE];             \
    estack.ss_sp = (char *) &estack_buf;           \
    estack.ss_size = SIGSTKSZ;                     \
    estack.ss_flags = 0;                           \
    if (sigaltstack(&estack, 0) < 0)               \
      perror("sigaltstack");                       \

/* Undefine this here to get rid of some distracting, wordy warnings. */
/* NetBSD uses only SIGSEGV only protection faults. */
         (void) gcl_signal(SIGSEGV, segmentation_catcher)
/*       (void) gcl_signal(SIGBUS, segmentation_catcher) */


#ifdef IN_GBC
#define GET_FAULT_ADDR(sig,code,sv,a) \
 ((siginfo_t *)code)->si_addr

 * The next two defines are for SGC,
 *      one of which needs to go in cmpinclude.h.

/* Begin for cmpinclude */
#define SGC     /* can mprotect pages and so selective gc will work */

/* End for cmpinclude */

/* This gets defined in linux.h, and is incorrect on NetBSD. Only used
   in gcl-tk/guis.c */
#define SET_SESSION_ID() (setpgrp(0,0) ? -1 : 0)

#if defined(IN_UNIXTIME)
# include <time.h>

reply via email to

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