Compiling and running slrn under Windows 10...

In a time when I have culled many,many pages from this web site it may be a little surprising that a page remains that relates the adventures of compiling and running the great Usenet news reader slrn under Windows 10. Indeed a previous version of this guide has assisted nobody, as far as I am aware, to actually build their own copy of slrn and I have received zero email concerning the page. And of course Usenet is dying, its glory days now just a distant memory...

Nevertheless, Gentle Reader, this page not only remains but it has been revised and rebuilt from scratch in the winter of 2019 for the simple reason that I have had an incredible amount of fun researching, testing and making some magnificent mistakes in putting it all together yet again! Again I have succeeded in my goal of compiling slrn, S-Lang and friends on a native Windows 10 environment and I now run slrn on this platform daily with absolutely no problems. All accomplished in the twilight years of Usenet, as a celebration perhaps of what Usenet used to be...

Only 3 steps required...

It only takes three steps to accomplish the goal of building slrn and friends under Windows 10 and then successfully running them all together but I confess there is a degree of complexity involved. If performed with some diligence however there should be no great problems. First now to create a decent build environment:

1: Creating a build environment...

My own background is Slackware Linux which has a superlative build environment. Windows 10 is a wasteland in comparison but this can be rectified. For slrn and friends the following are needed:

  1. A compiler: For a compiler and associated build tools I have used a specific version of the MinGW-64 toolset.
  2. Extra libraries: A few extra libraries are required, and a visit to the MXE cross compiler is required for libiconv and OpenSSL.

Setting the compiler...

After much experimentation with the various versions of Windows compilers out there I found success with all compilations needs for this project with a direct download of 686-8.1.0-release-win32-sjlj-rt_v6-rev0.7z. I used WinRar to decompress the contents of this archive to C:\MinGW (this is important!) and then added this to the Windows 'System' $PATH. For this search for 'env', look for 'Environment Variables' and place the following three locations into the $PATH statement :C:\MinGW\bin C:\MinGW\local\bin C:\slrn using exactly that order. Also make a new system variable for NNTPSERVER while you are there which will allow slrn and slrnpull to find the remote NNTP server easily. The compiler should now be ready to go!

Some extra libraries...

Some compilers come kitted out with libiconv and OpenSSL options but this one does not but it is easy enough to build your own. My own technique is to have a Linux VM (Ubuntu 18.04 actually) for use exclusively with the cross compiler MXE. With MXE set appropriately the build for the latest version of libiconv is:

wget ftp.gnu.org/gnu/libiconv/libiconv-1.16.tar.gz && \
tar xvf libiconv-1.16.tar.gz && cd libiconv-1.16 && \
./configure --prefix=$HOME/libiconv \
            --host=i686-w64-mingw32.static \
            --disable-shared --enable-static && \
make -j 8 && make install && cd $HOME/libiconv && \
tar cavf ../libiconv-1.16-win32-ads.tar.gz bin/ include/ lib/

While the build for OpenSSL was a little less 'standard' with the following successfully building a package for use with slrn:

wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz && \
tar xvf openssl-1.1.1c.tar.gz && cd openssl-1.1.1c && \
./Configure mingw --cross-compile-prefix=i686-w64-mingw32.static- \
           --prefix=$HOME/openssl && \
make -j 8 && make install && cd $HOME/openssl  && \
tar cavf ../openssl-1.1.1c-win32-ads.tar.gz bin/ lib/ include/

These libraries are decompressed into C:\MinGW\local and again this exact placement is important. The installation can be tested with the following three commands, issued either from the stodgy Windows 10 cmd application or from the newer PowerShell:

gcc --version
openssl version
iconv --version

And if this is all well, with appropriate versions reported and no error messsages, it is time to get to grips with the source code. Warning, hacking ahead!!

2: Downloading, hacking, compiling and installing...

The source code is required for the latest release version of S-Lang as well as a git snapshop of the latest development version of slrn. For what it is worth I usually store the source code in C:\slrn\source simply for the purposes of safe storage and easy accessibility for any subsequent recompiles. So now to compile the source code in sequence; first S-Lang (easy) and then slrn (not so easy!).

Compiling S-Lang...

The process of compiling S-Lang under Windows 10 is pretty straightforward. From the decompressed source run the following three commands:

mkfiles\m32init.bat
mingw32-make
mingw32-make install

This compiles and installs neatly into C:\MinGW\local and can be tested by running the command slsh --version. If there are no error messages and the appropriate version number appears it is time to move to the slrn source itself.

Compiling slrn...

Because this build does not use the standard auto-tools configuration to make everything just right there will have to be some direct hacking of the slrn source. To do this I normally use Windows Notepad but any simple text editor will do the job. First open the file src/win32/makefile.m32in and make the following changes, the placement will be obvious:

SSL_LIBS =  -lssl -lcrypto -lgdi32
MISCLIBS = $(SSL_LIBS) -lwsock32 -lwinspool -liconv

These changes are to allow compiling againts both libiconv and OpenSSL. Next open the file src/slrnconf.h and make several small changes, first to make libiconv support possible:

/* Add support for libiconv */
#define HAVE_ICONV 1

Next alter the line in the same file that deals with ssl support by changing the zero value to a one:

#define SLRN_HAS_SSL_SUPPORT	1

And finally make a very small alteration to src/slrnfeat.hin to rationalise the slrnpull root directory location, which is a little labyrinthine in the default settings:

/* This must be set to an absolute pathname. */
#define SLRNPULL_ROOT_DIR	"C:/MinGW/local/var/spool/slrnpull"

With the hacking done it is time to cross fingers and start compiling. The following three commands install compile and install both slrn and slrnpull:

slsh win32/m32config.sl
mingw32-make
mingw32-make install

And if all goes well slrn and slrnpull will be successfully compiled and installed. However there is still some work to do before opening either application as several configuration files must be edited.

3: Configuring...

In this page I did not intend to give a detailed setup guide for slrn itself but I will mention several vital details that are Windows specific. Such areas as selecting an editor, setting slrnpull to pull a small spool, sending email in reply to a post, running a batch file to start slrn, dealing with slrn's FQDN error message under Windows and a couple of vital extra settings for the file slrn.rc. The best way to get a good start on this file is to copy the installed copy from C:\MinGW\local\share\doc\slrn\slrn.rc to C:\slrn\slrn.rc and then start editing. Plenty of other docs in that directory that are well worth reading BTW...

Selecting an editor...

slrn of course does not ship with an editor and I would suggest for a typical Windows 10 user that GVim is a fine choice, I use version 7.3.46 as the newest version had a few syntax changes that I could not work out. It will need a setting something like the following in slrn.rc:

% Set your favourite editor.  Use %s for the file name and %d for the line
% where the cursor should be placed (usually at the beginning of the body).
set editor_command "C:/Vim/vim73/gvim +%d %s"

Note that as usual it is best to install software such as GVim to a location without spaces in the directory names, it just makes life so much easier. Some may be interested in the additions I have made to the default _vimrc file that make the GVim plus slrn experience a little more comfortable:

 " My changes to the default _vimrc that make
 " editing with GVim for slrn a little easier:
 
set guifont=Consolas:h13 " Looks good on my system, also used for Terminal.
colors darkblue          " Background colour for the Gvim window.
nnoremap Q gq}           " Q command to reformat paragraphs and list.
set nobackup             " No backup files littering the place.
set textwidth=70         " Text width to keep Usenet happy.
set encoding=utf-8       " Required for 'foreign' text.
set fileencoding=utf-8   " Required for 'foreign' text.

I am no GVim master so I would be very happy to hear of any better options that I should be using, but these are working fine for me at the moment.

Setup slrnpull...

To successfully run slrnpull the following settings are required in slrn.rc:

set spool_inn_root   "/MinGW/local/var/spool/slrnpull"
set spool_root       "/MinGW/local/var/spool/slrnpull/news"
set spool_nov_root   "/MinGW/local/var/spool/slrnpull/news"
set read_active      1
set use_slrnpull     1
set post_object      "slrnpull"
set server_object    "spool"

This is the bare minimum to successfully point slrn towards the spool and let me tell you that slrnpull runs very nicely under Windows 10!

Email in reply...

Remembering that it is rarely appropriate to reply to a Usenet post via email it can be accomplished relatively easily via slrn and the command line msmtp. This means another visit to my VM with MXE installed and a cross compile of msmtp. There is a preconfigured 'recipe' in MXE for this (which is my work btw) but it is a little out of date and the latest msmtp needs to be built out of MXE. First make sure that MXE has the following libraries available by running the following in the directory holding the MXE makefile:

make cc gnutls libgcrypt libgpg_error libgsasl libiconv openssl libidn libntlm

And then with MXE set create the msmtp executable as follows:

wget https://marlam.de/msmtp/releases/msmtp-1.8.5.tar.xz && \
tar xvf msmtp-1.8.5.tar.xz && cd msmtp-1.8.5 && \
./configure --prefix=$HOME/msmtp \
            --host=i686-w64-mingw32.static \
            --disable-nls \
            --without-libsecret \
            --without-macosx-keyring \
            --with-tls=openssl \
            --with-libidn && \
make -j 8 && make install && cd $HOME/msmtp

Take the generated executable and place it in C:/MinGW/local/bin and source it for the slrn configuration file as follows:

% Use msmtp to send mail from slrn
set sendmail_command "msmtp.exe -C C:/slrn/msmtprc -t <"

And my gift for you, Gentle Reader, is the configuration file referenced above which I have tested extensively under Windows 10:

# -----------------------------------------------------------------------------------
# Sample config file for msmtp 1.8.5 and a GMail address.
#
# Remove the '# ' before the lines to 'uncomment'. Also
# check the fingerprint is correct by giving the following command:
# msmtp -C C:/slrn/msmtprc --serverinfo --tls --tls-certcheck=off --tls-fingerprint=
#
#  Check the whole transaction as follows:
# echo "Hello there" | msmtp  -C C:/slrn/msmtprc --debug andrew.david.strong@gmail.com
# -----------------------------------------------------------------------------------

# Set default values for all accounts:
defaults
auth            on
tls             on
tls_certcheck   on
tls_starttls	on

# account Gmail
account	gmail
host smtp.gmail.com
port 587
tls_fingerprint A9:41:65:C0:14:3D:B6:F8:17:4C:AA:BB:A5:6C:38:A1:27:C5:B3:87:45:C6:05:04:D8:06:3E:D0:FA:94:C8:8A
from xxxxxxxxxxx@gmail.com     
user xxxxxxxxxxx@gmail.com  
password xxxxxxxxxxxxx
logfile C:/slrn/msmtp.log

account default : gmail
# -----------------------------------------------------------------------------------

How cool is that? Now for more essential material where a Windows batch file is used to start slrn:

Batch file for startup...

Thomas Wiegner's Windows binary had a nice batch file, required to start slrn under Windows 10, and I have borrowed liberally from it:

rem This is a batch file for slrn under windows
set SLRNHOME=C:\slrn
set LANG=en_AU.UTF-8
set TMP=c:\WINDOWS\Temp
rem slrn.exe --create
slrn.exe

There is not much more to say about this except to mention that slrn must be run with the '--create' option on the first run. I would suggest that you run slrnpull directly from the commandline, this is my practice, rather than from this batch file, although please feel free to disregard this advice and let me know your preferred way of running both slrnpull and slrn itself.

Running with a FQDN...

In about 99% of cases when starting slrn for the first time under Windows 10 you will receive an alarming message from slrn along the lines of: 'Warning: Unable to find a unique fully-qualified host name....' slrn would like to use this FQDN to construct an unique Message-ID and home installations of Windows will usually not have a usable FQDN. Windows does not make this easy to set but there are 2 choices from within slrn to make slrn happy and generate an unique FQDN. First choice is to set the following:

set generate_message_id 0

This setting will tell slrn to leave the generation of the MID to your NNTP server and if you have a decent NNTP server this should be enough. There is a less well documented option available where you can manually set the right hand side of the MID, this should be used with some caution as the MID needs to be unique, this being the posting_host setting. Use this judiciously if you feel you need to...

Some extra settings...

There are a couple of very Windows-specific settings to note and probably a few I have forgotten as well. The following is required to get a decent display of the thread tree on Windows 10's console:

set simulate_graphic_chars 1

The following is required to launch Firefox from URLs within slrn:

set non_Xbrowser "start \"\" \"C:/Program\ Files/Mozilla\ Firefox/firefox.exe\" \"%s\""

And a final note is that it would be wise to investigate the many, many possibilities to customise your slrn experience by modifying this simple text file!