So, I have been looking at building CL-GTK2 on  OS X and realized that I know nothing about this stuff.  I will just provide a dump of my understanding of things.  All of this is using a pull from the repo on July 5th, 2009 that I am building on SBCL 1.0.25 on OS X 10.4.  I am in no way a Mac expert (or fan...), so this should all be taken with a grain of salt.  It's not all bad news, see the end.<br>

<br>I installed a GTK framework.  In OS X a framework is basically a bundle of libraries and header files (and a few other odds and ends.  The framework has the following libraries in it:<br><br>$ ls /Library/Frameworks/Gtk.framework/Libraries/<br>

libatk-1.0.0.dylib*           libjpeg.62.dylib*<br>libcairo.2.dylib*             libpango-1.0.0.dylib*<br>libgdk-pixbuf-2.0.0.dylib*    libpangocairo-1.0.0.dylib*<br>libgdk-quartz-2.0.0.dylib*    libpixman-1.0.dylib*<br>
libgtk-quartz-2.0.0.dylib*    libpng12.0.dylib*<br>
libigemacintegration.0.dylib* libtiff.3.dylib*<br>libintl.8.dylib<br><br>So it looks like it contains libgtk and libgdk.  There is also a glib framework (not sure if this was installed with the OS or what) which contains libraries:<br>

<br>$ ls /Library/Frameworks/GLib.framework/Libraries/<br>libgio-2.0.0.dylib*     libgmodule-2.0.0.dylib* libgthread-2.0.0.dylib*<br>libglib-2.0.0.dylib*    libgobject-2.0.0.dylib* libintl.8.dylib<br><br>So that looks like everything we need, and they are all native libraries.  If I add the proper lines (:darwin (:framework "GTK")) and (:darwin (:framework "Glib")) everything builds without warning.  Some examples seem to do nothing while some appear to perhaps almost work.  The CPU usage usually jumps up around to 150% (on my dual core).  If I try the "Hello, World" example from the tutorial:<br>

<br>(gtk:within-main-loop<br>  (let ((window (make-instance 'gtk:gtk-window<br>                                                 :title "Hello, world!" )))<br>    (gtk:widget-show window) ))<br><br>A window does appear, but it has no title or buttons for maximizining/minimizing/closing, so that is weird.  I don't know how to debug something running in a different thread (the stuff I read on line regarding SLIME and attaching threads didn't seem to work), so I don't know what it was doing at 150% CPU load.  Does anyone have any experience with this?<br>

<br>The fact that it builds and a window actually appears makes me think this could be fixed with a little work (on my part, maybe).  It would remove a lot of the dependencies to getting CL application with a GUI running on OS X, and it will satisfy all the whiny Mac users that don't like windows that look different than the current Apple UI.<br>

<br>It absolutely works to link these against Fink or MacPorts libraries (or ones you built from source, if so skilled).  These will have to run underneath the X11 server (that you run on top of the OS X gui).  This is less than ideal as it is not as "integrated" with the OS X environment (e.g. the menu bar is not at the top of the screen and X11 has to be running to run your program), but it is great that it works.  To do this all we need to do is add a (:darwin (:or "libxxx.dylib")) to the library definitions.  Of course it would be up to the user to install these libraries and add the Fink/MacPorts paths to CFFI:*FOREIGN-LIBRARY-DIRECTORIES*.  I could give you a (very simple) patch, but I really don't know how... any tips?<br>

<br>Anyway, thanks for putting together this binding,<br>Zach<br><br>2009/7/4 Zach <span dir="ltr"><<a href="mailto:elzacho@gmail.com">elzacho@gmail.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I run threaded SBCL on OS X and have had no problems (however, the SBCL
developers do list it as experimental).  So, maybe this will still work
on SBCL under OS X.  CMUCL has non-native threads, so I guess that this
should work there too.  Of course CLISP doesn't have threads... and
from what I hear ACL has a working GTK interface.<br><br>One thought, it seems like even if CL-GTK2 didn't spawn a new thread then you could get the same effect by invoking your function via (make-thread #'demo-class-browser).<br>


<br>Zach<br><br><br><div class="gmail_quote">2009/7/4 Kalyanov Dmitry <span dir="ltr"><<a href="mailto:kalyanov.dmitry@gmail.com" target="_blank">kalyanov.dmitry@gmail.com</a>></span><div><div></div><div class="h5">

<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>On Суббота 04 июля 2009 22:22:17 you wrote:<br>
> Thank you for informing me of these new developments.<br>
><br>
> I am happy to report that CL-GTK2 builds just fine on my Ubuntu 8.10 box.<br>
> In addition, the examples seem to work as well.<br>
><br>
</div>That's great news!<br>
<div><br>
> I think I will enjoy playing with this library (and making some GUI<br>
> applications that don't rely on Tk).  I was surprised to see that the<br>
> examples spawn a new thread, any reason for that?<br>
<br>
</div>The primary reason is because of the desire to have the REPL: if GUI is on<br>
another thread, then REPL is "alive" whlie the GUI is running, you can<br>
manipulate objects, redefine functions, etc. and have the GUI respond to<br>
changes (not to all kinds of changes, of course, but e.g. you can redefine the<br>
function that is called by GUI without having to close windows and restart<br>
application).<br>
<br>
This is somewhat explained in recently updated version of tutorial at<br>
<a href="http://common-lisp.net/project/cl-gtk2/tutorial.html" target="_blank">http://common-lisp.net/project/cl-gtk2/tutorial.html</a> (in the "Main loop"<br>
section).<br>
<br>
As far as I know, the only problem this creates is the requirement that the<br>
lisp must be multi-threaded. As for SBCL and Clozure CL on Linux, CCL on Mac,<br>
Allegro it should work fine (don't know about clisp)<br>
<div><br>
><br>
> Also, I will give a stab at getting this to build against the OS X GTK<br>
> framework I recently installed.  Perhaps I can increase the number of<br>
> platforms this works on.<br>
<br>
</div>I guess that on OS X it should work. I am not so sure about Windows, however;<br>
it will require some work.<br>
</blockquote></div></div></div><br>
</blockquote></div><br>