OpenVMS comes with several text editors on board. All fulfill their purpose well. For a supporter of GNU Emacs you might also want to have your favorite editor on OpenVMS, too. This post shows you how to bring GNU Emacs onto OpenVMS 8.x. It shows how to compile and link GNU Emacs on OpenVMS as well as how to remove some OpenVMS specific pitfalls in configuration.
Emacs is good old friend of mine. I use it on several Unix derivates, Linux and on my Windows PC. I used several Emacs ports on MS-DOS, PC-DOS and DR DOS in the good old days. Even on my sessions z/OS UNIX System Services you can see from time to time the screen of Emacs. So you can call me a long-time supporter. — But don’t think that I am not aware of using other editors like vi, Notepad++ or OEDIT. 😉 I use them and I like them, too. I am pragmatic.
On OpenVMS you will find several editors like EDT, TPU, EVE, and even TECO. All have their advantages and disadvantages. To be consequent I also wanted a more or less up to date version of GNU Emacs on my OpenVMS box. So I started my Odyssey to find out how to build GNU Emacs on OpenVMS 8.3 AXP. Here are my results in the hope that they might be useful to you.
What you need
Before you start you have to ensure that you’ve installed HP C++ 7.x. Additionally you will need a make utility like MadGoat’s/Kednos’ MMK or alternatively HP’s MMS. I used MMK for my builds of GNU Emacs. MMS should work, too, but I did not try it.
To extract GNU Emacs’ sources you will need a unzip utility. If your systems lacks this you can download unzip here:
Next you will need GNU Emacs’ sources. Unfortunately the vanilla sources are not prepared for compiling on OpenVMS. You will need additionally files and patches. I used the sources and patches provided by Hewlett Packard’s OpenVMS Freeware. There you will find GNU Emacs 21.2 in OpenVMS Freeware V8.0. (Not the up to date version but a version which is a good compromise between patching Emacs by yourself and state of the art functionality.)
Download there the archive emacs.zip. Inside this archive you will find two additional archives:
- emacs21_2.zip with Emacs’ sources and
- emacs21_2_ivms.zip with OpenVMS specific files.
Preparing the Environment
You will need to know or define the following values and will have to substitute them in the following commands:
- <UIC>: Your user idenfication code (UIC).
In the examples here, we will use [100,1].
- <DEVEL-BASE>: A directory which will be used as development base.
In the examples we will use DKA100:[DEVEL].
- <DEVEL-EMACS>: A directory which will hold the Emacs sources for the build.
In the examples we will use DKA100:[DEVEL.EMACS].
- <INSTALL-EMACS>: A directory in which Emacs will reside after installation.
In the examples we will use DKA0:[TOOLS.EMACS].
Create the directories:
cre/dir/own=<UIC> <DEVEL-BASE> cre/dir/own=<UIC> <DEVEL-EMACS>
cre/dir/own=[100,1] dka100:[devel] cre/dir/own=[100,1] dka100:[devel.emacs]
After that transfer the archives emacs21_2.zip and emacs21_2_ivms.zip to <DEVEL-BASE>. Next extract the directory in the following order and answer questions to overwrite existing files with A for all:
set def <DEVEL-EMACS> unzip [-]emacs21_2.zip unzip [-]emacs21_2_ivms.zip
Create an installation directory:
cre/dir/own=<UIC> <INSTALL-EMACS> set prot=(W:RE) <INSTALL-EMACS>
cre/dir/own=[100,1] dka0:[tools.emacs] set prot=(W:RE) dka0:[tools]emacs.dir
After that set the logical AXPA to <DEVEL-EMACS> and set this directory as default:
define /tran=(conc,term) /job AXPA <DEVEL-EMACS> set def axp:[emacs.build]
define /tran=(conc,term) /job AXPA dka100:[devel.emacs.] set def axpa:[emacs.build]
Building GNU Emacs
Now it’s time to build Emacs. Before you can start the build process you’ll need to introduce MMK as a substitute for MMS. For this purpose define simply a symbol named MMS which point to MMK:
mms == "''mmk'"
As next step configure the build in the typical manner of autotools:
@[-.emacs212_3]configure - --with-tcpip=YES - --with-x=YES - --prefix=<INSTALL-EMACS> - --startupdir=<INSTALL-EMACS>.STARTUP]
@[-.emacs212_3]configure - --with-tcpip=YES - --with-x=YES - --prefix=DKA0:[TOOLS.EMACS] - --startupdir=DKA0:[TOOLS.EMACS.STARTUP]
Now the great moment is here! You can start the build of GNU Emacs:
This will take a while depending on your system’s performance. After a successful build you finally install GNU Emacs:
Configuring GNU Emacs
If everything went well you will have an installed GNU Emacs on your OpenVMS system. You will have to configure it now. As metioned after the installation process you will have to put the following line into your SYS$MANAGER:SYSTARTUP_VMS.COM:
$ @<INSTALL-EMACS>.STARTUP]GNU_STARTUP EMACS-21.2 TABLE=/SYSTEM,INSTALL_IMAGE
$ @DKA0:[TOOLS.EMACS.STARTUP]GNU_STARTUP EMACS-21.2 TABLE=/SYSTEM,INSTALL_IMAGE
This will create the necessary system-wide logicals at startup. Furthermore this will install Emacs /SHARED.
Additionally you will have to add the following line to your SYS$MANAGER:SYLOGIN.COM. This will create the appropiate command symbols.
$ @<INSTALL-EMACS>.STARTUP]GNU_STARTUP EMACS-21.2 NOLOGICALS
For example if your Emacs resides in DKA0:[TOOLS.EMACS]:
$ @DKA0:[TOOLS.EMACS.STARTUP]GNU_STARTUP EMACS-21.2 NOLOGICALS
Emacs is now installed on your OpenVMS system and nearly ready for use. Unfortunately you will need a bit fine tuning before you can use your beloved text editor. There still wait some pitfalls for you.
Fixing Problems with Termcap
Emacs’ distribution comes with a termcap which is not compatible with OpenVMS’ VT terminals. You need to add the terminal types of vtXXX-80 and vtXXX-132. The good news are: You do not need to invent your own settings. The mentioned OpenVMS terminal types are compatible with Unix style vtXXX and vtXXX-w terminals. They have simply different names.
The file which you must change is [.LIB.EMACS.21_2.ETC]termcap.src relative to your Emacs’ installation directory. In the examples above this file is abolutely referenced as DKA0:[TOOLS.EMACS.LIB.EMACS.21_2.ETC]termcap.src.
For example: If you find a termcap definition like this:
vt100|vt100-am|dec vt100 (w/advanced video):\ :am:bs:ms:xn:xo:\ ...
You will have to change it to this:
vt100|vt100-am|vt100-80|dec vt100 (w/advanced video):\ :am:bs:ms:xn:xo:\ ...
To make your life a bit easier you will find a corrected termcap.src in this emacs_vms.zip. You have to replace your termcap.src by the new one simply.
Fixing Problems with X11
Another problem is that GNU Emacs’ Lisp module x-win.el is incompatible with OpenVMS. It is compatible with Unix-like systems only. The problem is that x-win.el searches in process’ environment only for a variable called DISPLAY to determine the X11 display to use. On OpenVMS this environment variable isn’t named DISPLAY. It is called DECW$DISPLAY.
To solve this problem you have to search for all occurences of DISPLAY and and replace it by DECW$DISPLAY. This is a quick and dirty hack, of course. That’s OK because the previously built Emacs will run on OpenVMS only. So replace the display variable and everything looks fine.
To make your life also in this case as easy as possible. You will find a patched x-win.el in emacs_vms.zip, too.
The file x-win.el you will find as [.LIB.EMACS.21_2.LISP.TERM]x-win.el relative to your Emacs’ installation directory. Simply replace your version with the one provided by the previously mentioned ZIP archive.
After copying the file you need to byte compile the Lisp source:
set def <INSTALL-EMACS> set def [.LIB.EMACS.21_2] runemacs -batch -f batch-byte-compile [.LISP.TERM]x-win.el
If everything went well here too you will have a full functional Emacs now — in your VT terminal sessions as well as under X11.
Your post, How to build GNU Emacs on OpenVMS | Don't Panic!, is really well written and insightful. Glad I found your website, warm regards from Graham!
Great post, really enjoyed it!
Two struggles that might make your next update:
1. In the kits, TRADCPP is not shipped as an I64 image. SO a trip in there to build it is required.
2. I use an emulator to connect to the Itanium, and it reports the terminal type as “VT200 Series.” For now, I have changed the terminal type to VT100.
But – the first time I have seen emacs on my screen for too many years.
Thank you very much for bothering to write this post.
Your instructions are super and your correctness, clarity and detail are wonderful.
Thank you for your comment.
I usually connect with VT100 or xterm. Thank you for your hint about VT200.
Re: Fixing Problems with X11
Instead of replacing DISPLAY with DECW$DISPLAY in the sources, a simple
$ define display ‘f$trnlnm(“DECW$DISPLAY”)
seems to do the job.