[fpc-devel] OpenBsd cross compiler

Pierre Free Pascal pierre at freepascal.org
Fri Apr 27 16:20:44 CEST 2012


  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




More information about the fpc-devel mailing list