115) How do I build Motif 1.2.2 on Solaris 2.1 with Sun C?

[Last modified: May 93]

Prepared by Ric Steinberger.  ric@updike.sri.com  4/09/93

What follows is a description of the steps I used to build Motif 1.2.2 on a
SUN IPX running Solaris 2.1.  Sun's C compiler (2.0.1) was used.  Many thanks
go to Kaleb Keithley (kaleb@devvax.jpl.nasa.gov) for several useful
suggestions.  Other people, including OSF staff, especially David Brooks
(dbrooks@osf.org), helped as well.  My thanks to you all.

1. Build X11R5 from the mit distribution.  You need to retrieve the sources
   from export.lcs.mit.edu (in pub/R5) and patches 1 - 22 (or 23) (in
   pub/R5/fixes).  There are several other sites that contain the X11R5
   sources.  After installing patch 19, apply PEXlib.tar.Z, also available
   from export.lcs.mit.edu in pub/R5/fixes.  You can apply also
   R5.Xsun.multi-screen and R5.SunOS5.patch.  There are .README files
   that explain how to patch.  Be SURE to read
   R5.SunOS5.patch.README for details on how to BUILD X11.  You probably
   want to use the ProjectRoot feature in the site.def file in the
   mit/config directory.  You will NEED to edit that file to do that.

2. Obtain the Motif 1.2.2 distribution from OSF (617-621-7300).  You may
   need to first install the 1.2 tape, then the 1.2.1 and finally the
   1.2.2 tape.  You might want to do a "chmod -R u+w ." after unloading
   each tape.

3. In the config directory, there are several changes.  Some of the changes
   are based on R5.SunOS5.patch files.  A complete set of config files
   relevant to Solaris have been placed in the anon-ftp account of
   updike.sri.com in pub/motif/solaris21-motif122-config.tar.Z.  They are
   also available from OSF on their mail response server (available to
   support contract holders) and they will send them directly to full
   support contract holders.  Decompress and untar this file in your Motif
   config subdirectory.  Copy site.def.sample to site.def, then edit
   site.def.  You will probably want to uncomment the ProjectRoot section
   and use the same value used in your X11R5 build.  Also, you will probably
   want to use /usr/ucb/install in you installed the UCB compatibility
   suite.  Otherwise you might want to use the install supplied at the end
   of this memo.  [I used the UCB version and can't swear that this works.
   Bit it should.  Put it someplace like /usr/local/bin and chmod +x it.]

   There are two patches to consider.  One fixes a cursor problem
   in ./lib/Xm/TextF.c.  The other removes a Berkeleyism.  These
   patches should probably be consider unofficial at present.
   Failure to deal with the Berkeleyism (bzero) means you will need to
   link with -lucb -lelf.  This will probably work, but why bother?
   Furthermore, if you move the Motif binaries to a machine without
   the ucb compatability suite, you won't have the sharable libs you need.

[The actual patches have been censored because they contain OSF source code]

   Patch 1: In TextF.c there are several places _XmTextFieldDrawInsertionPoint
is called. These should be moved two or three lines further down *after* the
"if (!XtIsRealized(tf)) return True;" statement.

   patch 2: The call to bzero in lib/Xm/Visual.c should be replaced by the
equivalent call to memset

    Both these patches can be applied in the ./lib/Xm directory.
    If you don't have the patch program (how did you build X11?),
    you can get it in the vendor/cygnus directory of ftp.uu.net,
    or you can build it from source.  Be sure to get the latest
    version (2.0.12.u8).

4) Use the README-1.2.1 file as a guideline for building motif.  I followed
   directions in the section called, "Using X11R5 Installed Libraries
   and Header Files."  If you make a mistake after your first build
   attempt, copy Makefile.ini to Makefile before retrying.  You may
   need to do this in the config subdirectory too, depending on what
   went wrong.

5) After make Makefiles, do make includes, make depend, then make (or
   as OSF recommends, make -k).  This gets as far as motifshell in the
   demos, which fails to build because O_RDONLY and L_XTND are
   not defined.  O_RDONLY is in fcntl.h (actually <sys/fcntl.h>, but
   fcntl.h includes this.)  L_XTND can be replaced by SEEK_END.
   SEEK_END is in stdio.h.  These two fixes will allow motifshell to build.
   Note: many MANY compiler warning messages will be generated during
   the build process.

6) You can go to the demos/xmsamplers directory and do a make there.
   Other demos may build, or not depending on whatever. . . .

7) make install will do the install.  [It will fail at motifshell
   if you don't fix it, as mentioned above.]  You can do a make install
   in demos/xmsamplers if you want these.

8) If running on a SUN (as opposed to an X term), you will (probably) need
   to start openwin with something like:

        openwin -server /usr/X11R5/bin/Xsun

   [You might want to use an alias for this.]
   This fixes an annoying problem: The mouse keys stop working after you
   click on an icon to get the icon menu (on SUNs only, not X terms).
   The ALT keys still work, if you get stuck.  I don't know whether this
   is a bug in SUN's server or whether it is Motif related.

   Here is a copy of my .xinitrc:  It's not elegant.  Sun's default
   openwin startup file is in: /usr/openwin/lib/Xinitrc.  You can
   copy this to ~/.xinitrc and customize as desired.  Obviously, the
   default behavior is to start the OpenLook environment (boo!).

# .xinitrc - OpenWindows startup script.
if [ -f $HOME/.Xdefaults ]; then
    xrdb $HOME/.Xdefaults              # Load Users X11 resource database
if [ -f $HOME/.Xdefaults.sun ]; then
    xrdb -merge $HOME/.Xdefaults.sun
export DISPLAY
xhost + > /dev/null
#xterm -sb -sl 512 -T `hostname` -ls -n `hostname` &
xterm -sb -sl 512 -T `hostname` -n `hostname` &
mwm &
xclock -geometry +1010+0 &
xload -geometry +710+5 -fg red &
xsetroot -solid salmon &
xterm -sb -sl 100 -T CONSOLE_DO_NOT_LOGOUT -C -n console -iconic

Here's .Xdefaults.sun, which gives me a more readable font for use with
motif on Sun monitors:

!Some additional .Xdefaults values specifically for SUN
! After loading .Xdefaults, xrdb -merge .Xdefaults.sun
Mwm*fontList:           8x16
!Mwm*fontList:          vtbold
!Change as desired.

     You will probably want to maintain LD_LIBRARY_PATH to something like:
/usr/openwin/lib.  If you use emacs, you will need to leave /usr/openwin/lib
there.  [This is because you probably, like me, used the distributed version
of s-sol2.h, which explicitly refers to windowing libraries as being in the
/usr/openwin locations.  Yes, I know that emacs/Solaris ought to allow
LibXt.so.N.M to be "picked up" from elsewhere, like /usr/X11R5/lib, but the
one emacs links with is LibXt.so.4.something, and the mit one is
LibXt.so.5.something.  So it seems to want the .4 one.  Any comments?  I'd
prefer not to rebuild emacs based on the X11R5 libs because I occassionally
need to move the emacs binaries to machines without the mit files.]
Go Back Up

Go To Previous

Go To Next