[fpc-devel] OpenBsd cross compiler

Leonardo M. Ramé martinrame at yahoo.com
Sat May 5 01:54:04 CEST 2012


>________________________________
> From: Leonardo M. Ramé <martinrame at yahoo.com>
>To: 'FPC developers' list' <fpc-devel at lists.freepascal.org> 
>Sent: Saturday, April 28, 2012 8:38 AM
>Subject: Re: [fpc-devel] OpenBsd cross compiler
> 
>>________________________________
>> From: Pierre Free Pascal <pierre at freepascal.org>
>>To: 'Leonardo M. Ramé' <martinrame at yahoo.com>; 'FPC developers' list' <fpc-devel at lists.freepascal.org> 
>>Sent: Friday, April 27, 2012 11:20 AM
>>Subject: RE: [fpc-devel] OpenBsd cross compiler
>> 
>>  Hi Leonardo,
>>
>>> -----Message d'origine-----
>>> De : fpc-devel-bounces at lists.freepascal.org [mailto:fpc-devel-
>>> bounces at lists.freepascal.org] De la part de Leonardo M. Ramé
>>> Envoyé : jeudi 26 avril 2012 21:10
>>> À : FPC developers' list
>>> Objet : [fpc-devel] OpenBsd cross compiler
>>> 
>>> Hi, I usually create Win32 targets using this:
>>> 
>>> make crossinstall OS_TARGET=win32 CPU_TARGET=i386
>>> PP=/home/leonardo/Desarrollo/fpc/i386-linux-ppc386
>>> 
>>> Now I want to create an OpenBSD cross compiler, so I just replaced "win32"
>>by "openbsd":
>>
>>Yes, but you do need cross-binutils for openbsd!
>>
>>The problem is that current GNU Binutils source do
>>not generate correct objects/executables for openbsd.
>>
>>Which means that you need to get an openbsd specific binutils source
>>install it, and configure it for the target you are interested in:
>>
>>  I checked the internet, and it seems to be difficult to fond.
>>Thus I added it to 
>>ftp://ftp.freepascal.org/pub/fpc/contrib/cross/openbsd/
>>
>>1) Downloaded 
>>ftp://ftp.freepascal.org/pub/fpc/contrib/cross/openbsd/binutils-openbsd-2.15
>>.tar.gz
>>file.
>>
>>2) Untar it
>>tar -xvzf binutils-openbsd-2.15.tar.gz
>>
>>3) Create build directory:
>>mkdir build-cross-i386-openbsd
>>cd build-cross-i386-openbsd
>>4) Run configure for that target
>>../binutils-4.9/configure --target=i386-pc-openbsd
>>  --program-prefix=i386-openbsd-
>>
>>(That's what I used on mingw32, but
>>to compile on mingw you also need to apply
>>the patch that I added in the same directory on ftp server).
>>
>>5) Compile and install everything:
>>make all-gas all-binutils all-ld
>>make install-gas install-binutils install-ld
>>prefix=PATH/TO/WHERE/YOU/WANT/IT
>>
>>This should install 
>>i386-openbsd-as
>>i386-openbsd-ld
>>and a few more into
>>PATH/TO/WHERE/YOU/WANT/IT/bin directory
>>
>>Note that I didn't use the same procedure on mingw
>>(because I wanted to get binaries that did not depend
>>on any mingw specific DLLs)
>>
>>> make crossinstall OS_TARGET=openbsd CPU_TARGET=i386
>>> PP=/home/leonardo/Desarrollo/fpc/i386-linux-ppc386
>>> 
>>> But the linker is not found. This is the error I get:
>>> 
>>> make[5]: se ingresa al directorio
>>> «/home/leonardo/Desarrollo/fpc/rtl/openbsd»
>>> /bin/mkdir -p /home/leonardo/Desarrollo/fpc/rtl/units/i386-openbsd
>>> i386-openbsd-as -o /home/leonardo/Desarrollo/fpc/rtl/units/i386-
>>> openbsd/prt0.o i386/prt0.as
>>> make[5]: i386-openbsd-as: No se encontró el programa
>>> make[5]: *** [prt0.o] Error 127
>>> make[5]: se sale del directorio
>>«/home/leonardo/Desarrollo/fpc/rtl/openbsd»
>>> make[4]: *** [openbsd_all] Error 2
>>> make[4]: se sale del directorio «/home/leonardo/Desarrollo/fpc/rtl»
>>> make[3]: *** [rtl] Error 2
>>> make[3]: se sale del directorio «/home/leonardo/Desarrollo/fpc/compiler»
>>> make[2]: *** [cycle] Error 2
>>> make[2]: se sale del directorio «/home/leonardo/Desarrollo/fpc/compiler»
>>> make[1]: *** [compiler_cycle] Error 2
>>> make[1]: se sale del directorio «/home/leonardo/Desarrollo/fpc»
>>> make: *** [build-stamp.i386-openbsd] Error 2
>>> 
>>> Is there an "i386-openbsd-as" linker?. Where can I find it.
>>
>>  i386-openbsd-as is the assembler, not the linker
>>i386-openbsd-ld is the linker.
>>
>>> BTW. I'm on Linux x86_64 (Ubuntu 11.10).
>>
>>  You could repeat the steps for
>>x86_64-openbsd target
>>by simply using
>>  --target=x86_646pc-openbsd
>>
>>Hoping the above will help,
>>
>>Pierre
>>


Hi Pierre, finally I got the time to test this. Sadly, this is the "./configure --target=i386-pc-openbsd -program-prefix=i386-openbsd-" output.

I'm building this from an x86_64 Linux machine.

Here's the output:

loading cache ./config.cache
checking host system type... x86_64-unknown-linux-gnu
checking target system type... i386-pc-openbsd
checking build system type... x86_64-unknown-linux-gnu
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking for x86_64-unknown-linux-gnu-ar... no
checking for ar... (cached) ar
checking for x86_64-unknown-linux-gnu-as... no
checking for as... (cached) as
checking for x86_64-unknown-linux-gnu-dlltool... no
checking for dlltool... (cached) dlltool
checking for x86_64-unknown-linux-gnu-ld... no
checking for ld... (cached) ld
checking for x86_64-unknown-linux-gnu-nm... no
checking for nm... (cached) nm
checking for x86_64-unknown-linux-gnu-ranlib... no
checking for ranlib... (cached) ranlib
checking for x86_64-unknown-linux-gnu-windres... no
checking for windres... (cached) windres
checking for x86_64-unknown-linux-gnu-objcopy... no
checking for objcopy... (cached) objcopy
checking for x86_64-unknown-linux-gnu-objdump... no
checking for objdump... (cached) objdump
checking for i386-pc-openbsd-ar... no
checking for i386-pc-openbsd-as... no
checking for i386-pc-openbsd-dlltool... no
checking for i386-pc-openbsd-ld... no
checking for i386-pc-openbsd-nm... no
checking for i386-pc-openbsd-ranlib... no
checking for i386-pc-openbsd-windres... no
checking whether to enable maintainer-specific portions of Makefiles... no
creating ./config.status
creating Makefile
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the fpc-devel mailing list