[Openmcl-devel] cross-compiling for ia32

Greg Pfeil greg at technomadic.org
Thu Nov 8 21:38:45 PST 2007

On 8 Nov 2007, at 21:53, R. Matthew Emerson wrote:

> On Nov 8, 2007, at 7:30 PM, Greg Pfeil wrote:
>> I figured I’d poke around with the ia32 branch of CCL, and started  
>> trying to get a cross-compiler going, using the docs here: http:// 
>> trac.clozure.com/openmcl/wiki/PortToIA-32#Bootstrappingnotes
>> It took me way too long to realize that the problem I’m having is  
>> not because the docs are wrong, but because they assume I’m  
>> building on an x86-64 machine. I only have PPC and x86-32 on hand.
>> So, is there any way for me to go about building a cross-compiler  
>> for x86-32 on PPC, or do I need to buy a new laptop in order to  
>> port CCL to my old laptop?
> Well, that's a good question.  In principle, it should be possible,  
> but I've never put together all the steps needed to make it work.   
> I've only ever used an x86-64 host, as you surmised.  That's partly  
> because my nicest hardware is an x86-64 system, but also because I  
> figured that it might make things a little easier to host on a  
> similar architecture.

Yeah, it was the assumption of the "X86" package, etc. already  
existing that finally clued me in. Having that additional shared code  
between the architectures must help to some extent. I wrangled an  
account on a friend’s x86-64, got svn installed, and managed to get a  
bit farther in the process.

Here's a play-by-play of the issues I ran into. I know how hard it  
can be to explain stuff when things are in transition and I’m not  
asking you to dedicate any time to dealing with my issues on this not- 
even-experimental-yet branch, but thought you might see some  
obviously-wrong things I’m doing here.

I hit my first problem in the bootstrapping stage:

? (compile-file "compiler/X86/x862.lisp")
;Compiler warnings for "/Users/greg/Documents/sources/ClozureCL/ia32/ 
compiler/X86/x862.lisp" :
;   Undeclared free variable X86::*X8632-REGISTER-ENTRIES*, in X86- 
;   Undeclared free variable X86::*X86-OPCODE-TEMPLATES*, in EXPAND- 
 > Error: The function DEFX862 is predefined in OpenMCL.
 > While executing: REDEFINE-KERNEL-FUNCTION, in process listener(1).
 > Type :GO to continue, :POP to abort, :R for a list of available  
 > If continued: Replace the definition of DEFX862.
 > Type :? for other options.
1 >

Should I replace the definition? I end up with a bunch of "predefined  
in OpenMCL" errors through the load statements as well. x86-lap and  
x8664 in particular. If I replace all of the dozens of definitions, I  
get to:

? (compile-ccl t)
;Compiling "/Users/greg/Documents/sources/ClozureCL/ia32/compiler/X86/ 
 > Error: Constant SAVE3.W is already defined with a different value  
 > While executing: CCL::DEFINE-CONSTANT, in process listener(1).
 > Type :GO to continue, :POP to abort, :R for a list of available  
 > If continued: Redefine SAVE3.W to have new value 43
 > Type :? for other options.
1 >

If I then redefine that (and another similar constant), compilation  
finishes and I have a bootstrap image.

After making the new full image with (ccl::save-application  
"dx86.image") and running with that, I get a bunch more of the  
"predefined in OpenMCL" errors in the LOADs for cross-compiling. Then:

? (let ((*target-backend* *x8632-backend*))
   (load "ccl:compiler;X86;X8632;x8632-vinsns.lisp"))
;Compiler warnings :
;   Undeclared free variable *X8632-BACKEND*, in an anonymous lambda  
;   Unused lexical variable *TARGET-BACKEND*, in an anonymous lambda  
 > Error: Unbound variable: *X8632-BACKEND*
 > While executing: #<Anonymous Function #x30004100F38F>, in process  
 > Type :GO to continue, :POP to abort, :R for a list of available  
 > If continued: Retry getting the value of *X8632-BACKEND*.
 > Type :? for other options.
1 >

There I just used the value of ccl::*x8632-backend*, but then I ended  
up at another:

1 > :c 3
Invoking restart: Use the value of CCL::*X8632-BACKEND* this time.
 > Error: Unknown DARWINX8632 instruction in (PUSHL (:@ X8632::MISC- 
 > While executing: SIMPLIFY-FORM, in process listener(1).
 > Type :POP to abort, :R for a list of available restarts.
 > Type :? for other options.
1 >

Which is as far as I’m getting tonight. Thanks for any insight.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20071109/8c27e84b/attachment.bin>

More information about the Openmcl-devel mailing list