Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-04

OpenBsd cross compiler

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

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":

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.

BTW. I'm on Linux x86_64 (Ubuntu 11.10).

Regards,
Leonardo M. Ramé
http://leonardorame.blogspot.com

Reply by email

Pierre Free Pascal
to Leonardo M. Ramé

Hi Leonardo,

Show quoted text 13 lines
-----Message d'origine----- De : [mailto:fpc-devel- 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)

Show quoted text 13 lines
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»

Show quoted text 11 lines
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

Reply by email

Leonardo M. Ramé
to Pierre Free Pascal
Show quoted text 109 lines
________________________________ From: Pierre Free Pascal To: 'Leonardo M. Ramé' ; 'FPC developers' list' Sent: Friday, April 27, 2012 11:20 AM Subject: RE: [fpc-devel] OpenBsd cross compiler   Hi Leonardo, > -----Message d'origine----- > De : [mailto:fpc-devel- > 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

Thanks Pierre, I'll try the binutils package you uploaded. 

Leonardo M. Ramé
http://leonardorame.blogspot.com

Reply by email

Leonardo M. Ramé
to Leonardo M. Ramé
Show quoted text 115 lines
________________________________ From: Leonardo M. Ramé To: 'FPC developers' list' Sent: Saturday, April 28, 2012 8:38 AM Subject: Re: [fpc-devel] OpenBsd cross compiler >________________________________ > From: Pierre Free Pascal >To: 'Leonardo M. Ramé' ; 'FPC developers' list' >Sent: Friday, April 27, 2012 11:20 AM >Subject: RE: [fpc-devel] OpenBsd cross compiler > >  Hi Leonardo, > >> -----Message d'origine----- >> De : [mailto:fpc-devel- >> 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

Reply by email

Pierre Free Pascal
to Leonardo M. Ramé
Hi Pierre, finally I got the time to test this. Sadly, this is the "./configure --target=i386-pc-openbsd -program-prefix=i386-openbsd-"

output.

GNU tools like binutils should normally be
configured using a build directory (not directly in sources) but I think it's mainly important if you want to use the same sources for different targets...

Show quoted text 39 lines
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

The Makefile was created, so the next step is just to generate the binaries using
make all-binutils all-gas all-ld
if that also succeeds, you
should have cross-binutils binaries
that you should be able to install with
make install-binutils install-gas install-ld
prefix=/your/path/to/cross/binutils/base

Pierre

Reply by email