Ok, here are the notes I have on how to get OpenDX running (but with same
 memory problems you already see) on MacOS X and Darwin under XFree86.
Some of this stuff is trivial, but I put it here to be complete anyway. A few of the fixes are for Darwin or XFree86 includes. I'm sure I've forgotten some stuff, but
these are the most important fixes. I could do diffs if you want.

preparation of the system:

    1. need to install developer's CD
    2. install recent version of automake from gnu
    3. Get OpenMotif source from Logan Donaldson and
        compile the libs (it breaks before it's completely done,
        but all the necessary libs are generated).
    4. install XFree86 or other X support

changes to the source:

    1. dx/src/exec/dxmods (import_ss.c)  isnum conflicts
        with definition in ctypes.h, fix all instances:

         static Type isnum(char *p, int *d, float *f);

    2. dx/src/exec/dpexec loader.c using default DXunloadObj
        but need to add char *envvar to end of arg list:

        Error DXUnloadObjFile(char *fname, char *envvar)
     ***   This will have to be changed to enable loadable modules. ***

     3. Added "darwin"  arch type to acinclude.m4:
            ....
            elif test $unameS = "Darwin" ; then
              ac_cv_dx_arch=darwin

          also chose BSD-like options at bottom of file.
          Don't know if they are correct yet, but it's a start:

              if test $ARCH = "darwin" ; then
                DX_RTL_CFLAGS="-D_GNU_SOURCE -Ddarwin"
                DX_RTL_LDFLAGS="--shared "
                DX_RTL_DXENTRY="-eDXEntry"
        fi

     4.  needed to touch /usr/include/malloc.h to fool config into
          thinking malloc.h is there. It's apparently built into the
          system, so  no .h is actually needed.

     5. dx/src/exec/dxmods/_compoper1.c

       #ifdef darwin
       #define trunc(x) ((float)((int)(x)))
        #endif

     6. touch /usr/include/stream.h (another built-in?)

7. (XFree86 fix) comment out XWMGeometry(...) in /usr/X11R6/include/X11/Xutil.h

        #if 0   /* REG! */

        extern int XWMGeometry(
        #if NeedFunctionPrototypes
            Display*            /* display */,
            int                 /* screen_number */,
            _Xconst char*       /* user_geometry */,
            _Xconst char*       /* default_geometry */,
            unsigned int        /* border_width */,
            XSizeHints*         /* hints */,
            int*                /* x_return */,
            int*                /* y_return */,
            int*                /* width_return */,
            int*                /* height_return */,
            int*                /* gravity_return */
        #endif
        );

        #endif

  8.  (Logan-specific OpenMotif fix, see Readme.darwin in that distro)
        Add -lwcs -llanginfo to the makefiles:

          LIBS = -ldpstk -ldps -lz -lm -lSM -lICE -lXm -lwcs -llanginfo
                       -lXp -L/usr/X11R6/lib -lGL -lm -lXext -lXt -lX11
                       -lSM -lICE -L/usr/X11R6/lib -lpthread
        in
               dxui makefile
               prompter makefile
               builder makefile
               tutor makefile
               etc.

         9. dxuilib/PacketIF.C:

#if !defined(linux) && !defined(cygwin) && !defined(freebsd) && !defined(darwin)
          extern int errno;
           #endif

       10. in startup/StartupWindow.C

#if defined(ibm6000) || defined(hp700) || defined(alphax) || defined(sun4) || defined(linux) || defined(cygwin) || defined(freebsd) || defined(darwin)
        #define USE_WAIT3 1
        #endif

11.  In  dxworker.in

         case Darwin:
        set exarch=darwin
        set uiarch=darwin

        set remote=/usr/bin/rsh

         breaksw

        #
        # check system version
        #
        switch ( $uiarch )

        ... stuff omitted ...

          case darwin:
        breaksw

12. dx/src/uipp/base/UIConfig.h

#if defined(sgi)
# define EXECVE_2ND_TYPE char **
#elif defined(hp700) || defined(aviion) || defined(ibm6000) || defined(solaris) || defined(alphax) || defined(linux) || defined(freebsd) || defined(darwin)
# define EXECVE_2ND_TYPE char * const*
#else
# define EXECVE_2ND_TYPE const char **
#endif

#if defined(sun4) || defined(sgi)
# define EXECVE_3RD_TYPE char **
#elif defined(hp700) || defined(aviion) || defined(ibm6000) || defined(solaris) || defined(alphax) || defined(linux) || defined(freebsd) || defined(darwin)
# define EXECVE_3RD_TYPE char * const*
#else
# define EXECVE_3RD_TYPE const char **
#endif

********** now for /src/exec/dxlib/memory.c  ***********

Here are the parts I am more confident of:

1. necessary includes:

#if darwin
#include <mach-o/ldsyms.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#endif

2. must hide "extern int end;" statements from darwin
    (see man get_end) ... just need to rearrange a few
    #ifdefs appropriately.

3. calculate physmem

#if darwin

        int mib[2], pmem;
        size_t len;

        mib[0] = CTL_HW;
        mib[1] = HW_PHYSMEM;
        len = sizeof(pmem);
        sysctl(mib, 2, &pmem, &len, NULL, 0);

        physmem = (uint)((double)pmem/(1024.0*1024.0));

#endif


Richard



Reply via email to