Trying to figure out ASDF

Discussion of Common Lisp
wvxvw
Posts: 127
Joined: Sat Mar 26, 2011 6:23 am

Re: Trying to figure out ASDF

Post by wvxvw » Thu May 05, 2011 1:51 am

Aha, cool, thank you.

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: Trying to figure out ASDF

Post by Indecipherable » Sat Jun 11, 2011 10:14 am

I'm also having a problem. I have created a directory called "Center" in my main Clisp folder.
Then:

Code: Select all

(require 'asdf)
(push #p"\\Program Files\\clisp-2.49\\Center\\" asdf:*central-registry*)
And then I am pretty much lost :lol:
I have downloaded langutils for example, and now I cannot figure out how to load it :roll:
Do I have to do something with those .asd files?
Thanks.

P.s: I am running Windows Vista
Don't take the FUN out of DEFUN !

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Trying to figure out ASDF

Post by gugamilare » Sat Jun 11, 2011 1:20 pm

You seem to be using Windows. Since Windows cannot create symbolic links, you will need to push the directory of each library into asdf:*central-registry*. For instance, if you extracted langutils into the directory called "Center", you should do this:

Code: Select all

(require 'asdf)
(push #p"\\Program Files\\clisp-2.49\\Center\\langutils\\" asdf:*central-registry*)
This is not very user-friendly, I know. You should consider using Quicklisp or Lisp Starter Pack, they both run very neatly from Windows, unlike ASDF or clbuild which were designed for Linux and Mac users.

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: Trying to figure out ASDF

Post by Indecipherable » Sat Jun 11, 2011 1:22 pm

Thanks.
Windows has so many walls :|
Don't take the FUN out of DEFUN !

georgek
Posts: 4
Joined: Sat Jan 29, 2011 11:58 am

Re: Trying to figure out ASDF

Post by georgek » Sun Jun 12, 2011 8:55 pm

Are you using asdf2? Quicklisp is great for replacing asdf-install but asdf is it's own thing.

With asdf2 it's very simple to set up a project directory that will automatically push your projects to the asdf central registry. Then they're easy to load from Quicklisp.

This is what I do on WIndows and it works great:

1. From your home directory create the file .config/common-lisp/source-registry.conf.d/asd-link-farm.conf -- you can call that file whatever you want as long as it has the conf type. So for example, my link-farm is at "C:\Documents and Settings\george\.config\common-lisp\source-registry.conf.d\asd-link-farm.conf". This is on XP, but you just need to find the home directory on your Vista and do the same thing.

2. Create a directory where you'll put your lisp projects. This can be any directory and can include non-lisp things too.

3. In your conf file add

Code: Select all

(:tree "full-path-of-your-lisp-project-directory")
Your Lisp should now scan that directory and its subdirectories. You can add multiple lines for different directories if you wish.

4. When you create a new project put it in one of these directories. Then in your LIsp do (asdf:initialize-source-registry) and the registry will include your new projects loadable via asdf or Quicklisp. Of course if you restart your Lisp it will automatically contain all these projects from the get go (of course you have to load them, but they're accessible).

The creator of Quicklisp has a good post on this topic here, http://xach.livejournal.com/278047.html?thread=674335.

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: Trying to figure out ASDF

Post by Indecipherable » Mon Jun 13, 2011 10:32 am

Thanks :)
But, by "home directory", do you mean the home lisp implementation directory? Do I have to have another directory named "source-registry.conf.d" which contains the .conf file?
Thanks again.
Don't take the FUN out of DEFUN !

georgek
Posts: 4
Joined: Sat Jan 29, 2011 11:58 am

Re: Trying to figure out ASDF

Post by georgek » Mon Jun 13, 2011 5:22 pm

The home directory is your user home directory. The tricky part is that your Windows OS may not call this a 'home directory', but on my Windows XP, for my user 'george' (me), it looks like:

"C:\Documents and Settings\george\"

So the directory for the .conf file is:

"C:\Documents and Settings\george\.config\common-lisp\source-registry.conf.d\asd-link-farm.conf"

Now another trick is that different applications will not always choose your Windows home as their home directory, but if they don't they usually choose a subdirectory of it. For example Emacs on Windows will use the 'Application Data' subdirectory from the user home as its home. But it's likely that your Lisp will choose your Windows home as the 'home directory'.

ASDF2 actually has many rules for where it finds packages, the one I gave as an example is just the simplest. You can read more about it here:

http://common-lisp.net/project/asdf/asd ... or-systems

But the simple explanation is here

http://common-lisp.net/project/asdf/asd ... uring-ASDF

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Trying to figure out ASDF

Post by nuntius » Mon Jun 13, 2011 6:52 pm

To find your "home directory", run (user-homedir-pathname) in lisp.

Indecipherable
Posts: 47
Joined: Fri Jun 03, 2011 5:30 am
Location: Behind you.
Contact:

Re: Trying to figure out ASDF

Post by Indecipherable » Fri Jun 17, 2011 10:12 am

Must my ASDF package also be in the home directory?
Don't take the FUN out of DEFUN !

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Trying to figure out ASDF

Post by nuntius » Fri Jun 17, 2011 10:25 am

Indecipherable wrote:Must my ASDF package also be in the home directory?
No. ASDF packages can be anywhere on the filesystem. Only the config files must be in one of the pre-specified locations.

Note that it should be possible to use shortcuts on windows systems, and even symlinks on Vista or 7; but these are not well supported by ASDF or some CL implementations (i.e. breakage would be unnoticed by the main developers).

ASDF's basic procedure to evaluate (asdf:load-system :foo) is
- look in the config files (or asdf:*central-registry* if non-empty) to find locations for *.asd files
- read each asd file in order until one says (defsystem :foo)
- resolve any symlinks or shortcuts to find the "truename" (actual physical location) of the asd file
- look for source files using paths relative to that truename
- check whether precompiled object files (fasls) exist and load them if current or recompile if stale (timestamp compared to source)
- load in the fasls

Post Reply