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. All of this while 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 autumn of 2020 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, accomplished in the twilight years of Usenet; perhaps as a celebration 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. Other compiling is done with my old friend MXE.
  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 for my compilations needs for this project with a direct download of i686-8.1.0-release-win32-sjlj-rt_v6-rev0.7z. Decompress the contents of this archive to C:\MinGW and then prepare for some work to add this manually to the Win10 $PATH. For Win10 1909 search for 'env', look for 'Environment Variables' and place the following three locations into the system $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. Congratulations on adding a compiler to Win10! And now to add some extra, required libraries...

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 Virtual Machine (a recent snapshot of Slackware -current) for use exclusively with the cross compiler MXE. With MXE set appropriately (my own example of this is here...) the build for the latest 32bit 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 32bit package for use with slrn:

wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz && \
tar xvf openssl-1.1.1f.tar.gz && cd openssl-1.1.1f && \
./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.1f-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 then be tested with the following three commands, issued from Windows PowerShell:

gcc --version
openssl version
iconv --version

And if this is all well, with appropriate versions reported and no error messsages, you should be right to go. For those who have found MXE too much of a hurdle I have placed copies of these libraries on my web site But now 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. 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. First open the file src/win32/makefile.m32in with your favourite text editor and make the following changes:

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

These changes are to allow compiling against 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 and should be run from the slrn root directory:

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. The best way to get a good on configuration start is to copy the installed configuration file from C:\MinGW\local\share\doc\slrn\slrn.rc to C:\slrn\slrn.rc and then start editing.

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 but remember also to copy the file slrnpull.conf from the slrn tarball to its correct location of C:\MinGW\local\var\spool\news\slrnpull and edit this file as you see fit. The file authinfo goes in the same location with your login information set appropriately. You may need to manually create a few of the required spool subdirectories but then you should be right to go.

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 libiconv libidn libntlm

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

cd $HOME/Desktop && \
wget https://marlam.de/msmtp/releases/msmtp-1.8.8.tar.xz && \
tar xvf msmtp-1.8.8.tar.xz && cd msmtp-1.8.8 && \
./configure --prefix=$HOME/msmtp \
            --host=i686-w64-mingw32.static \
            --disable-nls \
            --without-libsecret \
            --without-macosx-keyring \
            --without-libgsasl \
            --with-tls=gnutls \
            --with-libidn && \
make -j 8 && \
strip --strip-unneeded src/msmtp.exe && cd $HOME/Desktop && \
zip -j msmtp-1.8.8-win32-ads.zip msmtp-1.8.8/{src/msmtp.exe,ChangeLog,README,COPYING,THANKS} && \
rm -rfv msmtp-1.8.8 msmtp-1.8.8.tar.xz

Take the generated executable from the created zip file and place it in C:/MinGW/local/bin. (And again for those who have found MXE too much of a hurdle I have placed packaged 32bit binaries of msmtp 1.8.8, ready to go, on my web site). I have been unable to get a 64bit static version running on Windows 10 with and error claiming that msmtp cannot write to the temp file, so if anybody can solve that issue I would be very, very grateful! Source msmtp from 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 Win10, just be aware that the tls fingerprint changes from time to time so I have included the directions for finding the newer fingerprint:

# -----------------------------------------------------------------------------------
# Sample config file for msmtp 1.8.7 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 xxxxxxxxxxxxxxxxx@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 BF:90:E6:23:3D:18:17:94:FC:F4:7D:78:8C:58:69:59:C3:20:1A:B6:A7:F1:24:BF:53:23:2E:00:4B:B9:32:B5
from xxxxxxxxxxx@gmail.com     
user xxxxxxxxxxx@gmail.com  
password xxxxxxxxxxxxx
logfile C:/slrn/msmtp.log

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

Just remember that it is considered to be a little unusual to reply to a Usenet post via email so be a little judicious with your use of the option: Reply via Email.

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
chcp 65001
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!