Welcome to my Step by Step Tutorial on On How to Install GSLL aka
The GNU Scientific Library for Lisp on Windows 7 and Windows 8. In this Tutorial I also teach you how to Install Emacs, Slime, SBCL aka Steel Bank Commmon Lisp, and QuickLisp. Basically Everything you Need to Know to Get GSLL up and running on Windows 7 or Windows 8 . This is the first Tutorial of its kind. There is no other Tutorial anywhere on the Internet to teach you how to Install this Amazing Lisp Package on a Windows System. Why is it so Amazing, you ask, well just look at this Excerpt from GSLL’s Home Page.

“The GNU Scientific Library for Lisp (GSLL) allows you to use the GNU Scientific Library (GSL) from Common Lisp
. This library provides a full range of common mathematical operations useful to scientific and engineering applications. The design of the GSLL interface is such that access to most of the GSL library is possible in a Lisp-natural way; the intent is that the user not be hampered by the restrictions of the C language in which GSL has been written. GSLL thus provides interactive use of GSL for getting quick answers, even for someone not intending to program in Lisp.”

..And this Excerpt from the GNU Scientific Library Home Page.

“The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License. The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.

The complete range of subject areas covered by the library includes,

Complex Numbers Roots of Polynomials
Special Functions Vectors and Matrices
Permutations Sorting
BLAS Support Linear Algebra
Eigensystems Fast Fourier Transforms
Quadrature Random Numbers
Quasi-Random Sequences Random Distributions
Statistics Histograms
N-Tuples Monte Carlo Integration
Simulated Annealing Differential Equations
Interpolation Numerical Differentiation
Chebyshev Approximation Series Acceleration
Discrete Hankel Transforms Root-Finding
Minimization Least-Squares Fitting
Physical Constants IEEE Floating-Point
Discrete Wavelet Transforms Basis splines


So as you can see it is a Great Library, plus it is a Lot of Fun to use.

I’m learning Linear Algebra from the book “Linear Algebra for Dummies” : )
I’m on page 116 and there hasn’t been one Linear Algebra Equation I couldn’t compute in Lisp Code with GSLL. From Multiplying, Dividing, and Adding and Subtracting Matrices and Vectors to Multiplying, Dividing, and Adding and Subtracting Matrices and Vectors by, by , to and from Scalars to Finding Inverses and Transposes of Matrices to putting Matrices in Reduced Row Echelon Form to Solving Systems of Linear Equations to Multiplying Matrices by Vectors to Finding the Euclidean Norm of a Vector to Finding the Inner Product of Vectors to Finding Orthogonal Vectors to Finding the Angle between Vectors to Multiplying a Matrix times an Identity Matrix to Swapping Rows and Columns of Matrices to Iterating through Matrices and Vectors to applying Linear Combinations to Vectors this Library hasn’t failed me once yet, so I know you won’t be disappointed in it. In my book a 100% success rate so far is Gold.

This is a Hack. GSLL was made mainly for Unix Systems so It had to be hacked to run on Windows. But after, all the Hacking was done, 95% of the tests that were ran with it’s Test Suite were Successful.

Here’s the Unit Test Summary output by GSLL.

| 3895 assertions total
| 3697 passed
| 198 failed
| 0 execution errors
| 0 missing tests

#<TEST-RESULTS-DB Total(3895) Passed(3697) Failed(198) Errors(0)>

Of the “3697 passed” those same tests pass every time the test are run. And of the “198 failed” those are the same tests that fail every time. That just means about 950 out of 1000 of GSL’s functions work in this hacked
version of GSLL. That is a HUGE number though. I’m still at 100% and counting on all the Linear Algebra Computations I’ve tried to do. And I’m sure that this will be the Main Tool I use for doing my Artificial Intelligence Research. So all you A.I. Programmers out there who have come to the same conclusion as I have, That Lisp is the Best Language for Programming A.I. you would be Well Advantaged to get this Installed on Your System. I know Windows isn’t normally known for Scientific Computing but, If you use Lisp and Follow this Tutorial, today all that can change.

We’ll all that being said Let’s get Started. First of all a little Introductory information to help the Tutorial make sense:

1. This is a Good Sized Hack a lot of stuff was done and it took over four hours to complete initially but I tried to Make it as Easy as Possible to re-create the Hack in this Tutorial and Install it on your System.

2. The Instruction are all Step by Step, I tell you everything to do down to the tiniest detail. but the clincher is you have to do every single little Step in the Right Order, as I outlined them or this won’t work. It is a precise hack.

3. This Tutorial has been tested 5 times, each on a Brand New Fresh Install of Windows, and 2 times on a 6 month old system with a lot of changes made on it. This is a Sturdy Tutorial it shouldn’t fail you.

4. If you have any questions or get any errors please comment and I will help you with it. I know it will take a while but if you get an error please Retrace Your Steps in the Tutorial and Verify you did everything right before you comment. It’s for your sake, though, It might be a couple of days before I can get back to you based on the number of requests I get and the fact my Research eats up a good amount of my time. But if you can’t figure it out, please, do comment, and I will get back to you I assure you.

5. This Tutorial has been Tested on Windows 7 and Windows 8 Successfully. If you get it to run on another Windows Operating System please comment with your steps so others may know. Unless it was with Cygwin. I heard Running Lisp Code Cygwin was Slower than Running Lisp Code in a normal Windows Environment.

Note: It is Recommended that, for the purposes of this Tutorial, that you don’t change anything about the paths where you install all the software to, other than the Drive Letter.

OK …Off we Go!

First you need to Install 7zip you will need it to Unzip all the files we will be downloading. Just go to this link

Download the appropriate version for your Operating System.
choose either the: 7-Zip for 32-bit Windows entry, or
the 7-Zip for 64-bit Windows x64 (Intel 64 or AMD64) entry.
Click the Link for the version of 7-zip you chose.

Install 7-zip with Default Settings.

Now we need to install Notepad++
(Windows Notepad will Destroy the Formatting of the Files we are working with in this Tutorial making Things hard to do).

You can Click on this Link to Download Notepad++

Just click on the Notepad++ Installer link below the Big Green Download button.

Install Notepad++ with Default Settings.

Now…Time to Install Emacs, which is the Unix-like Text Editor(So Much More in Fact) that we will be installing our Lisp IDE into.

Go to this link and Click on the most recent Emacs .zip file(not Link at the bottom of the page. At the time I wrote this Tutorial it was When it’s done downloading, go into the folder you downloaded Emacs to and Extract the Emacs .zip file.

Right click the Emacs .zip file placing mouse on 7-zip entry in context menu, slide to the right and choose Extract To.

Open the Folder you just Extracted and change the name of the Folder inside to emacs(precisely).

Paste the emacs folder into C:\Program Files (x86).

Open the bin folder inside the emacs folder you just pasted into C:\Program Files (x86)

In there you fill find a file named runemacs.exe

Pin runemacs.exe to the Start Menu and Taskbar for easy access to it.

Now we are ready Download SBCL aka Steel Bank Common Lisp which is the Lisp Interpreter we will be using for the purposes of this Tutorial.

You can Click on this link to Download SBCL directly, or, If that Link is Broken,

Go to this link and scroll down til you see the Windows |1.1.17 newest| under the x86 heading in the Big Colorful Box two-thirds of the way down the page.

Make sure to Click the Green Box Not the Yellow Box the Yellow one is still buggy, but the x86 version WILL work on a 64-bit Operating System,

Install SBCL:

Click Run in the Save/Run Dialog Box when it comes up.
Click Next

Put a check mark in the I accept the terms of the License Agreement Box

Click Next

Click Browse at the bottom of the Steel Bank Common Lisp 1.1.8 (X86) Setup Window you are currently in and Verify the Path in the Folder name: box at the bottom of the Window is C:\Program Files (x86)\Steel Bank Common Lisp\1.1.8\. You should substitute in the Drive Letter of whatever partition your Install Folder -> Program Files (x86), is in, for C: in that Path.

Click Next
Click Install

You now have C:\Program Files (x86)\Steel Bank Common Lisp Folder.

Create an SBCL System Initialization File by Right Clicking an empty space inside C:\Users\[Your Username]\AppData\Roaming Windows Explorer.

Choose New then Click Text Document not Rich Text Document name it test.txt.

Go to Start Menu.

Type cmd in the Search Box then Right Click the cmd exe file that pops up and Click Run as Administrator. When the Command Window pops up, type c: then type cd "C:\Users\[Your Username]\AppData\Roaming" exactly as printed with quotes. Replace the Entire [Your Username] Including Brackets with the Name of Your Users folder in C:\Users then type ren test.txt .sbclrc exactly as printed.

Verify that C:\Users\[Your Username]\AppData\Roaming\.sbclrc is there just to make sure. If not, repeat the steps again.

So now you should have a C:\Users\[Your Username]\AppData\Roaming\.sbclrc file.

Open C:\Users\[Your Username]\AppData\Roaming\.sbclrc in Notepad++, by Right Clicking the .sbclrc file and clicking Edit with Notepad++.

Copy All the Code Below that is in the Box into the empty .sbclrc file you have open in Notepad++ and take a moment to verify everything is there Exactly as it appears below. If Notepad++ won’t let you paste the Code inside the file, i/e Paste is greyed out, then just type some text into the file, then Right Click inside the empty .sbclrc file in Notepad++ and Click Select All, then Right Click the text you just selected and Click Paste. It should Paste the Code for you then.

Note: Replace the entire [Your Username] entry including Brackets with the name of your “Users” folder in C:\Users and the C: with your Drive Letter. i\e the Drive Letter of the Partition you are currently using.

Note: Make sure in all the Paths in your .sbclrc file that you use Two Back Slashes instead of One Back Slash as is normally done in Windows or SBCL won’t Recognize the Paths and as a Result will not Function Right…or At All.

;SBCL Intitialization File

(require :asdf)

;put all subdirectories of quicklisp\software into asdf:*central-registry*
 (dolist (dir (directory "C:\\Users\\[Your Username]\\AppData\\Roaming\\quicklisp
 (pushnew dir asdf:*central-registry* :test #'equal))
;Once you have SUCCEESSFULLY installed GSLL can remove the semi-colons
;from the following four lines and GSLL will start automatically with Emacs
;(ql:quickload "gsll")
 ;(ql:quickload "lisp-unit")
 ;(in-package :gsl)
 ;(lisp-unit:run-tests :all)

Save file and close Notepad++.

Now we are now Ready to Download SLIME: The Superior Lisp Interaction Mode for Emacs.

Click this link to download the latest SLIME release.

Click Save in the Save/Run Dialog Box.

Go to where you Downloaded it and Unzip the slime-current.tgz file.

Right Click it and place your mouse on the 7-zip entry in the Context Menu and Sliding your mouse to the right and choosing Extract To.

Inside the folder you just extracted is a slime-current.tar file Unzip it by Right Clicking it, placing mouse cursor on 7-zip entry in Context Menu, Sliding to the right and choosing Extract To.

Copy the Folder, inside the Folder you just Extracted, to C:\Program Files (x86)\emacs\site-lisp, replacing C: in the path I provided with whatever your Drive Letter is.

Now Click the runemacs.exe file you placed on your Taskbar in a previous step.

When Emacs opens Press Control-x the Same Way in Windows as when you use the Keyboard Shortcut for Cut to Cut and Paste something then Control-f Immediately after the Same Way – i/e, press Control Key, then without letting go of Control Key, press x Key, then let both Keys go, then immediately after, Press Conrtol Key again and without letting go of Control Key press, f key, then let both go. Now, if you did it correctly, in the thin bottom of the Emacs window, also called the MiniBuffer (Note: From now on I will refer to it as such) it should say Find file. If you don’t see Find file try pressing the Control-x and Control-f Key Combination again with the above instructions. If Emacs throws you a Command attempted to use minibuffer while in minibuffer error when you try to press the Key Combination, just press Control-g to Quit the MiniBuffer and press the Key Combination again.

Note: In the Emacs Documentation the Control-x and Control-f Key Combination is written in shorthand as C-x C-f . All other Emacs Key Combinations are Represented in the Same Fashion.

Now, Erase all text in the field at the bottom of Emacs to the right of Find file and type ~/.emacs.

Press Enter.

An Empty File will open up in Emacs, Signified by the Blank Page and Flashing Cursor. That File is your Emacs Initialization File named precisely .emacs .

Copy All the Code that is under the ;EMACS Initialization File heading, into the empty .emacs file in Emacs.

Note: Replace the C: in Both Paths in the Code, with your Drive Letter. i\e The Drive Letter of the Partition you are currently using. Replace the slime-2.5 in the,

"C:\\Program Files (x86)\\emacs\\site-lisp\\slime-2.5\\"

,path with the name of your Slime Folder. You can get that by going to C:\Program Files (x86)\emacs\site-lisp in Windows Explorer and Right Clicking the Slime folder inside of it and Clicking Rename, then Right Clicking the Blue highlighted text inside and Clicking Copy. Then Carefully Paste what you just Copied OVER the slime-2.5 entry in the above section not Overwriting anything else besides the slime-2.5 or Slime won’t start:

Note: Make sure in all the Paths in your .emacs file that you use Two Back Slashes instead of One Back Slash as is normally done in Windows or SBCL won’t Recognize the Paths and as a Result will not Function Right…or At All.

;EMACS Initialization File
;Note: This is a commented line, signified by the semi-colon at the ;beginning.
;It won't hurt to leave these lines in, but you can delete them.
;Add to Emacs Initialization File
(add-to-list 'load-path "C:\\Program Files (x86)\\emacs\\bin")
(setq inferior-lisp-program "sbcl")
 (add-to-list 'load-path "C:\\Program Files (x86)\\emacs\\site-lisp
 (require 'slime)
;You can delete the below Section up to but not including (slime) 
;if you would ;like Emacs to stay "White".
(load-theme 'manoj-dark t)
'(default ((t (:family "lucida console" :foundry "outline" :slant normal 
:weight normal :height 138 :width normal)))))
;Starts SLIME Automatically

Take just a Moment to Verify what you Pasted into Emacs matches The Code Directly Above that is Highlighted in Red exactly, then Save the file By Clicking File and then Save on the Emacs Menu Bar then Exit out of Emacs by Clicking File and Quit.

Restart runemacs.exe by clicking its icon on your Taskbar.

You should see Slime Start up it will say Polling for a while and then Connected in the MiniBuffer. If the count next to Polling reaches to over 150 then Slime won’t Start. If this happens verify everything in your .sbclrc file is correct by Right Clicking the .sbclrc file located at C:\Users\[Your Username]\AppData\Roaming and Clicking Edit with Notepad++ then Select All the Code inside the file and Re-Copy all the Code under the ;SBCL Intitialization File heading above, into the file, over it. Change all the Paths again per my Exact instructions, then restart runemacs.exe and if you followed my Exact instructions, Slime will start up.

Now, after Slime has started, in Emacs press Control-x Control-f or C-x C-f like you did previously and Take Note of the path that appears in the MiniBuffer to the right of Find file, Because you will need it in the Next Step.

Now we are Ready to Install QuickLisp A Library Manager for Common Lisp. We need it to Install GSLL.

First we Download quicklisp.lisp. which is QuickLisp‘s Install File.

Click this link to download Quicklisp, save it to your Downloads folder by Clicking Save in the Save/Run Dialog Box that pops up.

Copy the file you downloaded, quicklisp.lisp to the Path You Took Note of in Emacs.

Now go back to the Emacs Window and on the Menu Bar of Emacs click Buffer, Scroll down till you see *inferior-lisp* * and click it. You’ll see something like this in the Window that pops up.
Note: This Window is called a Buffer .

;; Swank started at port: 52049.

In Emacs Paste – by choosing Edit then Paste on the Menu-Bar this Function, (load "quicklisp.lisp"), Exactly as Written, Directly to the Right of the Asterix that is below all the other text.
Note: The Asterix is the Place in Emacs where you Enter in all your Code.
And I will Henceforth Refer to it by its Correct name the REPL (pronounced “Ree-puhl”) or Read-Eval-Print-Loop.

For more information on the REPL go to this link.

Press Enter and wait for it to finish.

You should see this when its done:

==== quicklisp quickstart loaded ====

To continue with installation, evaluate: (quicklisp-quickstart:install)

For installation options, evaluate: (quicklisp-quickstart:help)


Now in Emacs run (quicklisp-quickstart:install), at the REPL, the same way you ran (load "quicklisp") and wait for it to finish.

The function (ql:add-to-init-file), will add Code that will start QuickLisp automatically when you start Emacs to your SBCL Initialization File (C:\Users\[Your Username]\AppData\Roaming\.sbclrc)

So Run that now at the REPL and press Enter when it tells you to Press Enter to continue.

So now Quicklisp will load whenever your Lisp session starts.

Now we Get to Install MinGW, .MinGW, a contraction of Minimalist GNU for Windows, is a minimalist development environment for native Microsoft Windows applications and we need it to install GSLL.

Go to this Link to take you to the MinGW Installation Tool Server Directory where you will Download MinGW, Click on the Directory that has the Most Recent Date in its name. Then, in the page that comes up after you click the link, locate the file named mingw-get-inst ending in .exe and click its link to Download it. And then click Run in the Save/Run Dialog Box.

Click Install
Click Continue

Wait for it to finish.

Click Continue
Click all the checkboxes on that page and choose Mark for installation
Open the Installation menu
Click Apply changes
Click Apply

When it is finished installing, it might take a while, Click Close

Now we Check your MSYS configuration(MSYS is part of the MinGW install). You need to ensure that MSYS knows where it is located so:

Open a Windows Explorer window and go to C:\MinGW\msys\1.0\etc (substitute C: for the drive letter you installed MinGW to)
Within the etc Folder, there is a file named fstab. If there isn’t, rename the fstab.sample file in that folder to fstab. Open it with a Notepad++. You can do this by Right Clicking on it, and in the Context Menu selecting Edit with Notepad++. Edit the file and
ensure that it reads as follows:

<Installation directory> /mingw

Replace the Entire <Installation directory> including angle brackets with C:\MinGW, or substitute C: with your drive letter.

So it should read:

C:\MinGW\ /mingw

Note: Before you save the file, make sure there is one space between the <Installation directory> and the /mingw entries in the file and there is at least one blank line at the bottom below all of the entries that may exist, i/e place your cursor at the end of the line that reads

C:\MinGW\ /mingw

And press enter twice, then Save and close the file.

Now, so the MinGW Shell, MinGW’s Command Window, is easy to access, Lets add it to your Taskbar. Go to C:\MinGW\msys\1.0 and double click the msys.bat file in that folder. Once in opens pin it to your taskbar. You will need it Later in this Tutorial.

Now we Get to change your Environment Settings so Windows knows where MinGW is.

Warning: Adding entries to the Environment Variables is normally harmless. However, if you Delete any Existing Entries, you may Mess up your Environment Settings, and you could Seriously Compromise the Functioning of your Computer.

Please be careful. Proceed at your own risk.

First go to Control Panel.

In the top-right most area of Control Panel where it says View by by, choose Large or Small icons.

Now scroll down until you see System.

Click System

In the left pane click Advanced System Settings.

At the bottom of the box that pops up click Environment Variables.

Click New directly underneath the box at the top that says User variables for [your username]. Don’t click New under the box for System variables.

Now type PATH exactly as written, next to Variable name:

Copy the paths below and then Paste it inside the Variable value: box. Make sure to get all of it. Then after you Paste the text inside the box, change the Drive Letters in all the paths i/e C: to reflect your Drive Letter, if different.

Note: It is Recommended that, for the purposes of this Tutorial, that you didn’t change anything about the paths where you installed all the software to, other than the Drive Letter.

C:\Program Files (x86)\GSL-1.13\bin;C:\MinGW;C:\MinGW\bin;C:\MinGW\msys\1.0\bin;

Now, If you already have a PATH Environment Variable under User variables for [Your Username]. In the Variable value: box Copy\Paste the above paths exactly as written, to the end of all the other paths that are there. Make sure to type a Semi-Colon at the end of the last path, before you Paste, if there isn’t one already. The Semi-Colon is a path separator

Then press OK
Press OK again
Press Apply
Note: Don’t worry if Apply is greyed out and you can’t press it, it won’t affect anything.
And then press OK

Note: Don’t Worry that you don’t have the C:\Program Files (x86)\GSL-1.13\bin folder yet. We’re just getting all the Environment Variables out of the way now, We’ll install GSL-1.13 later.

Now you must Restart your Computer after the addition of these Environment Variables. So, close Emacs by clicking the Red X in the top-right corner of the Emacs window,and when you see the Box that says Active processes exist; kill them and exit anyway?., Click Yes, and Restart your Computer.

Once your Computer is done Restarting we Get to Download and Build Libffi

Check out this Link for more information on Libffi.

Download Libffi from this link. Click Save on the Save/Run Dialog Box.

Go to where you Download Libffi to.

Unzip the libffi-3.0.13.tar.gz (later version ok) file you downloaded by Right Clicking it and placing mouse on 7-zip entry in Context Menu, sliding to the right and choosing Extract To.

Inside the folder you extracted is a libffi-3.0.13.tar(later version ok) file. Extract it by Right Clicking it and placing the mouse on the 7-zip entry in the Conext Menu, sliding to the right and choosing Extract To.

Now inside the folder you just Extracted is a folder named libffi-3.0.13 or higher version.

Copy that folder to C:\MinGW\msys\1.0\home\[your username] in Windows Explorer. Replacing C: with your Drive Letter(where you installed MinGW). If you don’t see the home folder, start the MinGW Shell executable you pinned to the Start Menu earlier and the home folder will pop up as a result of the MinGW Shell having been opened for the first time.

When it’s done copying, in the MinGW Shell window you already have open, we are going to Build Libffi.

Now, go to the MinGW Shell window and in the MinGW Shell window,


cd libffi-3.0.13/

Note: Change the libffi-3.0.13 in cd libffi-3.0.13/ with the exact name of the Libffi folder you copied to C:\MinGW\msys\1.0\home\[Your Username]. Make sure to leave the Foward Slash on the end.

Press Enter.


./configure --enable-shared

Press Enter.

Note: if you get an Error when you try to run the above command, then Re-Copy your Libffi Folder into C:\MinGW\msys\1.0\home\[Your Username]. Make sure the Libffi Folder you Re-Copy has a bunch of Subfolders and Files in it not just one Libffi Subfolder. To be Safe, Delete the other Folder you copied to C:\MinGW\msys\1.0\home\[Your Username] ,before you Re-Copy. then start again from cd libffi-3.0.13/.

Wait for it to finish. You’ll see the prompt when its done i/e B@B-PC ~/libffi-3.0.13 (B is my Username, by the way, I just used my prompt for an example).



Press Enter and wait for it to finish. You’ll see the prompt when it’s done.


make install

Press Enter and wait for it to finish. You’ll see the prompt when it’s done.

Now, close out of the MinGW Shell window, this is very important or you can’t do the next step.

Now Cut the libffi-3.0.13 (or higher version) folder you moved to C:\MinGW\msys\1.0\home\[Your Username] and Paste it to your C: folder, or, substitute C: for the Drive Letter of your current partition. You must click Cut not Copy.

Now, we Get to Install GSL – The GNU Scientific Library.

The GNU Scientific Library for Lisp is a Wrapper for GSL, Which was written for C and C++. It basically converts the C/C++ Functions into Lisp, Wrapping around the Functions and Calling them from a Lisp IDE.

Just Click this link

Click Run in the Save/Run Dialog Box that will pop up instantly after you click the link.

Then click Next

Click Install

Wait for it to finish. Then Click Close

Now time for the Big Mamacita! – We Get to Install and Hack GSLL The GNU Scientific Library for Lisp.

Now, to Begin, Open up Emacs by clicking the runemacs.exe on your Taskbar and run this at the REPL:

(ql:quickload "gsll")

Wait for it to finish. You’ll know its done because you will get an Error Message like this:

Error while trying to load definition for system gsll from

Unable to load any of the alternatives:
 ("libffi-6.dll" "libffi-5.dll" "libffi.dll")

But that’s OK, That’s what’s supposed to happen. Just part of the Process.

Now close Emacs by clicking the Red X in the top-right corner of the Emacs window. When you see the Box that says Active processes exist; kill them and exit anyway?. Click Yes.

Now we Hack!


C:\Users\[Your Username]\AppData\Roaming\quicklisp\dists\quicklisp\software\osicat-20120407-git\posix\windows.lisp

in Notepad++ by Right Clicking it and choosing Edit with Notepad++

Add ALL the Code, That is Directly Below and is Highlighted in Red, BENEATH ALL THE CODE in the windows.lisp file. It is Very Important That You Do This Step Precisely.

;; HACK to cover lack of stuff in Windows
 (defconstant s-iflnk -9000)
 (defconstant s-ifsock -9001)
 (defconstant s-irgrp -9002)
 (defconstant s-iwgrp -9003)
 (defconstant s-ixgrp -9004)
 (defconstant s-iroth -9005)
 (defconstant s-iwoth -9006)
 (defconstant s-ixoth -9007)
 (defconstant s-isuid -9008)
 (defconstant s-isgid -9009)
 (defconstant s-isvtx -9010)

Now, take time to Verify you copied what is above, Exactly as I have typed it and that it is Beneath All the Other Code in the File.

Then Save the File and Exit Notepad++.

Now, Copy two files, ffi.h and ffitarget.h, from C:\libffi-3.0.13\i686-pc-mingw32\include and Paste them in C:\MinGW\include, or use your path to the \MinGW\include folder if you installed MinGW to a different partition that C:.

Now, Create a file called gsl-config.cmd by Right Clicking your Desktop, Select New with your mouse, Slide over to the right, click New Text Document make sure you don’t Click Rich Text Document.

Rename it gsl-config.cmd.

Right Click the gsl-config.cmd file you just created and Click Edit with Notepad++

Paste the Code Below, in the Box, EXACTLY inside gsl-config.cmd.

@echo off

if "%~1" == "--prefix" (

echo c:\GSL-1.15

) else if "%~1" == "--cflags" (

echo -Ic:\GSL-1.15\include

) else exit /b 1

Now, Take a second to Verify what you pasted into gsl-config.cmd is Exactly what I typed Above in the Box. If it’s not GSLL will throw a GSL-CONFIG.CMD error at us.

Save the gsl-config.cmd when you’re done, and Exit Notepad++

Now move gsl-config.cmd to C:\Program Files (x86)\GSL-1.13\bin and while you are in “C:\Program Files (x86)\GSL-1.13\bin” Folder,

Copy the libgsl-0.dll and the libgslcblas-0.dll files and Paste them in the same folder.

Rename the Copy of libgsl-0.dll, NOT the Original to libgsl.dll

Rename the Copy of libgslcblas-0.dll, NOT the Original to libgslcblas.dll

When you are done the Contents of the C:\Program Files (x86)\GSL-1.13\bin Folder should look like this:


Next , Copy the Complete Contents of C:\libffi-3.0.13\i686-pc-mingw32\.libs and Paste them in C:\MinGW\lib.

You should have Pasted:


into C:\MinGW\lib. You should Verify they are there, if you want to, just to be 100% Sure.

Now we Hack grovel.lisp. CFFi-Grovel is another Lisp Package GSLL Depends on.

Open grovel.lisp which is in C:\Users\[Your Username]\AppData\Roaming\quicklisp\dists\quicklisp\software\cffi_0.11.2\grovel in Notepad++.

Do a Find(Control-f) in Notepad++ for *cc* until you hit the Below Section in the Box. There will be many *cc* entries so please MAKE SURE you find the right one:

Old Version i/e What you have currently in your grovel.lisp file:

(defparameter *cc*
 #+(or cygwin (not windows)) "cc"
 #+(and windows (not cygwin)) "c:/msys/1.0/bin/gcc.exe")

Make sure you change the Old Version Above (i/e what is currently in your grovel.lisp file to be the SAME AS THE UPDATED VERSION BELOW IF AND ONLY IF you followed the Tutorial and installed Mingw to C:. Otherwise Substitute in your Path to gcc.exe in the C:/MinGW/bin/gcc.exe Section of the Below Code(gcc.exe Will always be in MinGW’s \MinGW\bin\ Folder) Also make sure, if you installed MinGW to a different path than C:\ and your path is different than in this section of the code below in the box ->C:/MinGW/bin/gcc.exe, that when you type in your path you use Foward Slashes instead of BackSlashes like I have or the Lisp Interpreter won’t recognize it. and you’ll get an Error.

Updated Version i/e What should be in your grovel.lisp file:

(defparameter *cc*
 #+(or cygwin (not windows)) "cc"
 #+(and windows (not cygwin)) "C:/MinGW/bin/gcc.exe")

Note: The only Difference between the Old Version and the Updated Version is the part Directly After -> #+(and windows (not cygwin)).

Save the File and Exit Notepad++ when you are done Editing.

Now Open:

C:\Users\[Your Username]\AppData\Roaming\quicklisp\dists\quicklisp\software\gsll-20130615-git\gsll.asd

in Notepad++ (might be a later date on the gsll-20130312-git part). Do a Search(Control-f) for the word nothing. (There is only one Entry for the word nothing)

It will take you to this line:

"libgsl" :pathname #+unix "libgsl-unix" #-unix "nothing-here"

Change that, and only that line, so it reads exactly whats Below in the Box,
leave the quotes and everything, and, make sure, when you overwrite that line, the new line is in exactly the same position in the file as the other line was. i/e Overwrite the previous line perfectly, keeping the same indentation:

"libgsl" :pathname #+unix "libgsl-unix" #-unix "libgsl-windows"

In a Nutshell: You’re just changing the "nothing-here" to "libgsl-windows"

Save the File and Exit Notepad++ when you are done Editing.

Now Go to the:


Folder and find the libgsl-unix.lisp file inside of it. Copy and Paste that file into the SAME FOLDER so you have a copy named libgsl-unix – Copy.lisp. Rename the libgsl-unix – Copy.lisp to libgsl-windows.lisp, exactly.

Now we Get to Hack the drakma.asd file(Drakma is one of the Packages GSLL Depend on)


C:\Users\[Your Username]\AppData\Roaming\quicklisp\dists\quicklisp\software\drakma-1.3.2\drakma.asd

In Notepad++.

Add this:

(pushnew ::drakma-no-ssl *features*)

Right Beneath:

(in-package :cl-user)

Which is Directly Beneath all the Copyright Information, 28 lines of
Commented Text, at the Beginning of the drakma.asd file.

It should look like this when your done:

(in-package :cl-user)
 (pushnew ::drakma-no-ssl *features*)
 (unless (find-symbol "STREAM-WRITE-TIMEOUT" :stream)
 (pushnew :lw-does-not-have-write-timeout *features*))

Now Save the File and Exit Notepad++

Go to:


in Windows Explorer.

Find the file named libffi-6.dll in that folder and Copy it and Paste it into:

C:\Program Files (x86)\Steel Bank Common Lisp\1.1.8

so sbcl.exe can see it. sbcl.exe is Steel Bank Common Lisp’s executable file.

Now, Go to:

C:\Program Files (x86)\GSL-1.13\include

in Windows Explorer.

Inside that Folder is one and only one Folder named gsl.

Copy that Folder and Paste it into C:\MinGW\include.



Ok, Now, I’ll make this one easy because to change everything in this last file would take a few steps.


C:\Users\[Your Username]\AppData\Roaming\quicklisp\dists\quicklisp\software\gsll-20130615-git\init\init.lisp

in Notepad++.

This is Important – PASTE THE ENTIRE SECTION OF CODE DIRECTLY BELOW IN THE BOX – and there is alot = ) into the init.lisp file OVERWRITING ALL THE PREVIOUS CONTENTS. Make Sure you get Everything in the Box Below.

Now, verify everything in the file is correct.

Note: It will be hard to verify that everything is correct in that file easily, Once you’ve Pasted. So just know this I tested this Tutorial Many times by Copying and Pasting Everything From this Tutorial, Every time I could Copy and Paste something from the Tutorial I did so. That includes all CODE, all PATHS, all FILENAMES, all LINKS, Everthing I could have Copy and Pasted I did. Everything’s been verified many times so you are getting a secure Tutorial. So you can trust it enough, that for the Verification Purposes of this Section to just go ahead and Re-Copy and Paste the Box Contents, Into a Blank

C:\Users\[Your Username]\AppData\Roaming\quicklisp\dists\quicklisp\software\gsll-20130615-git\init\init.lisp

 ;; Load GSL
 ;; Liam Healy Sat Mar 4 2006 - 18:53
 ;; Time-stamp: <2012-02-19 10:35:34EST init.lisp>
 ;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy
 ;; Distributed under the terms of the GNU General Public License
 ;; This program is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
 ;; (at your option) any later version.
 ;; This program is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; GNU General Public License for more details.
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program. If not, see <>.

(defpackage gsll
 (:nicknames :gsl)
 (:use :common-lisp :cffi)
 (:import-from :grid #:dim0 #:dim1 #:^ #:copy)
 (:export #:dim0 #:dim1 #:copy)
 ;; No actual conflict due to different usage of symbols:
 ;; antik:psi means "pounds per square inch" vs. function #'gsl:psi
 ;; antik:knots means "nautical miles per hour" vs. function #'gsl:knots
 ;; antik:acceleration refers to the time derivative of velocity vs. object 
 ;; si units symbol-macro vs. GSLL's sine integral.
 (:shadowing-import-from :antik #:psi #:knots #:si))

 (append antik::*antik-user-shadow-symbols*
 ;; Where there is a symbol conflict between GSLL and other packages,
 ;; take from the other package
 grid:row ; GSLL alternate is equivalent
 grid:column ; GSLL alternate is equivalent
 iterate:sum ; GSLL histogram function, both pretty obscure
 iterate:multiply ; GSLL function duplicates '*
 antik:polar-to-rectangular ; GSLL's doesn't use vectors
 antik:rectangular-to-polar ; GSLL's doesn't use vectors
 ;; taken from GSLL
 gsll::iterate ; conflict with iterate:iterate, but iterate:iter is a synonym
 (cons '#:gsll antik::*antik-user-use-packages*))

(antik:make-user-package :antik-user) ; Add the new use package and shadow symbols 
;to :antik-user

(in-package :gsl)

(eval-when (:compile-toplevel :load-toplevel :execute)
 (defun gsl-config (arg)
 "A wrapper for tool `gsl-config'."
 (let ((output-stream (sb-ext:process-output
 (sb-ext:run-program "gsl-config.cmd" (list arg)
 :output :stream
 :search t))))
 (read-line output-stream)))

(defun gsl-config-pathname (pn)
 (merge-pathnames pn (pathname (format nil "~a/" (gsl-config "--prefix"))))))

(cffi:define-foreign-library libgslcblas
 (:darwin #+ccl #.(ccl:native-translated-namestring
 (gsl-config-pathname "libgslcblas.dylib"))
 #-ccl #.(gsl-config-pathname "libgslcblas.dylib"))
 (:cygwin "cyggslcblas-0.dll")
 (:unix (:or "" ""))
 (t (:default "libgslcblas")))

(cffi:use-foreign-library libgslcblas)

;; When calling libgsl from emacs built for windows and slime, and
 ;; using clisp built for cygwin, we have to load lapack/cygblas.dll
 ;; before loading cyggsl-0.dll
 #+(and clisp cygwin)
 (cffi:load-foreign-library "/lib/lapack/cygblas.dll")

(cffi:define-foreign-library libgsl
 (:darwin #+ccl #.(ccl:native-translated-namestring
 (gsl-config-pathname "libgsl.dylib"))
 #-ccl #.(gsl-config-pathname "libgsl.dylib"))
 (:cygwin "cyggsl-0.dll")
 (:unix (:or "" ""))
 (t (:default "libgsl")))

(cffi:use-foreign-library libgsl)

Then Save file

and Exit out of Notepad++

AND….YOU’RE DONE!!!!….Now Let’s Test it Out!


(ql:quickload "gsll")

at the REPL in Emacs and wait for it to finish.
It Will take a Couple Minute and alot of lines will scroll by but when it stops, if the last line above the REPL reads”



If you got an Error, you can go to a Database I created of Error Messages and their Solutions to Troubleshoot the Error by Clicking this Link.

If that Link doesn’t help, Go Back and Re-check everything you did in the Tutorial. I tested this Tutorial 5 times, So you should be able to use it as a Troubleshooting Tool as well.

If you still can’t figure it out I will help you…Post a Comment on the Blog with the Error or send me an E-Mail and I’ll get to you A.S.A.P….Depending on the amount of Requests…is the time it should take.

Note: If you have made alot of Changes on your System It might affect the outcome of this Tutorial. But maybe not. The first time I got this Running It was on a System that had a lot of Differences from a Fresh Install of Windows . As long as All the Code was Copy/Pasted Correctly, The Environment Variables are Correct, All the Files/Folders are in their Proper path and All the Code in All the Files I had you Change Reflect those Paths, All the Filenames you Changed are correct, and you Restarted your System after adding the Environment Variables. It should work fine.

Now, Let’s Test out GSLL!
Now Run all of these commands at the REPL to test your Installation

Run this at the REPL and Wait for it to Finish

(ql:quickload "lisp-unit")

Run this at the REPL and Wait for it to Finish

(in-package :gsl)

Run this at the REPL and Wait for it to Finish


If you Followed my Instructions to the letter, The output from the last command you ran -> (lisp-unit:run-tests)
should be:

Unit Test Summary
 | 3895 assertions total
 | 3697 passed
 | 198 failed
 | 0 execution errors
 | 0 missing tests

#<TEST-RESULTS-DB Total(3895) Passed(3697) Failed(198) Errors(0)>

That is a Great Percentage of Tests Passed.!
Because GSLL wasn’t made for Windows Primarily, it was made for UNIX Systems, not everything will work. But hey if you can Figure out how to make the Remaining Tests work…Please post back to my Blog. I will devote a Section of My Blog to Outlining your Hack and I WILL Make Sure you get the RESPECT you Deserve. So leave contact Information. Because It might make you Famous.

Now, The Very Last Step:
If you followed the Tutorial to the Letter, and got GSLL running Congratulations! You have Successfully Hacked GSLL. Now if you want GSLL to start automatically with Emacs, even though it will make Emacs take about 2 Extra Minutes to Start Up, just Open up C:\Users\[Your Username]\AppData\Roaming\.sbclrc in Notepad++ and Remove the Semi-Colons from the Beginning of the Following four lines in your .sbclrc file Displayed in RED.

;(ql:quickload "gsll")
;(ql:quickload "lisp-unit")
;(in-package :gsl)
;(lisp-unit:run-tests :all)

Now, Save the file and Exit Notepad++ and next time you start Emacs, GSLL will Start Automatically.

Well thats it for the Tutorial. I hope you have enjoyed it.
Take Care and God Bless and…..
Happy Coding.

Joe W. BiMedina


Posted June 23, 2013 by Joe W. BiMedina

%d bloggers like this: