[fpc-devel] compile fpc for i386 from a 64 bit machine

Alvise Nicoletti alvise.nicoletti at siteland.it
Thu Nov 29 17:20:49 CET 2007


Marc Weustink ha scritto:
> Alvise Nicoletti wrote:
>> Marc Weustink ha scritto:
>>> Alvise Nicoletti wrote:
>>>> Daniƫl Mantione ha scritto:
>>>>> Op Thu, 29 Nov 2007, schreef Alvise Nicoletti:
>>>>>
>>>>>  
>>>>>> Yes, I have the packages needed to open a 32 bit file in my 64 
>>>>>> bits distro
>>>>>> (ubuntu-server): .
>>>>>> linux32 ia32-libs lib32gcc1 lib32stdc++6 lib32z1 libc6-dev-i386 
>>>>>> lib32bz2-dev
>>>>>>
>>>>>> But the fpc compiler version I'm using have bugfixes introduced 
>>>>>> by Joost that
>>>>>> are needed in my application, so I will also need a 32 bit fpc 
>>>>>> compiler with
>>>>>> that inside it...
>>>>>> ... or I am wrong?
>>>>>>     
>>>>>
>>>>> Nothing stops you from compiling a 2.2.1 i386 compiler on an 
>>>>> x86_64 system. It just needs to be bootstrapped with a ppc386, 
>>>>> simply do:
>>>>>
>>>>> make FPC=/path/to/ppc386 CPU_SOURCE=i386
>>>>>
>>>>> ... and voila.
>>>>>   
>>>> Honestly I had some problems to understand the mechanism in this, 
>>>> however, giving that command suppose that you have a  
>>>> "/path/to/ppc386" somewhere, and I hadn't.
>>>> I copyed the binary of my other 32 bit server in the 64 bit server, 
>>>> in the path: /usr/local/lib/fpc/2.2.1/ppc386
>>>> And I did, as you said, a:
>>>> make all FPC=/usr/local/lib/fpc/2.2.1/ppc386 CPU_SOURCE=i386
>>>>
>>>> That seemed to work, it compiled everything, but now I suppose I 
>>>> have to do a "make install"...
>>>>
>>>> But both:
>>>> make install CPU_TARGET=i386
>>>> make install CPU_SOURCE=i386 
>>>
>>> try
>>>  make install CPU_SOURCE=i386 FPC=/path/to/your/fresh/compiled/ppc386
>> Thank you, that seemed to work.
>>
>> However,
>> 1) going on lazarus and choosing ppc386 as compiler, I got no errors 
>> (also the project in the "code" section of "compiler options" is set 
>> to i386).
>> 2) the project compiles well
>> 3) I fail during the link process with that error: "/usr/bin/ld: 
>> skipping incompatible /usr/lib/crti.o when searching for 
>> /usr/lib/crti.o"
>>
>> The file /usr/lib/crti.o exists.
>
> you should have a libdir with 32bit libs and a libdir with 64 bit libs
>
> Edit your fpc.cfg and search for lines beginning with -Fl
> Add similar lines pointing to the 32bit libdir.
>
>
>> In the guide: http://wiki.lazarus.freepascal.org/Cross_compiling
>> something about a ld script was written, I created the scripts as 
>> indicated (plus chmod +x), but I have not launched them.
>>
>> I have to do something related to this?
>
> the compiler will do when needed. You already got beyond that: ld is 
> called (since it complains that it cannot find valid libs)
>
> Marc
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
>
>
I added a /usr/lib32 link to the fpc.cfg, however I have no "crti.o" in 
the /usr/lib32/ folder.
I got the same error trying to cross-compile to a i386 target.

/usr/lib/crti.o is a "ELF 64-bit LSB relocatable, AMD x86-64, version 1 
(SYSV), not stripped"

Who should compile/provide that library at 32 bits?

p.s. so I will have to change the fpc.cfg every time I want to 
crosscompile? or there is a IFDEF(initive) solution?



More information about the fpc-devel mailing list