Kenton Lee

Motif Development on Your Home PC

by Kenton Lee

September, 1995

Copyright © 1995 Kenton Lee, All Rights Reserved.

Many of you are professional Motif application developers. You're probably programming a UNIX workstation at work and have a IBM PC clone at home. On rare, or not so rare, occasions you may need to do some work at home. How, you might ask, can you do this?

I recently installed the Motif libraries and clients, the X11R6 libraries and clients, an X server, and a C++ compiler on my PC for under $150. While my 80486 CPU is no match for the mid-range RISC systems I usually use at work, performance is more than adequate for Motif application development. I've found this environment to be very helpful in my work.

In this month's column, I'll discuss ways to install a full Motif development environment on Intel 80386 or faster PC clones. I'll review the major choices you'll have to make, both in choosing products and in the installation procedure. I'll also recommend sources for more information. I'll also point you to additional on-line information sources, as a full tutorial would be too lengthy to present here.

Choosing an Operating System

X uses a client-server run-time environment, with many clients usually running simultaneously. This run-time environment requires a multi-tasking operating system like UNIX. Unfortunately, the MS-DOS and MS-Windows operating systems usually found on PC's don't qualify.

Since most of you are using UNIX-based operating systems at work, you'll probably want a similar operating system on your PC. There are three reasons for this:

  1. You don't want to have to learn a new OS user interface. PC UNIX operating system support all the popular UNIX shells and shell commands.
  2. You want a similar set of development tools. PC UNIX operating systems support the popular GNU C and C++ compilers, libraries, and debugging tools.
  3. Perhaps most importantly, you want a similar application programming interface (API). Your code from work will probably depend on various UNIX system calls and libraries and a UNIX operating system on your PC will minimize your porting problems. PC UNIX operating systems are generally POSIX-compliant, though different ones are oriented more towards System V UNIX or more towards BSD UNIX.

There are several popular UNIX-based operating systems for PC's. Some are commercial products, e.g.:

While these are probably good products, I ruled them out because they are designed (and priced) for multi-machine commercial installations.

The most popular home UNIX operating systems are:

All are being actively enhanced by dedicated teams of skilled developers. All are available free over the Internet and are also available on low cost CD-ROMs, which may be a more convenient choice. All are widely discussed on USENET (comp.unix.bsd.freebsd.*, comp.unix.bsd.netbsd.*, comp.os.linux.*, and comp.windows.x.i386unix). You might want to read through the news groups to see how the current user communities and their successes match your situation.

I chose Linux, mainly because it appears to be more widely supported than the others. In particular, Motif distributions for Linux are available from several vendors.

Hardware Requirements

The hardware requirements for a Linux-based Motif application development system are approximately the same as those for a MS-Windows development system:

A system with the above features can be had for under $2000 (a little more if you choose a 17" monitor). Even if you don't already own such a system, a new one is much less than the price of an entry-level UNIX workstation.

Linux Distributions

There are several ways to install Linux on your PC. While you could download and install the Linux kernel and various components individually, installing from a packaged distribution is much simpler (and much more likely to result in a working system). There are several packaged Linux distributions available, but the most popular is probably the Slackware distribution by Patrick Volkerding.

Slackware is also the best documented distribution. Several books have been written about Slackware, including Matt Welsh's excellent (and free) Linux Installation and Getting Started[Welsh], which is part of the Linux Documentation Project. Other excellent sources of information are the Linux "HOWTO" tutorials. Some commercial tutorial books are listed in the References section below.

The commercial books often include Slackware on a CD-ROM. Slackware CD-ROMs are also available separately from vendors such as InfoMagic, Morse Telecommunication, Pacific HiTech, S.u.S.E., Walnut Creek CD-ROM, and Yggdrasil Computing. As of this writing, the latest version of the Slackware Linux distribution is Version 2.3, released in May, 1995.

Slackware is also available free over the Internet. The major archive site for Slackware and other Linux software is sunsite.unc.edu. The archive is mirrored to several other sites around the world.

While other Linux distributions are probably also very good, I'll cover only Slackware at this time. Other distributions are similar and mostly compatible.

Note that Linux development is very distributed, with different groups developing different components simultaneously. While Slackware is updated regularly (a few times a year), it usually does not include the latest versions of everything. Patrick Volkerding tries to choose a collection of Linux components that work well together, and he is usually very successful. If you're the adventurous sort, you could try installing newer versions of certain components, but I think the typical user will be more satisfied with using standard Slackware distributions.

Slackware Installation

Installing any new operating system is a non-trivial undertaking, but the Slackware installation programs do a pretty good job of guiding you through the process. Slackware actually uses two installation programs. Both are called setup. The first setup program runs under MS-Windows. It helps you select your basic file system and kernel options then it boots up a core Linux kernel. The second setup program runs under Linux and installs and configures the rest of the Linux software.

The complete installation procedure is 100 pages of most of the Linux tutorials, so I can't present a thorough tutorial here. Instead, I'll just comment on some of the major options.

Slackware Linux supports two main file systems. The ext2fs file system is optimized for Linux and requires that you format a hard disk partition exclusively for Linux. Serious Linux users will probably want to do this. The installation programs do not automatically perform the partitioning, but the Linux tutorials discuss the procedure in detail.

If you just want to experiment with Linux, the UMSDOS file system may be a better choice. UMSDOS allows you to run Linux on top of a MS-DOS file system, without creating a separate Linux disk partition. While UMSDOS is slower than the native ext2fs file system, UMSDOS is much easier to install and (if necessary) de-install later.

The first, MS-Windows-based, setup program allows you to choose between the ext2fs and UMSDOS file systems. It also allows you to select your hardware device drivers, such as those for SCSI, Ethernet, and various proprietary CD-ROM interfaces.

The major function of the second, Linux-based, setup program is selecting the Linux software components to install on your system. Slackware is divided into a number of component sets called series. If you have a lot of disk space, you can install everything, but most people prefer to pick and choose. For an X development system, you'll need at least these series:

Within each series, required components are installed automatically, but you have the option of installing several optional components. Most of the choices are for your personal preferences (e.g., vi vs. emacs), but do choose the optional kernel source code package. This includes header files that are commonly used in application development. Note that if you forget something, all series except the base system can be installed or re-installed later.

Finally, you'll get to choose how Linux is booted on your system. Most users still want to be able to run MS-DOS (or another operating system) some of the time. The LILO tool allows you to choose your operating system at boot time, thus allowing you to jump straight into Linux. Alternatively, the loadlin tool allows you to boot Linux from MS-DOS, which is more convenient if you still mainly use MS-DOS.

X Server and Libraries

As mentioned above, Slackware's Series X includes the XFree86 system. Slackware 2.3 uses XFree86 version 3.1.1, which is based on the X Consortium's X11R6 release.

Before you execute the X server, you must configure it for your video display adapter and your monitor. This is probably the most complicated part of installing Motif on your PC. There are a lot of parameters to set here and you must get them all right or risk damaging your hardware.

The xf86config program, which is part of XFree86, helps you through the configuration. The program contains a database of popular hardware and the configuration is fairly easy if your hardware is listed. If not, you'll have to dig through your manuals for your hardware's specifications.

Recent Linux tutorial books include good tutorials on configuring XFree86 and the Linux HOWTO on XFree86 is very good.[XFree86-HOWTO] Greg Lehey wrote another good tutorial for the Linux Journal.[Lehey]

Note that XFree86 version 3.1.2 was recently released. It includes support for some recent video display adapters and includes some bug fixes in the libraries. If you have trouble with version 3.1.1 or just like using the latest and greatest, you might want to install this instead.

Motif

Several Motif packages are available for Linux. Some vendors are:

Recent packages are based on Motif 2.0 and include the Motif libraries and basic clients like the mwm window manager and the UIL compiler. The CD-ROM based packages also include the complete OSF documentation package (man pages and PostScript manuals), as well as a variety of standard demo and contributed software.

Since Motif is not freeware like Linux and the X Window System, this will probably be the most expensive software in your initial Linux installation. Prices for Motif packages start at about $100 (including some amount of support).

Personally, I bought the InfoMagic CD-ROM package. It installed easily. There are a few bugs, but it usually works fairly well.

I haven't personally tried the other Linux Motif packages, but Bogdan Urma reviewed two others in the Linux Journal.[Urma] Metro Link has been in the business the longest and is probably the best respected of the vendors, though they are the most expensive. The last four packages on the list are reportedly very similar, all being based on the Lasermoon libraries, but with different packaging and support files.

Here are some potential problem areas associated with the InfoMagic Motif package (and probably most of the other packages):

ELF vs. a.out

You may have noticed that the ELF executable file format is currently being heavily discussed in the Linux USENET news groups. I would recommend staying away from ELF for now.

Linux is in the process of transitioning from the old a.out binary format to the more flexible ELF format, but the transition is not yet complete. For example, the ELF support in most Motif packages is currently of poor quality. Hopefully, when ELF becomes fully supported by Linux, tools to gracefully convert systems to ELF will be available.

Note that Slackware currently installs an a.out system by default.

Other X Utilities

Since Linux has a standard X and UNIX API, most standard X utilities should port easily to Linux. Many are already ported to Linux and are available in binary form in the Slackware distributions: e.g., TCL/Tk, xv, GNU emacs, ghostscript/ghostview, InterViews, XPM, fvwm, even DOOM (yes, the DOS game). Others, such as those from GNU, have a Linux option in their Makefiles, so compiling them on Linux is easy.

Several companies are also selling commercial X tools for Linux. For example, Metro Link and Evans and Sutherland sell OpenGL implementations for Linux. Also, Metro Link and X Inside sell custom X servers for Linux. These support some video cards not supported by XFree86 and may provide better performance than those that are supported by XFree86.

Conclusion

I installed Linux, XFree86, and Motif on my PC with about one full day of work. It cost me just $140 ($100 for Motif, $40 for a tutorial book with Slackware CD-ROM) to add install on my existing PC. Even if you choose to buy a PC, however, a $2500 Linux system will be very performance-comparable with low-end RISC workstation.

The XFree86 and Motif packages have the exact same user interface and API as what you'd find on other UNIX systems. If you port your Motif applications to Linux, you'll probably find that the Motif port is trivial. I frequently write Motif demo programs and port them between Linux and other UNIX systems. Most of these programs compile and run identically on all the systems. Even large programs like NCSA Mosaic compile and run on Linux with no problems.

Different versions of UNIX behave slightly differently, of course. Linux uses the popular GNU compilers and libraries, so you shouldn't find any surprises there. Other libraries may vary slightly from other versions of UNIX, but I haven't found this to be a problem. Linux is generally compatible with POSIX and System V UNIX.

In this column, I've discussed the major issues involved in installing a full Motif development environment on a PC system. I've also outlined the procedure to installing Linux. This is not a step-by-step installation tutorial, of course. There are many detailed tutorials available and I'd recommend that you read one (or more) before attempting to install Linux and XFree86.

Acknowledgments

I'd like to thank the following Linux programmers for reviewing drafts of this column and suggesting additions and corrections:

Update

This paper was originally written during the summer of 1995. A 1996 update is available.


References

[Hardware-HOWTO]
Linux Hardware Compatibility HOWTO.
[Lehey]
Greg Lehey, "Configuring XFree86 for Trouble-free Monitor Performance," The Linux Journal, July, 1995.
[Urma]
Bogdan Urma, "Product Review: Motif for Linux," The Linux Journal, July, 1995.
[Welsh]
Matt Welsh, Linux Installation and Getting Started. Versions of this document have also been published in book from by SSC, O'Reilly, and Yggdrasil.
[XFree86-HOWTO]
Matt Welsh, The Linux XFree86 HOWTO.

Some general Linux tutorial books (in alphabetical order by author):


Appendix: Some Linux Links

A wide variety of Linux material is available over the World Wide Web, including all of the source code and much documentation. The documentation is updated regularly and is generally very helpful well written. Here are some interesting sites to visit:


Ken Lee is an independent software consultant specializing in X Window System application software. He has been developing UNIX graphical user interface software since 1981. Ken may be reached by Internet electronic mail at kenton @ rahul.net or on the World Wide Web at http://www.rahul.net/kenton/.

Ken has published over two dozen technical papers on X software development. Most are available over the World Wide Web at http://www.rahul.net/kenton/bib.html.