Page 1 of 1

Help with asdf

Posted: Fri Jan 23, 2009 1:36 am
by The Mad Scientist
I apologize if this issue has already been dealt with. I couldn't search for "asdf" (since it's a "common word" :roll: ), but I manually went through all seven pages of this forum to make sure no threads about asdf and Common Lisp had already been made.

So, here's my problem: I supposedly have asdf already installed on my system, but I can't find asdf.lisp! I'm running Ubuntu 8.04 and am using Emacs and SLIME. An online tutorial instructed me to try typing (require 'asdf) into my LISP interpreter to see if asdf was already installed, so I did, and the result was NIL. I assume that this means that I already have asdf, since something like (require 'sdfsdg) results in an error.

The next step is supposed to be updating my clisprc file so that asdf is always loaded, but I can't find asdf.lisp. I did a search for "asdf" and got two results: swank-asdf.lisp and slime-asdf.el. The first is supposedly a "plain text document", and the second is an Emacs source code file. Should I be using one of these when I edit my clisprc file?

I'm just a beginner and though I've done some non-trivial stuff with the interpreter, I've yet to compile a LISP file (another source of slight confusion), and I don't have any libraries installed. I want to try to make a simple game in LISP using OpenGL, but to get any library I need asdf and asdf-install. This is what led me to my current quandary.

Any help is appreciated!

The Mad Scientist

Re: Help with asdf

Posted: Fri Jan 23, 2009 2:12 am
by blandest
The Mad Scientist wrote: So, here's my problem: I supposedly have asdf already installed on my system, but I can't find asdf.lisp! I'm running Ubuntu 8.04 and am using Emacs and SLIME. An online tutorial instructed me to try typing (require 'asdf) into my LISP interpreter to see if asdf was already installed, so I did, and the result was NIL. I assume that this means that I already have asdf, since something like (require 'sdfsdg) results in an error.
To test if asdf (or any package) has been loaded type this at the REPL:
CL-USER> (find-package :asdf).
The Mad Scientist wrote: The next step is supposed to be updating my clisprc file so that asdf is always loaded, but I can't find asdf.lisp. I did a search for "asdf" and got two results: swank-asdf.lisp and slime-asdf.el. The first is supposedly a "plain text document", and the second is an Emacs source code file. Should I be using one of these when I edit my clisprc file?
(require 'asdf) should be enough, but you can manually load the file with (load "asdf.lisp") if the first option does not work.
The Mad Scientist wrote: I'm just a beginner and though I've done some non-trivial stuff with the interpreter, I've yet to compile a LISP file (another source of slight confusion), and I don't have any libraries installed. I want to try to make a simple game in LISP using OpenGL, but to get any library I need asdf and asdf-install. This is what led me to my current quandary.
First, you should read this tutorial about asdf-install: http://common-lisp.net/project/asdf-ins ... index.html

Have fun!

Re: Help with asdf

Posted: Fri Jan 23, 2009 3:27 am
by The Mad Scientist
EDIT: So I did another search of my system, this time for "cl-asdf", and found /usr/share/doc/cl-asdf. This baffled me, since I clearly remember doing a search earlier for "asdf" and not finding this directory. Anyway, the readme file said to use the following command to access asdf:

(load "/usr/share/common-lisp/source/asdf/asdf.lisp")

So I finally found the asdf.lisp file! I must say it's a bit confusing that everything relating to CL is buried in /usr/share where I'd never think to look for it. Then again, I recently migrated from Windows, where everything would have been in C:\LISP. :lol:

So now that I know where the file is, I should be able to continue with the tutorial. One basic question though: where do files get saved to when you use the SLIME command(s) to compile them? That confuses me a bit. My guess would be /usr/share/common-lisp? :mrgreen: Also, if I'm just sitting at the SLIME REPL writing code, and I want to save and compile all of it, how would I avoid redundancy (i.e., how would I be sure to compile only the most recent function definitions)? The whole compiling from SLIME thing still confuses me a bit. I'm sure I will eventually figure it out, just like I eventually got SLIME and Emacs to work with CL.

I swear, installing and configuring everything you need to program is ten times harder than programming! And not nearly as fun...

EDIT 2: So I got to the point where I'd compiled asdf.lisp and added it to my clisprc file, created a central registry, and added:

(pushnew "/path/to/your/registry/" asdf:*central-registry* :test #'equal)

to my clisprc file. All was going well. I used the following command to add a symbolic link from my registry to the folder that I downloaded asdf-install.asd to:

cd /path/to/your/registry/
ln -s /path/where/you/put/asdf-install/asdf-install.asd

(Note: I installed the asdf-install directory INSIDE my registry. I'm not sure if this makes a difference.)

I got the response:

ln: creating symbolic link `./asdf-install.asd': File exists

So far, so good. I then went into SLIME and attempted to execute the following, as directed:

(asdf:operate 'asdf:compile-op :asdf-install)

But I got the following error message:

component "asdf-install" not found

So I'm stuck again. :(






Sidenote:

I clicked on the link you provided, which is actually the tutorial that I was reading before I came here.

I went back to the tutorial and downloaded asdf again, just to be sure that I wasn't missing the "asdf.lisp" file. But when I clicked on the "Download ASDF" link, it took me to a page with a .tar.gz of ASDF-Install. Now, if I'm understanding things correctly, ASDF and ASDF-Install are not the same thing. The tutorial could stand to be a lot clearer on that point.

Re: Help with asdf

Posted: Fri Jan 23, 2009 5:27 am
by blandest
Check your asdf:*central-registry* variable. It should contain something like: ("/path/to/asdf-install.asd" ....)
If it doesn't, you'll need to push the asdf-install.asd into the asdf:*central-registry* (not the folder that contains the .asd file).
Also, you can check if the path is correct with (probe-file "/path/to/asdf-install.asd").
Then you'll be able to load it using (asdf:load-oos 'asdf:load-op :asdf-install).

I see that you are using CLISP, but you should give SBCL a try. It comes with asdf-install so all you need to get started is (require 'asdf-install).

Re: Help with asdf

Posted: Fri Jan 23, 2009 3:24 pm
by The Mad Scientist
Okay, so I just switched over to SBCL. Within ten minutes:

CL-USER> (require 'asdf-install)
("ASDF-INSTALL")

Success! It doesn't even look like I have to mess around with the registry and symbolic links and whatnot. Just install a library from SLIME, and I can use it. One thing: will I need to load these libraries every time I want to use them, or can I add the expression that I give SLIME to load them to my initialization file?

Re: Help with asdf

Posted: Fri Jan 23, 2009 5:00 pm
by The Mad Scientist
Update: I decided to install cbuild and use it to get libraries. It just seems cleaner and easier.

Now I'm reading the OpenGL, CFFI, and GLUT manuals.

Re: Help with asdf

Posted: Sun Jan 25, 2009 11:02 pm
by nuntius
The Mad Scientist wrote:Now I'm reading the OpenGL, CFFI, and GLUT manuals.
Before you get too deep, try cl-opengl or cl-glfw...

We don't need yet another gl binding. ;)