How to update a dependency with quicklisp? - common-lisp

I have updated quicklisp to the lates version
CL-USER> (ql:update-all-dists)
1 dist to check.
You already have the latest version of "quicklisp": 2017-06-30.
NIL
But this did not update the dependencies to the latest version, ex. Hunchentoot webserver is version 1.2.35, but I need 1.2.37 because of a bugfix.
/home/pio/quicklisp/dists/quicklisp/software/hunchentoot-1.2.35/hunchentoot.asd
How can I update the Hunchentoot to the latest release (https://github.com/edicl/hunchentoot/releases/tag/v1.2.37) with quicklisp?

Ql:quickload will first ask ASDF for locally available systems, which happens in a defined order.
I usually put all Lisp libraries that I want to be found under ~/common-lisp/ which is a standard place ASDF looks into, so it just works.
If you have some other directories, you can make these directories known to ASDF. You can for example use the file ~/.config/common-lisp/source-registry.conf:
(:source-registry
(:tree (:home "repos"))
:inherit-configuration)
This will make ASDF aware of any .asd files under the ~/repos/ directory.
You can then use asdf:load-system or ql:quickload to load such systems (the latter will also resolve and download missing dependencies).
If quicklisp has already installed a system in a different version and ASDF happens to find that version first, you might need to ql:uninstall it beforehand.

Related

How can you make ASDF stop trying to load a nonexistent file?

On Debian, I had a bunch of cruft installed in /usr/lib/sbcl/site-systems that wouldn't load because the FASLs didn't match the version of SBCL that is actually installed.
For some reason, none of these files were associated with any Debian package (this is an old computer that has been running the same Debian install for over a decade– it's on Debian Sid).
I deleted the bad systems one at a time, and for most of them, Quicklisp did the right thing and downloaded the Quicklisp version. Sometimes, ASDF would insist that the system should exist at its previous path, but restarting SBCL got past that problem.
But for one system, ASDF has persistently cached the location of its .asd file as being in the /usr/lib/sbcl/site-systems/ directory. Loading this system is impossible because ASDF will not look anywhere else, even after restarting SBCL.
I tried looking in all the paths specified in various config files under /etc/common-lisp. None of those files contain a reference to the now-missing library.
I've resorted to doing a grep -rli across all the files under /usr. I don't expect that to complete in less than a day, and it might not find anything, in which case I'll be forced to grep the whole hard drive, which might take a whole week. Hopefully, the cache isn't compressed, because then I'll never find it.
Does anyone happen to know how ASDF persists the paths of files?
After a lot of excruciating debugging, I discovered that the files in /usr/lib/sbcl/site-systems/ actually do exist. They're broken symlinks.
The files I deleted were in the similar-looking path /usr/lib/sbcl/site/, to which the symlinks pointed.
Removing the symlinks fixed all the loading errors.
A couple of ideas about troubleshooting Quicklisp, particularly if your getting bizarre behavior.:
If you use Quicklisp for any length of time you'll probably eventually use local packages, found here by default, ~/quicklisp/local-projects It's valid to symlink you're projects into that directory. If you ever rename one of your projects, of course, don't forget to create a new symlink and delete the old one
Likewise, if you rename a local project, also delete the system index which Quicklisp will then recreate the next time it runs: ~/quicklisp/local-projects/system-index.txt Doesn't hurt to delete it from time to time just to keep your system fresh.
your *.fasl files can become stale too, deleting the system cache forces quicklisp to recompile everything. On an Ubuntu system running SBCL that would mean deleting the contents of:
rm -rf ~/.cache/common-lisp
Try updating the Quicklisp client
(ql:update-client)
Potentially deleting and reinstalling Quicklisp itself at ~/quicklisp can be necessary. (It's possible to inadvertently edit source files when your debugging and using Swanks lookup definition feature, breaking installed packages that used to work. Not that I would ever have done something as careless as that.)
Also, don't forget that ASDF decends into directories looking for *.asd files. If you have a stray one that's improperly structured that can cause havoc on you build system. (See my comment above about registering local projects to Quicklisp)
Finally, don't forget to check your lisp init file, e.g. .sbclrc for any debugging or quick and dirty hacks you might have left there and forgot about.
These are all things that have worked for me at one time or another, hopefully I'm not perpetuating legend and cant on things have have long since been fixed!

How to install MJRCALC-system in SBCL by Quicklisp

I've installed SBCL with Quicklisp in my Tumbleweed. Quicklisp has also ASDF inbuilt. After that I also intalled MJRCALC-system in Home/quicklisp/local-projects/mjrcalc-folder. Quicklisp (and ASDF) can recognize the system (in SBCL):
(ql:quickload "mjrcalc")
To load "mjrcalc":
Load 1 ASDF system:
mjrcalc
; Loading "mjrcalc"
("mjrcalc")
The problem is that I can't (or don't know how to) load packages from the mjrcalc-system. I also tried to get a list of the packages in the system without result. Any ideas?
1- look for documentation
2- grep for in-package and/or def.*package

Installing clsql sqlite3 using SBCL + quicklisp

I want to use the sqlite3 interface of clsql. I already install clsql using quicklisp. But when I try to run:
(clsql:with-database (db '("database.db")
:database-type :sqlite3)
nil)
I get
OPERATION-ERROR while invoking #<COMPILE-OP > on
#<CLSQL-UFFI-SOURCE-FILE "clsql-uffi" "uffi" "clsql_uffi">
[Condition of type ASDF/BACKWARD-INTERFACE:OPERATION-ERROR]
It is the same if I just try to quicklisp clsql-uffi.
cl-sql,cl-sql-uffi,cl-sql-sqlite3 and libsqlite3-dev are installed. I am using Ubuntu,Linux.
Edit: Separated the problem topics more clearly.
Installing CLSQL is not always straightforward.
CLSQL builds foreign libraries for its database interfaces, so make sure you have build-essentials installed as well. To check that the foreign libraries compile successfully (and if not, to check the error message), I recommend running make on a terminal in the respective directories.
There's a bug in clsql makefiles that affect certain systems, most notably AWS instances - check if that applies on your system. Fix the makefiles in the quicklisp's clsql directories as necessary.
On earlier Ubuntu versions, I successfully used the distribution's of cl-sql package. On 14.04+, however, they do not usually work too well - so installing clsql from quicklisp is probably a better idea.

Compiling haskell module Network on win32/cygwin

I am trying to compile Network.HTTP (http://hackage.haskell.org/package/network) on win32/cygwin. However, it does fail with following message:
Setup.hs: Missing dependency on a foreign library:
* Missing (or bad) header file: HsNet.h
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Unfortuntely it does not give more clues. The HsNet.h includes sys/uio.h which, actually should not be included, and should be configurered correctly.
Don't use cygwin, instead follow Johan Tibells way
Installing MSYS
Install the latest Haskell Platform. Use the default settings.
Download version 1.0.11 of MSYS. You'll need the following files:
MSYS-1.0.11.exe
msysDTK-1.0.1.exe
msysCORE-1.0.11-bin.tar.gz
The files are all hosted on haskell.org as they're quite hard to find in the official MinGW/MSYS repo.
Run MSYS-1.0.11.exe followed by msysDTK-1.0.1.exe. The former asks you if you want to run a normalization step. You can skip that.
Unpack msysCORE-1.0.11-bin.tar.gz into C:\msys\1.0. Note that you can't do that using an MSYS shell, because you can't overwrite the files in use, so make a copy of C:\msys\1.0, unpack it there, and then rename the copy back to C:\msys\1.0.
Add C:\Program Files\Haskell Platform\VERSION\mingw\bin to your PATH. This is neccesary if you ever want to build packages that use a configure script, like network, as configure scripts need access to a C compiler.
These steps are what Tibell uses to compile the Network package for win and I have used this myself successfully several times on most of the haskell platform releases.
It is possible to build network on win32/cygwin. And the above steps, though useful (by Jonke) may not be necessary.
While doing the configuration step, specify
runghc Setup.hs configure --configure-option="--build=mingw32"
So that the library is configured for mingw32, else you will get link or "undefined references" if you try to link or use network library.
This combined with #Yogesh Sajanikar's answer made it work for me (on win64/cygwin):
Make sure the gcc on your path is NOT the Mingw/Cygwin one, but the
C:\ghc\ghc-6.12.1\mingw\bin\gcc.exe
(Run
export PATH="/cygdrive/.../ghc-7.8.2/mingw/bin:$PATH"
before running cabal install network in the Cygwin shell)

cffi installation

I'm trying to install cffi package into sbcl.
First, I tried clbuild that is recommended on the cffi installation page.
When I tried to run :
clbuild quickload cffi
I was given an error saying :
The function ASDF::SOURCE-REGISTRY is undefined.
I then tried asdf-install, it end up complaining about
Component "cffi-examples" not found
Any help on this would be appreciated.
UPDATE
For asdf-install, I'm running sbcl with slime. It seems that whenever it complains about a component that is missing, that component is actually installed. I just have to abort the debugger and restart Emacs, start slime, and do that install again, and it will finish successfully. If I don't run it with slime, just running it inside sbcl prompt in terminal, it will keep complaining about the component missing nonstop.
So to get cffi installed with asdf-install, I had to restart Emacs for about 4-5 times.
I'm not sure if there is configuration issue with sbcl?
I suppose I should ask this question in different thread.
It's pretty easy with Quicklisp. To install Quicklisp:
Download http://beta.quicklisp.org/quicklisp.lisp
sbcl --load quicklisp.lisp
(quicklisp-quickstart:install)
(ql:add-to-init-file)
Then you can install and load CFFI like so:
(ql:quickload "cffi")
I wrote a bit about how I manage small projects and their required libraries at Making a small Lisp project with quickproject and Quicklisp.
Here are the exact steps for manual installation under Windows 7:
First, download and install SBCL from:
http://www.sbcl.org/platform-table.html
Then download and untar (tar xzf ...) babel, alexandria, trivial-features, and cffi.
Then, start SBCL, load ASDF, and add the paths to these systems to asdf:*central-registry*:
C:\Program Files\Steel Bank Common Lisp\1.0.49>sbcl.exe --core sbcl.core
This is SBCL 1.0.49, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
This is experimental prerelease support for the Windows platform: use
at your own risk. "Your Kitten of Death awaits!"
* (load "asdf/asdf")
T
* (push "C:/Users/dhl/build/asdf/babel_0.3.0/" asdf:*central-registry*)
("C:/Users/dhl/build/asdf/babel_0.3.0/")
* (push "C:/Users/dhl/build/asdf/alexandria/" asdf:*central-registry*)
("C:/Users/dhl/build/asdf/alexandria/" "C:/Users/dhl/build/asdf/babel_0.3.0/")
* (push "C:/Users/dhl/build/asdf/trivial-features_0.6/" asdf:*central-registry*)
("C:/Users/dhl/build/asdf/trivial-features_0.6/"
"C:/Users/dhl/build/asdf/alexandria/" "C:/Users/dhl/build/asdf/babel_0.3.0/")
* (push "C:/Users/dhl/build/asdf/cffi_0.10.6/" asdf:*central-registry*)
("C:/Users/dhl/build/asdf/cffi_0.10.6/"
"C:/Users/dhl/build/asdf/trivial-features_0.6/"
"C:/Users/dhl/build/asdf/alexandria/" "C:/Users/dhl/build/asdf/babel_0.3.0/")
*
(Of course, you'd have to give your paths to the libraries instead of `"C:/Users/dhl/...")
Then, you can load CFFI:
* (asdf:load-system 'cffi)
[much compilation output]
T
*
Now, that's pretty much the bare bones way to install systems for Common Lisp. Nowadays, there is Quicklisp, which is easy to use and covered by Xach's answer. Also, note that there are better ways to register your systems with asdf, like symlinking the asd-files to a single directory on platforms that support symlinking, and ASDF 2 provides a source-registry facility, so you won't have to deal with asdf:*central-registry* at all (I still like it for REPL use).
All in all, I guess Xach's answer provides the easiest way to get a working installation of CFFI, so I recommend his answer and will vote it up, but I already started writing my article before he posted it, and maybe its of some use to you to know how to do things manually.

Resources