Crosscompiling Linux->Windows

Discussion of Common Lisp

Crosscompiling Linux->Windows

Postby schoppenhauer » Sat Sep 13, 2008 3:52 pm

There are Times when I do not want to give my Sourcecode to someone else, but want to show what I have been programming yet. As I am working mostly under Linux, and most other people do under Windows, I always have to boot Windows and compile everything in there.
I would like to have a possibility to compile my stuff under Linux, but in a way that it can be run under Windows.
As far as I read, the fas-Files from CLISP consist of portable bytecode, so it should be possible to use a windows-clisp to run them. My problem is - as I am using the clc, the fas-Files are in /var/cache/common-lisp-compiler/..., but what do I have to do to use them under a windows-version of clisp? Where to put them, how to load them, without source? I am using an ffi-Binding, could this become a problem?
Another thought I had was to try to set up an environment using clisp, mingw and wine, and to try to save the executable directly. I dont know if this can work, at least it sounds very hard to create and not very "stable".
schoppenhauer
 
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany

Re: Crosscompiling Linux->Windows

Postby humpolec » Sun Sep 14, 2008 8:11 am

Just distribute a zip archive with clisp.exe, your FAS files, and a .bat file running them (the appropriate command-line options should be in clisp's man page).
As for saving executable directly - clisp (as it's licensed under GPL) prohibits distribution of modified binaries without your program's source code. See clisp's FAQ for details of what you can and can't distribute without sources.
User avatar
humpolec
 
Posts: 14
Joined: Sun Aug 17, 2008 1:37 pm
Location: Poland

Re: Crosscompiling Linux->Windows

Postby schoppenhauer » Sun Sep 14, 2008 1:50 pm

humpolec wrote:Just distribute a zip archive with clisp.exe, your FAS files, and a .bat file running them (the appropriate command-line options should be in clisp's man page).
OK, its the -i Option, but there are many fas-Files to load in the correct order. It was a lot of work but it seems to work so far - at least under linux (i couldnt test it under windows yet). Thank you.
humpolec wrote:As for saving executable directly - clisp (as it's licensed under GPL) prohibits distribution of modified binaries without your program's source code. See clisp's FAQ for details of what you can and can't distribute without sources.
clisp has an option for creating executables from its memory images - i thought maybe it could have some extension for cross-compiling. However, I dont want to "distribute" anything, just give it to a few people who wont read the code anyway - I dont like closed source software, so i (mostly) dont use it, and hopfully will never produce it. Thanks for this advice, anyway.
Sorry for my bad english.
Visit my blog http://blog.uxul.de/
schoppenhauer
 
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany

Re: Crosscompiling Linux->Windows

Postby TPJ » Thu Dec 18, 2008 3:38 am

I'm a refugee from the Java world and I'm looking for some way of deploying Lisp apps. I'm not going to use CLisp, though, due to licensing issues (GPL is not an option for me). I have chosen SBCL.

Let's assume that I'll develop my app on my Linux box. The app makes use of some libraries. Finally, I'm happy with it and I want to deploy it on my friend's machine. My friend uses Windows. Is it possible to make a Lisp image on my Linux box and to run it on Windows, provided that the same (native) libraries are available? Of course, the same version of Lisp is also available (it could be distributed with the image file).

(I think that the answer will be similar as in the case of fas files; I just want to make myself sure.)

Edit:
A digression. I have just thought about the following scenario: CLisp programs have to be distributed on the GPL license, provided that they are distributed with the CLisp itself (not always, but let's assume this is the case). And what if I made an image/fas files of my Lisp app, and I'll provide it to my client, but without the CLisp itself? Of course, I'll tell him that CLisp will be needed to run the application, but he will be responsible for installing CLisp for himself (just as he is responsible for installing Java VM for himself, provided he wants to run Java software). It is not distrubuting Lisp programs with the CLisp itself, so it shouldn't be covered by the CLisp license...
TPJ
 
Posts: 11
Joined: Tue Nov 25, 2008 6:37 am
Location: Gliwice, Poland

Re: Crosscompiling Linux->Windows

Postby qbg » Thu Dec 18, 2008 8:39 am

TPJ wrote:Let's assume that I'll develop my app on my Linux box. The app makes use of some libraries. Finally, I'm happy with it and I want to deploy it on my friend's machine. My friend uses Windows. Is it possible to make a Lisp image on my Linux box and to run it on Windows, provided that the same (native) libraries are available? Of course, the same version of Lisp is also available (it could be distributed with the image file).

I'd expect SBCL to complain loudly if you give it a core image dumped from a different SBCL (well, version and compile-time options wise). Building it on a windows SBCL is probably what you will need to do.
Edit:
A digression. I have just thought about the following scenario: CLisp programs have to be distributed on the GPL license, provided that they are distributed with the CLisp itself (not always, but let's assume this is the case). And what if I made an image/fas files of my Lisp app, and I'll provide it to my client, but without the CLisp itself? Of course, I'll tell him that CLisp will be needed to run the application, but he will be responsible for installing CLisp for himself (just as he is responsible for installing Java VM for himself, provided he wants to run Java software). It is not distrubuting Lisp programs with the CLisp itself, so it shouldn't be covered by the CLisp license...

# Programs distributed as Lisp source or #P".fas" files can be distributed without restrictions coming from CLISP.
# Programs distributed as CLISP memory images can be distributed only if accompanied with the non-CLISP #P".fas" files which make up the memory image, and a Makefile (or clear textual instructions) for rebuilding the memory image.
qbg
 
Posts: 64
Joined: Mon Jun 30, 2008 1:05 pm
Location: Minnesota

Re: Crosscompiling Linux->Windows

Postby findinglisp » Tue Dec 23, 2008 1:44 pm

TPJ wrote:I'm a refugee from the Java world and I'm looking for some way of deploying Lisp apps. I'm not going to use CLisp, though, due to licensing issues (GPL is not an option for me). I have chosen SBCL.


Tough choice. Because CLISP compiles to platform-independent byte-code, you would have a better chance getting that to work, though I don't know that even that would for sure. SBCL is definitely not going to work. In particular, I believe SBCL relies on the core file being loaded at the same memory address as it was dumped from. There are lots of nasty dependencies between the core file and the operating system.

Let's assume that I'll develop my app on my Linux box. The app makes use of some libraries. Finally, I'm happy with it and I want to deploy it on my friend's machine. My friend uses Windows. Is it possible to make a Lisp image on my Linux box and to run it on Windows, provided that the same (native) libraries are available? Of course, the same version of Lisp is also available (it could be distributed with the image file).

(I think that the answer will be similar as in the case of fas files; I just want to make myself sure.)


For SBCL, I don't believe this will work, whether core files or FASLs. Is there any reason that you couldn't develop your application on Linux and then recompile on Windows when it's time for delivery?

Edit:
A digression. I have just thought about the following scenario: CLisp programs have to be distributed on the GPL license, provided that they are distributed with the CLisp itself (not always, but let's assume this is the case). And what if I made an image/fas files of my Lisp app, and I'll provide it to my client, but without the CLisp itself? Of course, I'll tell him that CLisp will be needed to run the application, but he will be responsible for installing CLisp for himself (just as he is responsible for installing Java VM for himself, provided he wants to run Java software). It is not distrubuting Lisp programs with the CLisp itself, so it shouldn't be covered by the CLisp license...

[/quote]

Before doing that, I suggest you pose that exact question on the CLISP mailing list. The licensing surrounding CLISP is very confusing, which I think is a real shame since it's otherwise a very nice implementation with a lot of advantages, particularly cross-platform.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
findinglisp
 
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Re: Crosscompiling Linux->Windows

Postby TPJ » Sun Jan 11, 2009 12:58 am

Thanks for your remarks!

Since the time I wrote my post, I got a little more familiar with Lisp, because I got some practice. And I have to say it was a great experience!

I decided to use two Lisp dialects: Common Lisp and Clojure.

I find CL a slightly better than Clojure. Mainly because it doesn't enforce me to do functional programming when I don't want it. Don't get me wrong: I like FP, but not all the time (it's just like with OOP: it's good, but not to solve *all* the problems). Besides, in CL I can use CLOS, which is a way better than OOP in Java. So far, I wasn't able to do OOP in pure Clojure, but I'm still learning.

I have chosen SBCL, because of those licence issues. Besides, I find it a slightly easier to use for a beginner (although my use of SBCL probably leads to not portable CL code).

My main concern about SBCL in particular, and about CL in general, is the need to run my apps on Windows. So far, I wasn't able to install any ASDF-installable package on my SBCL Windows installation. And I expect a problem with GUI on Windows will be much more complicated.

(The other side of this problem is that I'm not too familiar with Windows.)

I have also taken a look at Clojure. While it's more "constrained" than CL (no CLOS, strongly biased towards FP), it's a way better than Java. And since it runs on the Java platform, there are no problems with running Clojure apps on Windows. There are also no problems with GUI libraries: the standard Java Swing might be used (and I like Swing very much).

So I decided to use Clojure for writing portable GUI apps, and use CL (a standard SBCL installation) for everything else. By "everything else" I mean writing engine and server, while client will be a GUI app written in Clojure.

Although SBCL is not officially supported on Windows, it works.

And one more thing. I suppose it's possible to deploy a Lisp application on Windows by means of using ECL to generate portable C code, and then to compile this C code on Windows. In such a scenario, no Lisp interpreter/compiler would be required on Windows; just a C compiler would be needed.

findinglisp wrote:For SBCL, I don't believe this will work, whether core files or FASLs. Is there any reason that you couldn't develop your application on Linux and then recompile on Windows when it's time for delivery?


I'm going to do all my development on Linux. I hate working on Windows. Currently, there is only one reason I can't recompile CL code on SBCL running on Windows: I'm unable to install anything using asdf-install on Windows. It just doesn't work (out-of-the-box).
TPJ
 
Posts: 11
Joined: Tue Nov 25, 2008 6:37 am
Location: Gliwice, Poland

Re: Crosscompiling Linux->Windows

Postby Ramarren » Sun Jan 11, 2009 4:49 am

TPJ wrote:I'm going to do all my development on Linux. I hate working on Windows. Currently, there is only one reason I can't recompile CL code on SBCL running on Windows: I'm unable to install anything using asdf-install on Windows. It just doesn't work (out-of-the-box).


Note that asdf-install doesn't really do anything magical. If you are developing somewhere else, you can install all necessary packages there, and then when deploying just copy the entire site/source directory, or wherever asdf-install puts downloaded files, possibly removing fasl files. There are no symbolic links on Windows, so the best way to go is, I believe, to use a function which will recursively scan directory tree and put all directories with asd files into asdf:*central-registry*.
Ramarren
 
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland


Return to Common Lisp

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron