Can not compile to a native executable with Clozure CL on OS X 10.10 Yosemite

468 views Asked by At

I have created a simple hello world (hello.lisp) ,code:

(defun main ()
    (format t "Hello,World"))

, program to test CCL's native executable compilation. I proceed to compile and load buffer from the CCL GUI (using version Clozure Common Lisp Version 1.10-store-r16266 (DarwinX8664)).

When i test it:

    ? (main)
    Hello,World
    NIL
    ?

It finds the main function. When i proceed to compile it with: (save-application "/tmp/h" :toplevel-function #'main :prepend-kernel t), it proceeds with the operation and CCL exits.

The file is created and is arround ~56MB. When i try to run it though I get the following output:

Error: There is no applicable method for the generic function: # when called with arguments: (# :NOTE-CURRENT-PACKAGE #) While executing: #, in process toplevel(6). Error: There is no applicable method for the generic function: # when called with arguments: (# :BREAK-OPTIONS-STRING T) While executing: #, in process toplevel(6). Error: There is no applicable method for the generic function: # when called with arguments: (# :BREAK-OPTIONS-STRING T) While executing: #, in process toplevel(6). Error: There is no applicable method for the generic function: # when called with arguments:

And the errors proceed. What do I do wrong? Is it a bug?

Thank you

2

There are 2 answers

0
Svante On BEST ANSWER

I found the keywords :note-current-package and :break-options-string in the cocoa-ide of the sources. Since prepend-kernel t prepends the kernel that was used in the current session, it seems that you would include the cocoa-ide startup in your application. However, the methods dispatching on those keywords only dispatch on ´ns-application`s, which your new application seems not to be.

The solution might be to prepend a kernel without cocoa-ide, either by loading your code into a non-GUI image, or by using the pathname of such a kernel for the :prepend-kernel argument.

0
Rainer Joswig On

To create executables of Clozure CL on Mac OS X:

  • for non-GUI applications, you need to install Clozure CL from the repository: Installing Clozure CL. You need to download CCL from there. This version comes with an executable Lisp (kernel + image), which hasn't the GUI loaded.

  • for GUI applications you need to use the Application Builder. The corresponding function is ccl::build-application. GUI applications on Mac OS X need some infrastructure, which is created then. Note that CCL comes with a example application in ccl/examples/cocoa/currency-converter/. Personally I would also prefer to use CCL from the repository - it's usually a bit newer than the version in the Mac Application store.