I want to use buildapp to make the curl-lisp executable given as an example:
buildapp --output lisp-curl --asdf-path ~/src/clbuild/systems/ \
--load-system drakma \
--eval '(defun main (args) (write-string (drakma:http-request (second args))))' \
--entry main
This will most definitly not work, as I got no path "~/src/clbuild/systems/", as I use quicklisp my systems should be at "~/quicklisp/dists/quicklisp/software", but when I execute:
buildapp --output lisp-curl \
--asdf-path ~/quicklisp/dists/quicklisp/software \
--load-system drakma \
--eval '(defun main (args) (write-string (drakma:http-request (second args))))' \
--entry main
; file: /home/simkoc/dumper-YKYna1b3.lisp
; in: DEFUN DUMP-FILE-DEBUGGER
; (QUIT :UNIX-STATUS 111)
;
; caught STYLE-WARNING:
; SB-EXT:QUIT has been deprecated as of SBCL 1.0.56.55. Use SB-EXT:EXIT or
; SB-THREAD:ABORT-THREAD instead.
;
; In future SBCL versions SB-EXT:QUIT will signal a full warning at compile-time.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
Fatal MISSING-COMPONENT:
Component "drakma" not found
This answer to a question already hints that quicklisp is able to export its systems in a way that buildapp is able to retrieve it, but sadly does not go into details.
I also tried leaving the --asdf-path out, as SBCL (when started) is already able to load Drakma using (require 'drakma) or (asdf:load-system "drakma"). Also using --require instead of --load-system won't do the deal.
Therefore: How can I use buildapp in combination with quicklisp to make an executable with required systems (I just car about the MISSING-COMPONENT PART)
If Drakma is already installed in quicklisp, I think your example will work if you use --asdf-tree instead of --asdf-path. But using the Quicklisp directory as a tree can cause some trouble, as not every system file in the tree is meant to be loaded.
There's another option that more closely integrates with Quicklisp's knowledge of available systems. Here's what I do:
sbcl --no-userinit --no-sysinit --non-interactive \
--load ~/quicklisp/setup.lisp \
--eval '(ql:quickload "drakma")' \
--eval '(ql:write-asdf-manifest-file "quicklisp-manifest.txt")'
buildapp --manifest-file quicklisp-manifest.txt --load-system drakma [the rest of your options]
The first command ensures that drakma has been downloaded, and that an index of the systems Quicklisp knows about is in quicklisp-manifest.txt. The second uses that index to build the application using installed Quicklisp systems.
Related
In a makefile, how would I make sure that certain tools like gcov, lcov, g++ are available before executing any other targets?
I want to gracefully fail with
gcov/lcov/g++ not available
.
You could try something like:
TOOLS := gcov lcov g++
$(foreach TOOL,$(TOOLS),\
$(if $(shell command -v $(TOOL)),,\
$(error Cannot locate $(TOOL) on PATH)))
This assumes you're using a POSIX shell obviously.
I use linux and filter doxygen output as follows:
doxygen 2> >(grep "Arguments.h") 1> /dev/null
which is just to concentrate on failures within Arguments.h.
Now i want to put all that in a minimal makefile for GNU Make 4.3
doc:
doxygen 2> >(grep "Arguments.h") 1> /dev/null
of course later to replace Arguments.h by some other file.
But this does not work: reply is
doxygen 2> >(grep "Arguments.h") 1> /dev/null
/bin/sh: -c: line 0: syntax error near unexpected token `>'
/bin/sh: -c: line 0: `doxygen 2> >(grep "Arguments.h") 1> /dev/null'
make: *** [makefile:2: doc] Error 1
as far as i know make... one has to escape sth, but no idea what...
Any specialists which can help?
This is not related to escaping etc. This is related to which shell is being used.
GNU make (as with all versions of make) always invokes /bin/sh to run recipes, and that is a POSIX standard shell (or some proximity to it). The command you're using is definitely not supported by the POSIX standard, it appears to be using many features available only as enhancements in the bash shell.
If you want to write your recipes using bash features you have to tell make that it should be using bash as the shell, not /bin/sh. You can add this to your makefile:
SHELL = /bin/bash
I've been making my first quicklisp project lately and I wanted to share it. I've put it on github, but not everyone has emacs + slime + quicklisp installed so I wanted to make an executable I could put with the code.
To do this I'm using buildapp and following the steps laid out in this stackoverflow answer.
$ sbcl --no-userinit --no-sysinit --non-interactive \
--load ~/quicklisp/setup.lisp \
--eval '(ql:quickload "ltk-colorpicker")' \
--eval '(ql:write-asdf-manifest-file "quicklisp-manifest.txt")'
$ buildapp --output out \
--manifest-file quicklisp-manifest.txt \
--load-system ltk-colorpicker \
--entry colorpicker
After running those commands I get the following error:
Fatal INPUT-ERROR-IN-LOAD:
READ error during LOAD:
The symbol "*SYSTEM-DEFINITION-SEARCH-FUNCTIONS*" is not external in the ASDF/FIND-SYSTEM package.
Line: 16, Column: 90, File-Position: 15267
Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/nathan/quicklisp/local-projects/ltk-colorpicker/dumper-2SKVI5f7.lisp" {1001B70F83}>
The main problem here is that I don't even have a clue at how to begin to fix it. I've seen this gibhub issue, but that had to do with problems with Homebrew and it never even mentions buildapp. It's all very confusing. And I hope I could get some help.
Thanks in advance for any answers.
I can reproduce the error. As suggested in the comments, you can build an up-to-date version of buildapp as follows:
$ sbcl
* (ql:quickload :buildapp)
...
* (buildapp:build-buildapp
(merge-pathnames "bin/buildapp" (user-homedir-pathname)))
This build $HOME/bin/buildapp. When I use the new binary, there is no error anymore.
You can also avoid generating an executable (that can end up being outdated) by systematically calling the buildapp::main function from Common Lisp; you will then always have the version that corresponds to the current release of quicklisp:
* (buildapp::main
'("BUILDAPP" ;; argv[0] must exist but the value is not important
"--manifest-file" "/tmp/quicklisp-manifest.txt"
"--load-system" "drakma" "--output" "/tmp/test"))
Some extra info from my point:
The solution was to use the newest version of buildapp as #coredump mentioned. I updated by going to the github page, downloading the zip and doing the following commands at the point where buildapp is stored.
$ make
$ cp buildapp /usr/bin
(This of course only works on linux.)
This is not an elegant solution but buildapp hasn't updated in 4 years, I think it's a safe enough bet. I also made a mistake with the command. The --entry part is wrong. It should have been: `--entry ltk-colorpicker::main`` where main is a function that takes one variable since that's required by the spec.
Main is just this: (main (i) (declare (ignore i)) (colorpicker))
I am a beginner at Lisp, having only used DrRacket for some dabbling in Racket/Scheme. I have had much trouble figuring out how to run a .lisp file with Clozure CL for Windows. I tried running a .lisp file in SBCL on Ubuntu (running on virtualbox) without success as well.
I should mention that I've looked into the related questions about running files but I wasn't able to see any direct solution. Some are using .bat files, some are "creating applications" with Clozure CL's image (or something along those lines).
For SBCL in Ubuntu, I've tried:
sbcl lisptest.lisp \ The python/forth way.
(load "lisptest.lisp")
(load lisptest.lisp)
(--load lisptest.lisp)
:cd C:\Temp
(:cd C:\Temp)
and more.
I also tried to run it from notepad++:
cmd /k C:\Temp\ccl-1.11-windows\ccl\wx86cl64.exe "$(FULL_CURRENT_PATH)"
which is how I usually execute python files, but this method hasn't been successful.
**I will definitely start learning to use Emacs and Slime (Emacs is the obvious choice for lisp). But for the sake of knowledge, I would appreciate some tips on the alternative, basic-text-editor way of getting something trivial like "hello world" to print without my typing it explicity into the REPL and instead interpreting (or compiling) a text file with the instruction.
Thanks for your help.
Typically programs have help - did you look at that?
SBCL, Ubuntu, from the shell:
A Common Lisp file:
$ cat test.lisp
(format t "Hello World~%~%")
SBCL shows help:
$ sbcl --help
Usage: sbcl [runtime-options] [toplevel-options] [user-options]
Common runtime options:
--help Print this message and exit.
--version Print version information and exit.
--core <filename> Use the specified core file instead of the default.
--dynamic-space-size <MiB> Size of reserved dynamic space in megabytes.
--control-stack-size <MiB> Size of reserved control stack in megabytes.
Common toplevel options:
--sysinit <filename> System-wide init-file to use instead of default.
--userinit <filename> Per-user init-file to use instead of default.
--no-sysinit Inhibit processing of any system-wide init-file.
--no-userinit Inhibit processing of any per-user init-file.
--disable-debugger Invoke sb-ext:disable-debugger.
--noprint Run a Read-Eval Loop without printing results.
--script [<filename>] Skip #! line, disable debugger, avoid verbosity.
--quit Exit with code 0 after option processing.
--non-interactive Sets both --quit and --disable-debugger.
Common toplevel options that are processed in order:
--eval <form> Form to eval when processing this option.
--load <filename> File to load when processing this option.
User options are not processed by SBCL. All runtime options must
appear before toplevel options, and all toplevel options must
appear before user options.
For more information please refer to the SBCL User Manual, which
should be installed along with SBCL, and is also available from the
website <http://www.sbcl.org/>.
Using the script option from above:
$ sbcl --script test.lisp
Hello World
The same for Clozure CL
$ ccl --help
usage: ccl <options>
where <options> are one or more of:
-h, --help : this text
-V, --version : print (LISP-IMPLEMENTATION-VERSION) and exit
-K, --terminal-encoding : specify character encoding to use for *TERMINAL-IO*
-n, --no-init : suppress loading of init file
-e, --eval : evaluate <form> (may need to quote <form> in shell)
-l, --load : load <file>
-T, --set-lisp-heap-gc-threshold : set lisp-heap-gc-threshold to <n>
-Q, --quiet : if --batch, also suppress printing of heralds, prompts
-R, --heap-reserve <n>: reserve <n> (default: 1610612736)
bytes for heap expansion
-S, --stack-size <n>: set size of initial thread's control stack to <n>
-Z, --thread-stack-size <n>: set default size of first (listener) thread's stacks based on <n>
-b, --batch: exit when EOF on *STANDARD-INPUT*
--no-sigtrap : obscure option for running under GDB
--debug : try to ensure that kernel debugger uses a TTY for I/O
-I, --image-name <image-name>
and <image-name> defaults to ccl.image
Any arguments following the pseudoargument "--" are
not processed and are available to the application as
the value of CCL:*UNPROCESSED-COMMAND-LINE-ARGUMENTS* .
Using the load option from above
$ ccl --load test.lisp --eval '(quit)'
Hello World
 
Try
C:/path/to/ccl -l lisptest.lisp
This should work the same as
(load "lisptest.lisp")
If you can let us know specifically how that fails, we can be of more help.
I (re-)installed Ocaml on OS X using the following steps:
> brew uninstall ocaml
> brew uninstall opam
> brew install ocaml
> brew install opam
> opam init
> eval `opam config env`
> opam switch 4.02.1
> opam install batteries core
I then tried to compile this program:
open Unix
open Printf
let main () =
match fork () with
| 0 -> printf "child\n"
| pid -> printf "parent\n"
let _ = main ()
I compiled using this command:
ocamlc -o fork fork.ml
But I get an error:
File "fork.ml", line 1:
Error: Error while linking fork.cmo:
Reference to undefined global `Unix'
In fact, I was getting this error before reinstalling; that is why I reinstalled in the first place. But the problem persists and I am not sure how to fix it.
unix library is not linked by default, so you need to pass some linking flags, to make it work, e.g.,
ocamlc unix.cma fork.ml -o fork
If you don't want to know anything about cma, you can use ocamlbuild, instead of ocamlc:
ocamlbuild -lib unix fork.native
Or even more general
ocamlbuild -pkg unix fork.native
The latter (with pkg option) would be a preferred way, since it will allow you to specify any package installed with opam. E.g., if you would ever try to use lwt, the you can just link with it with
ocamlbuild -pkg lwt fork.native
For those getting this error while using the OCaml interactive toplevel, the command line syntax is similar to that required by ocamlc:
ocaml unix.cma