slrn and 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 comprehensively revised and rebuilt from scratch in the autumn of 2020, as well as being comprehensively retested in January 2021, 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 (with a little help from my friend MXE!) and accomplished this 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. On my most recent re-examination of this page to build the whole thing from scratch took me about three hours, but I can be a little slow sometimes! 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 veritable wasteland in comparison but this can be rectified with some careful work. 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. This installs an older compiler: GCC 8.1.0 and perhaps with the next rewrite of this page I will work with a newer version. Other compiling is done with my old friend MXE on a Slackware Virtual Machine.
  2. Extra libraries: A few extra libraries are required, and a visit to the MXE cross compiler is required for libiconv, OpenSSL and msmtp. Never fear, Gentle Reader, I have also made these three libraries available as a packaged download from this website!

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 download of this archive which has been placed in the downloads section of my web site to avoid the labyrinthine structures of SourceForge as well as its doubtful ethics. Decompress the contents of the archive to C:\MinGW; and for what it is worth I use 7-Zip under Windows 10 for this and subsequent extractions. Then prepare for some work to add this manually to the Win10 $PATH. For the Win10 Version 19042.631, which I am running, search for 'env', look for 'Environment Variables' and place the following three locations individually 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, however 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/

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

When seeing the results of these commands flash across a Windows 10 PowerShell screen it is for a Linux user like meeting an old friend in a very exotic location! 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 for download. 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 (a little less easy!).

Compiling S-Lang...

The process of compiling S-Lang under Windows 10 is straightforward. From the decompressed source run the following three commands, preferably using Windows PowerShell rather than the clunky cmd application:

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 (Windows Notepad is fine for this simple task) 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 compile and install slrn and slrnpull and should be run from the slrn root directory:

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

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 now 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 for Usenet posts 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, and in this example you can see that I have installed to C:/Vim. Some may be interested in the additions I have made to the default _vimrc file that make the slrn plus GVim 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. For some reason you also will need to manually create a log file and a required subdirectory, I have helpfully shown below which is the file and which is the directory:

C:\MinGW\local\var\spool\slrnpull\log  <---- file
C:\MinGW\local\var\spool\slrnpull\news <---- directory

And this means that most of the heavy lifting is done!

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. Worth a visit there as I detail there the full MXE setup including the use of gcc 10.x. There is actually a preconfigured 'recipe' in MXE for msmtp (which is my work btw) but it is a little out of date and the latest msmtp should 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 MXE_TARGETS='i686-w64-mingw32.static'

And then with MXE set, create the 32bit msmtp executable and create a neat package, as follows:

cd $HOME/Desktop && \
wget https://marlam.de/msmtp/releases/msmtp-1.8.17.tar.xz && \
tar xvf msmtp-1.8.17.tar.xz && cd msmtp-1.8.17 && \
./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.17-win32-ads.zip msmtp-1.8.17/{src/msmtp.exe,ChangeLog,README,COPYING,THANKS} && \
rm -rfv msmtp-1.8.17 msmtp-1.8.17.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.14, ready to go, on my web site). I decided to only build the 32bit version of msmtp, perhaps on a rainy day I will experiment with the 64bit version. Now 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. The example below shows the SHA256 fingerprint as of October 7th, 2021:

# -----------------------------------------------------------------------------------
# Sample config file for msmtp 1.8.17 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 8D:C5:30:10:C0:BD:DB:19:6B:F7:44:5E:60:E9:1E:BC:4B:44:86:A7:6A:0D:E2:3E:57:5B:E0:5D:F0:7D:E8:58
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. I see now on this relook at the page msmtp has had a few more releases so over the next little while I will build the latest version.

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!