Sign in Join

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

Mailing lists / fpc-pascal / 2013-04

64 bit cross binutils on a 32 bit OS

18 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

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

patspiper

Hi,

Is it possible to build cross binutils to produce win 64 bit files on a 32 bit Linux OS (Ubuntu 32 bit)?

If I set target=x86_64-cygwin, the error is:
'BFD does not support target x86_64-pc-cygwin'

Stephano

Sven Barth
to patspiper
patspiper wrote 8 lines
Hi, Is it possible to build cross binutils to produce win 64 bit files on a 32 bit Linux OS (Ubuntu 32 bit)? If I set target=x86_64-cygwin, the error is: 'BFD does not support target x86_64-pc-cygwin'

Why don't you install binutils-mingw-w64 package? [Note: I don't have Ubuntu, so I don't know whether it exists for your specific version of Ubuntu]

Regards,
Sven

zeljko
to Sven Barth
Sven Barth wrote 12 lines
Am 11.04.2013 10:16, schrieb patspiper: > Hi, > > Is it possible to build cross binutils to produce win 64 bit files on > a 32 bit Linux OS (Ubuntu 32 bit)? > > If I set target=x86_64-cygwin, the error is: > 'BFD does not support target x86_64-pc-cygwin' > Why don't you install binutils-mingw-w64 package? [Note: I don't have Ubuntu, so I don't know whether it exists for your specific version of Ubuntu]

New fedora's also have complete binutils for 32/64 bit.

zeljko

patspiper
to Sven Barth: Why don't you install binutils-mingw-w64 package? [Note: I don't have Ubuntu, so I don't…
Sven Barth wrote 12 lines
Am 11.04.2013 10:16, schrieb patspiper: > Hi, > > Is it possible to build cross binutils to produce win 64 bit files on > a 32 bit Linux OS (Ubuntu 32 bit)? > > If I set target=x86_64-cygwin, the error is: > 'BFD does not support target x86_64-pc-cygwin' > Why don't you install binutils-mingw-w64 package? [Note: I don't have Ubuntu, so I don't know whether it exists for your specific version of Ubuntu]

binutils-mingw-w64 package does not exist for Ubuntu 11.04 (my OS), although it is available in Ubuntu 12.10.

In any case, I have built myself cross binutils for i386/Win32 (cygwin and mingw32), x86_64/Linux, arm/WinCE, and arm/Linux. As an exercise, I would like to do the same for Win64.

Any tips?

Stephano

Pierre Free Pascal
to patspiper
Show quoted text 26 lines
-----Message d'origine----- De : [mailto:fpc-pascal- De la part de patspiper Envoyé : jeudi 11 avril 2013 13:01 À : FPC-Pascal users discussions Objet : Re: [fpc-pascal] 64 bit cross binutils on a 32 bit OS On 11/04/13 11:33, Sven Barth wrote: > Am 11.04.2013 10:16, schrieb patspiper: >> Hi, >> >> Is it possible to build cross binutils to produce win 64 bit files on >> a 32 bit Linux OS (Ubuntu 32 bit)? >> >> If I set target=x86_64-cygwin, the error is: >> 'BFD does not support target x86_64-pc-cygwin' >> > Why don't you install binutils-mingw-w64 package? [Note: I don't have > Ubuntu, so I don't know whether it exists for your specific version of > Ubuntu] binutils-mingw-w64 package does not exist for Ubuntu 11.04 (my OS), although it is available in Ubuntu 12.10. In any case, I have built myself cross binutils for i386/Win32 (cygwin and mingw32), x86_64/Linux, arm/WinCE, and arm/Linux. As an exercise, I would like to do the same for Win64.

The i386-win32 to x86_64-win64 cross-tools give this information:

E:\pas>x86_64-win64-as --version
GNU assembler (GNU Binutils) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-w64-mingw32'.

So building Binutils with --target=x86_64-w64-mingw32 should work for you.

Pierre Muller

patspiper
to Pierre Free Pascal
Pierre Free Pascal wrote 19 lines
> > binutils-mingw-w64 package does not exist for Ubuntu 11.04 (my OS), > although it is available in Ubuntu 12.10. > > In any case, I have built myself cross binutils for i386/Win32 (cygwin > and mingw32), x86_64/Linux, arm/WinCE, and arm/Linux. As an exercise, I > would like to do the same for Win64. The i386-win32 to x86_64-win64 cross-tools give this information: E:\pas>x86_64-win64-as --version GNU assembler (GNU Binutils) 2.22 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-w64-mingw32'. So building Binutils with --target=x86_64-w64-mingw32 should work for you.

It does indeed!

As for cygwin 64 bits, it seems that a patch for cygwin 64 support was applied on 4.3.2013
(http://cygwin.cybermirror.org/64bit/x86_64-pc-cygwin-binutils-20130304.patch), but it seems it is still not included in binutils 2.23.2

Thanks!

Stephano

Pierre Free Pascal
to patspiper
Show quoted text 9 lines
> So building Binutils with --target=x86_64-w64-mingw32 > should work for you. It does indeed! As for cygwin 64 bits, it seems that a patch for cygwin 64 support was applied on 4.3.2013 (http://cygwin.cybermirror.org/64bit/x86_64-pc-cygwin-binutils- 20130304.patch), but it seems it is still not included in binutils 2.23.2

Anyhow, there is no cygwin target for Free Pascal, neither win32 nor win64.

It wouldn't be impossible to create...
but someone would have to volunteer!

Pierre Muller

patspiper
to Pierre Free Pascal: Anyhow, there is no cygwin target for Free Pascal, neither win32 nor win64. It wouldn't…
Pierre Free Pascal wrote 11 lines
>> So building Binutils with --target=x86_64-w64-mingw32 >> should work for you. > It does indeed! > > As for cygwin 64 bits, it seems that a patch for cygwin 64 support was > applied on 4.3.2013 > (http://cygwin.cybermirror.org/64bit/x86_64-pc-cygwin-binutils- > 20130304.patch), > but it seems it is still not included in binutils 2.23.2 Anyhow, there is no cygwin target for Free Pascal, neither win32 nor win64.

My Linux->Win32 cross compilation uses cygwin cross binutils.

i686-cygwin-as --version:
GNU assembler (GNU Binutils) 2.23.1
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty.
This assembler was configured for a target of `i686-cygwin'.

However, I have been recently plagued with a snag when creating cross compilers (from Ubuntu 32 bits):
i386-win32 / FPC 2.6.3: success
x86_64-win64 / FPC 2.6.3: success
x86_64-linux / FPC 2.6.3: fail
arm-winCE / FPC 2.6.3: success
arm-linux / FPC 2.6.3: fail

i386-win32 / FPC 2.7.1: fail
x86_64-win64 / FPC 2.7.1: fail
x86_64-linux / FPC 2.7.1: fail
arm-winCE / FPC 2.7.1: fail
arm-linux / FPC 2.7.1: fail

The failure message is always similar to:
.../fpc/crossbinutils/bin/x86_64-linux-ld: warning: ./link.res contains output sections; did you forget -T?
.../fpc/crossbinutils/bin/x86_64-linux-ld: cannot find -lgcc .../fpc/crossbinutils/bin/x86_64-linux-ld: cannot find -lc fpdoc.pp(382,1) Error: Error while linking

I am clueless at this stage.

Stephano

Marcos Douglas
to Pierre Free Pascal: The i386-win32 to x86_64-win64 cross-tools give this information: E:\pas>x86_64-win64-as…
Pierre Free Pascal wrote 44 lines
> -----Message d'origine----- > De : [mailto:fpc-pascal- > De la part de patspiper > Envoyé : jeudi 11 avril 2013 13:01 > À : FPC-Pascal users discussions > Objet : Re: [fpc-pascal] 64 bit cross binutils on a 32 bit OS > > On 11/04/13 11:33, Sven Barth wrote: > > Am 11.04.2013 10:16, schrieb patspiper: > >> Hi, > >> > >> Is it possible to build cross binutils to produce win 64 bit files on > >> a 32 bit Linux OS (Ubuntu 32 bit)? > >> > >> If I set target=x86_64-cygwin, the error is: > >> 'BFD does not support target x86_64-pc-cygwin' > >> > > Why don't you install binutils-mingw-w64 package? [Note: I don't have > > Ubuntu, so I don't know whether it exists for your specific version of > > Ubuntu] > binutils-mingw-w64 package does not exist for Ubuntu 11.04 (my OS), > although it is available in Ubuntu 12.10. > > In any case, I have built myself cross binutils for i386/Win32 (cygwin > and mingw32), x86_64/Linux, arm/WinCE, and arm/Linux. As an exercise, I > would like to do the same for Win64. The i386-win32 to x86_64-win64 cross-tools give this information: E:\pas>x86_64-win64-as --version GNU assembler (GNU Binutils) 2.22 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-w64-mingw32'. So building Binutils with --target=x86_64-w64-mingw32 should work for you. Pierre Muller

On Windows, using FPC 2.7.1, I use:
make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64

But this not works. I always got the error:
================================================
W:/md/dev/freepascal/compiler/2.7.1/compiler/ppc.exe fpmake.pp -FuW:/md/dev/fre epascal/compiler/2.7.1/packages/fpmkunit/units_bs/i386-win32 -FuW:/md/dev/freepa scal/compiler/2.7.1/rtl/units/i386-win32
Fatal: Can't find unit process used by fpmkunit
Fatal: Compilation aborted
make[3]: *** [fpmake] Error 1
make[3]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1/packages' make[2]: *** [packages_all] Error 2
make[2]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1' make[1]: *** [build-stamp.x86_64-win64] Error 2
make[1]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1' make: *** [crossinstall] Error 2
================================================

Using FPC 2.6.2 works perfectly.

Best regards,
Marcos Douglas

Schindler Karl-Michael
Show quoted text 10 lines
Message: 7 Date: Thu, 11 Apr 2013 15:06:45 +0200 From: Schindler Karl-Michael Subject: [fpc-pascal] Re: fpc-pascal Digest, Vol 106, Issue 26 To: Message-ID: Content-Type: text/plain; charset=us-ascii I was successful with target=x86_64-w64-mingw32

As well as --program-prefix=x86_64-win64-

My complete configure command is:
./configure --target=x86_64-w64-mingw32 --prefix=/usr/local/lib/x86_64-win64 --bindir=/usr/local/bin --mandir=/usr/local/share/man --infodir=/usr/local/share/info --program-prefix=x86_64-win64- --disable-werror

The prefix and the program-prefix enable the coexistence of several crossbinutils.

Pierre Free Pascal
to Marcos Douglas: On Thu, Apr 11, 2013 at 8:15 AM, Pierre Free Pascal On Windows, using FPC 2.7.1, I use:…
Show quoted text 20 lines
On Windows, using FPC 2.7.1, I use: make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 But this not works. I always got the error: ================================================ W:/md/dev/freepascal/compiler/2.7.1/compiler/ppc.exe fpmake.pp - FuW:/md/dev/fre epascal/compiler/2.7.1/packages/fpmkunit/units_bs/i386-win32 - FuW:/md/dev/freepa scal/compiler/2.7.1/rtl/units/i386-win32 Fatal: Can't find unit process used by fpmkunit Fatal: Compilation aborted make[3]: *** [fpmake] Error 1 make[3]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1/packages' make[2]: *** [packages_all] Error 2 make[2]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1' make[1]: *** [build-stamp.x86_64-win64] Error 2 make[1]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1' make: *** [crossinstall] Error 2 ================================================

Starting with fpc-2.6.2 release,
this completes successfully for me:
make distclean crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 PREFIX=e:/pas/fpc-2.7.1

Stating with a 2.7.1 win32 binary:
E:\pas>fpc -iVDW
2.7.1 2013/03/28 2.7.1-r1:24029M
(Meaning that I do have some local modifications, but I doubt those interfere with your problem...) I get the same success...

Did you use a distclean before the crossinstall?
win32 fpmake.exe generated for native win32 target might be a problem... I checked, and indeed, if you just do a native install followed by a crossinstall without a distclean in between, you do get
E:/pas/trunk/fpcsrc/compiler/ppc.exe src/fpmkunit.pp -FuE:/pas/trunk/fpcsrc/rtl/units/i386-win32 -FuE:/pas/trunk/fpcsrc /packages/paszlib/units/i386-win32 -FuE:/pas/trunk/fpcsrc/packages/fcl-process/units/i386-win32 -FuE:/pas/trunk/fpcsrc/p ackages/hash/units/i386-win32 -FUunits_bs/i386-win32 -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-proce ss/src/win -Fu../fcl-process/src -Fi../fcl-process/src/win32 -Fi../fcl-process/src/dummy make[4]: Leaving directory `E:/pas/trunk/fpcsrc/packages/fpmkunit' E:/pas/trunk/fpcsrc/compiler/ppc.exe fpmake.pp -FuE:/pas/trunk/fpcsrc/packages/fpmkunit/units_bs/i386-win32 -FuE:/pas/t runk/fpcsrc/rtl/units/i386-win32
Fatal: Can't find unit process used by fpmkunit
Fatal: Compilation aborted
make[3]: *** [fpmake] Error 1

So the solution to your problem really is
to run a 'distclean' make target before the 'crossinstall' target.

Pierre Muller

waldo kitty
to leledumbo: neither win32 nor win64. Could I ask what for? Cygwin is Unix emulation layer on M$…
leledumbo wrote 5 lines
> Anyhow, there is no cygwin target for Free Pascal, neither win32 nor win64. Could I ask what for? Cygwin is Unix emulation layer on M$ Windows, what is it good for when you can target Windows natively?

not that i use either but...

why use cygwin when mingw is available?

what is the difference between the two?

can i compile an app with either one and then run that app natively on winwhatever /without/ having to install either cygwin or mingw?

Marcos Douglas
to Pierre Free Pascal: Starting with fpc-2.6.2 release, this completes successfully for me: make distclean…
Pierre Free Pascal wrote 51 lines
> On Windows, using FPC 2.7.1, I use: > make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 > > But this not works. I always got the error: > ================================================ > W:/md/dev/freepascal/compiler/2.7.1/compiler/ppc.exe fpmake.pp - > FuW:/md/dev/fre > epascal/compiler/2.7.1/packages/fpmkunit/units_bs/i386-win32 - > FuW:/md/dev/freepa > scal/compiler/2.7.1/rtl/units/i386-win32 > Fatal: Can't find unit process used by fpmkunit > Fatal: Compilation aborted > make[3]: *** [fpmake] Error 1 > make[3]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1/packages' > make[2]: *** [packages_all] Error 2 > make[2]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1' > make[1]: *** [build-stamp.x86_64-win64] Error 2 > make[1]: Leaving directory `W:/md/dev/freepascal/compiler/2.7.1' > make: *** [crossinstall] Error 2 > ================================================ Starting with fpc-2.6.2 release, this completes successfully for me: make distclean crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 PREFIX=e:/pas/fpc-2.7.1 Stating with a 2.7.1 win32 binary: E:\pas>fpc -iVDW 2.7.1 2013/03/28 2.7.1-r1:24029M (Meaning that I do have some local modifications, but I doubt those interfere with your problem...) I get the same success... Did you use a distclean before the crossinstall? win32 fpmake.exe generated for native win32 target might be a problem... I checked, and indeed, if you just do a native install followed by a crossinstall without a distclean in between, you do get E:/pas/trunk/fpcsrc/compiler/ppc.exe src/fpmkunit.pp -FuE:/pas/trunk/fpcsrc/rtl/units/i386-win32 -FuE:/pas/trunk/fpcsrc /packages/paszlib/units/i386-win32 -FuE:/pas/trunk/fpcsrc/packages/fcl-process/units/i386-win32 -FuE:/pas/trunk/fpcsrc/p ackages/hash/units/i386-win32 -FUunits_bs/i386-win32 -Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src -Fi../fcl-proce ss/src/win -Fu../fcl-process/src -Fi../fcl-process/src/win32 -Fi../fcl-process/src/dummy make[4]: Leaving directory `E:/pas/trunk/fpcsrc/packages/fpmkunit' E:/pas/trunk/fpcsrc/compiler/ppc.exe fpmake.pp -FuE:/pas/trunk/fpcsrc/packages/fpmkunit/units_bs/i386-win32 -FuE:/pas/t runk/fpcsrc/rtl/units/i386-win32 Fatal: Can't find unit process used by fpmkunit Fatal: Compilation aborted make[3]: *** [fpmake] Error 1 So the solution to your problem really is to run a 'distclean' make target before the 'crossinstall' target.

Thank you very much, worked!
I used "distclean" before, but I don't remember why I remove from my script.

Do you know if 'make clean' and 'make distclean' is the same?

Regards,
Marcos Douglas

leledumbo
to waldo kitty: not that i use either but... why use cygwin when mingw is available? what is the…
why use cygwin when mingw is available?

Highly *nix tied programs that needs quick porting can use it (e.g.: those that use X11).

what is the difference between the two?

MinGW doesn't implement the *nix layer (Msys does, though only for the shell and small programs, not the whole system), it only consists of GCC port (with binutils and friends) linked against M$ C runtime library.

can i compile an app with either one and then run that app natively on

winwhatever /without/ having to install either cygwin or mingw?

All Cygwin binaries depend on cygwin1.dll, so you must distribute that with the program. With MinGW, there's a smaller C runtime library that must be distributed as well. I don't remember either provide statically linked version of those libraries.

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/64-bit-cross-binutils-on-a-32-bit-OS-tp5714083p5714105.html Sent from the Free Pascal - General mailing list .
waldo kitty
to leledumbo: Highly *nix tied programs that needs quick porting can use it (e.g.: those that use X11).…
leledumbo wrote
> why use cygwin when mingw is available? Highly *nix tied programs that needs quick porting can use it (e.g.: those that use X11).

ok...

Show quoted text 5 lines
> what is the difference between the two? MinGW doesn't implement the *nix layer (Msys does, though only for the shell and small programs, not the whole system), it only consists of GCC port (with binutils and friends) linked against M$ C runtime library.

hummm... ok...

Show quoted text 7 lines
> can i compile an app with either one and then run that app natively on winwhatever /without/ having to install either cygwin or mingw? All Cygwin binaries depend on cygwin1.dll, so you must distribute that with the program. With MinGW, there's a smaller C runtime library that must be distributed as well. I don't remember either provide statically linked version of those libraries.

thank you for the information... i've marked it to be saved for future reference if it comes up for my needs ;)

Tomas Hajny
to waldo kitty
waldo kitty wrote 10 lines
On 4/12/2013 02:44, leledumbo wrote: >> can i compile an app with either one and then run that app natively on > winwhatever /without/ having to install either cygwin or mingw? > > All Cygwin binaries depend on cygwin1.dll, so you must distribute that > with > the program. With MinGW, there's a smaller C runtime library that must > be > distributed as well. I don't remember either provide statically linked > version of those libraries.

I believe that mingw binutils (included with our releases) do not require any additional library.

Moreover, one must distinguish compiling an aplication with cygwin port of GCC from using cygwin binutils for assembling and/or linking applications compiled with FPC (or some other compiler) - there are no direct implications regarding runtimes, etc., for the latter (equally to mingw binutils).

Tomas