Retrocomputing: Motif and CDE

Retrocomputing: Motif and CDE

By Jeff Tranter


In this blog post, we'll look at a couple of older graphical user interface toolkits that were popular in the 1980s and 1990s.

Why would anyone care about old software like this? One reason is purely for nostalgia, particularly if you used these systems back in the days when they were state-of-the-art. They can also provide a glimpse into how early graphical user interfaces worked, and how they influenced today's systems. Another possibility is that you have a legacy application that you need to continue to support, but need to move off of obsolete hardware (such as a UNIX workstation or server) and onto a more modern hardware platform (such as a Linux-based desktop).

Finally, while expensive at the time, these older systems ran on what would now be considered very limited resources as far as CPU, memory, screen resolution and file storage. The software might be suitable for running on current low-cost hardware like the Raspberry Pi or BeagleBoard or on embedded systems.


Motif (1) is both a standard for a graphical user interface as well as a widget toolkit. Written in the C programming language, it runs on the X Windowing System. It includes a window manager and development tools. In the 1980s, Motif was the standard user interface on UNIX systems from vendors such as Digital Equipment Corporation and Hewlett-Packard.

Motif was sold and licensed commercially as proprietary software. An initiative called LessTif developed an open source replacement, but it was not very compatible and never widely used. In 2000, Open Motif was released and made available at no cost on open source platforms, such as Linux, but was still not free on commercial UNIX systems. In 2012, Open Motif was released as free software under the Lesser General Public License (LGPL).

A screen shot of some Motif programs running under the Motif window manager (mwm) is shown in Figure 1.

Figure 1: Some Motif Applications


CDE (2), or the Common Desktop Environment, is a desktop and development environment built on top of the Motif toolkit. It was developed as a collaborative initiative by several computer vendors (including Sun, Hewlett-Packard, IBM and Unix System Laboratories) to unify the user interface on desktop UNIX systems.

CDE is a development toolkit as well as a desktop environment that includes a number of applications including a window manager, file manager, productivity tools and GUI builder. It also includes a session manager (dtsession), and a network-aware inter-client messaging system called ToolTalk, something rather innovative at the time. A screen shot of a desktop running CDE is shown in Figure 2.

Figure 2: The CDE Desktop

CDE was a proprietary product that was sold commercially on its own or bundled with operating systems or hardware. As well as running on various flavors of UNIX and OpenVMS, versions were later available for FreeBSD and Linux, including Red Hat. FreeBSD and Caldera both shipped CDE as part of their premium distributions.

CDE was considered state-of-the-art until the mid to late 1990s. In the early 2000s, its popularity waned as other more advanced and usable operating systems, including Linux, and Open Source alternatives to CDE and Motif, such as KDE and Gnome, replaced UNIX systems.

In 2012, the source code for CDE was released under the open source Lesser General Public License, shortly before the similar LGPL release of Motif. After CDE was released under the LGPL, work was done to port it to Open Source operating systems including Linux, FreeBSD, OpenBSD and NetBSD. In March 2014, the first stable release of CDE was made since being released as free software.

Running Motif on Linux

As Linux is POSIX compatible and supports the X Windowing system, it is quite straightforward to build and run Motif and Motif applications on Linux. Motif applications can run alongside other X11-based applications, with or without using the Motif window manager.

While you can compile it yourself from source code, Motif binary packages are readily available for many of the popular Linux distributions, such as Ubuntu, Debian and Fedora Core.

On Ubuntu, to get the base Motif shared library, you need to install the package "libxm4". If you want to do development, install the package "libmotif-dev". The Motif window manager is available in the package "mwm".

On Debian Linux, the library package is "libmotif4", the development package is "libmotif-dev" and the window manager is part of "motif-clients".

If Motif packages are not available from your Linux distribution, you may find suitable packages at this site (7).

If you want to try running the Motif window manager, you can close your existing window manager and run mwm instead. Under KDE, the following command will let you temporarily switch to using mwm:

killall kwin; mwm &

Existing X11 applications should continue to run when you switch window managers.

If you installed the Motif development packages, you can now compile and run Motif applications. Below is the source code for a simple "hello world" Motif application, taken from the official Motif documentation.

/* hello.c -- initialize the toolkit using an application context 
** and a toplevel shell widget, then create a pushbutton that says
** Hello using the varargs interface. 



#include <stdio.h>
#include <Xm/PushB.h>

main (int argc, char *argv[])
    Widget           toplevel, button;
    XtAppContext     app;
    void             button_pushed(Widget, XtPointer, XtPointer);
    XmString         label;
    Arg              args[2];

    XtSetLanguageProc (NULL, NULL, NULL);
    toplevel = XtVaOpenApplication (&app, "Hello", NULL, 0, &argc, argv,
                                    NULL,sessionShellWidgetClass, NULL);    
    label = XmStringCreateLocalized ("Push here to say hello");
    XtSetArg(args[0], XmNlabelString, label);
    button = XmCreatePushButton (toplevel, "pushme", args, 1);
    XmStringFree (label);
    XtAddCallback (button, XmNactivateCallback, button_pushed, NULL);
    XtManageChild (button);
    XtRealizeWidget (toplevel);
    XtAppMainLoop (app);

void button_pushed (Widget widget, XtPointer client_data, XtPointer call_data)
    printf ("Hello Yourself!\n");

Listing 1: Example Motif Program

If you save the source code above to a file, such as hello.c, you should be able to compile it using a command like this:

% gcc -o hello hello.c -lXm -lXt

A screen shot of the example program running is shown below in Figure 3.

Figure 3: Sample Motif "Hello World" Application

The Raspberry Pi is a popular low-cost computing platform that runs Linux (and a number of other operating systems). Motif is not currently part of the Raspbian Linux distribution for the Raspberry Pi. As an experiment, I downloaded the source code for Motif 2.3.4 and tried building it. I installed the build dependencies (using the build dependency packages listed for the Debian Motif package), extracted the source archive and built it using these commands:

sudo apt-get install libxaw7-dev byacc flex libsm-dev libx11-dev libxext-dev libxmu-dev libxp-dev libxt-dev xbitmaps libxft-dev autotools-dev quilt
tar xvf motif-2.3.4-src.tgz
cd motif-2.3.4

It took about one hour and forty minutes for a complete build, as compiling natively on the Raspberry Pi is slow, but it built and ran fine, including the Motif window manager and the approximately fifty demonstration programs included with the Motif distribution.

After installing it (by doing sudo make install), I was able to compile and run the "hello world" example program listed earlier. I was also able to run the Motif mwm window manager on the Raspberry Pi desktop (instead of the standard Openbox window manager. The screen shot in Figure 1 was made on a Raspberry Pi system.

Running CDE on Linux

Unlike Motif, CDE is not included with most Linux distributions, so you will need to go to a little more effort to find packages built by third parties or build it yourself.

In most cases, it is recommended to build CDE from source. If you are building it on a Linux system, you can find instructions on this Wiki page (5).

You may want to build and install CDE on a dedicated system separate from your main computer to avoid breaking anything on your existing desktop system.

I followed the instructions on an Ubuntu Linux 14.04 system and it built without any issues. The packages I needed to install to build CDE on a clean Ubuntu 14.04 system were the following:

git build-essential libxp-dev libxt-dev libxmu-dev libxft-dev
libxinerama-dev libxpm-dev libxm4 libmotif-dev libxaw7-dev libx11-dev
libXSs-dev libtirpc-dev x11-xserver-utils libjpeg-dev libfreetype6-dev
tcl-dev ksh m4 ncompress xfonts-100dpi xfonts-100dpi-transcoded
rpcbind bison xbitmaps

The full build took about one hour and forty-five minutes on an old Intel Atom netbook computer with 1 GB of RAM. A screen shot of CDE running on Ubuntu Linux is shown below in Figure 4. The startup time and performance of the desktop was very good, even on this relatively slow machine (which is not surprising, as the machine was significantly more powerful than the workstations that CDE was originally designed to run on).

Figure 4: CDE on Ubuntu Linux

I also went through the build process on a Raspberry Pi computer using the Motif library that I had built earlier from source. It built cleanly, with no changes, taking about six hours to build natively on the Pi. The CDE applications and the login manager all worked fine.


Seeing CDE up and running brought back memories of using Hewlett-Packard and Sun workstations back in the 1980s when it was the new up and coming toolkit that was going to unify the different UNIX graphical desktops.

Both Motif and CDE are of course outdated in many ways, including being tied to the X11 platform, not being written in an object-oriented programming language, and not offering state-of-the-art user interfaces. However, they were important stepping-stones to the later desktop environments that eventually became ubiquitous on not only on consumer desktops, but also smart phones and embedded touchscreen devices. It is quite amazing that Motif and CDE applications can still run on current Linux desktops alongside modern applications.

If your interest in CDE or Motif is to run a legacy application on a modern Linux desktop, for example, your application may require more than just a recompile. You may need to do some porting of the code. Common porting issues include changes required due to more modern C and C++ compilers, the C and C++ run-time libraries and issues involving compilation on 64-bit platforms.

In the past, a large part of our business at ICS was training and consulting on Motif and we continue to sell development tools to customers for legacy systems. We have also helped a number of customers port their applications to new toolkits like Qt. One of our developers captured much of his Motif knowledge in a series of ICS Network videos (8).

There are also some alternative operating systems you can run, should you be as interested as I am, in retrocomputing. The Raspberry Pi, in particular, makes a good platform for this and there are bootable images available that allow you to run operating systems including RiscOS (9) and Plan 9 (10). If you want to experience the very early days of computing, there are even hardware replicas available of machines like the Altair 8800 (11) and Apple 1 (12).


  1. Motif (software), Wikipedia article, accessed April 29, 2014,
  2. Common Desktop Environment, Wikipedia article, accessed April 29, 2014,
  3. Motif project at SourceForge, accessed Apr 29, 2014,
  4. CDE Desktop project at SourceForge, accessed Apr 29, 2014,
  5. CDE Build instructions for Linux, accessed Apr 29, 2014,
  6. ICS MotifZone web site, accessed Apr 29, 2014,
  7. Open Motif Downloads, accessed Apr 29, 2014,
  8. ICS Network Motif webcast series, accessed Apr 29, 2014,
  9. RiscOS for Raspberry Pi, accessed Apr 29, 2014,
  10. Plan 9 from Bell Labs operating system, accessed Apr 29, 2014,
  11. Altair 8800 Replica Kit, accessed Apr 29, 2014,
  12. Briel Computers, Retro Computer Kits, accessed Apr 29, 2014,