Recent

Author Topic: getting fpc cross-compiling on Fedora Linux.  (Read 1856 times)

lazer

  • Full Member
  • ***
  • Posts: 215
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #15 on: October 16, 2022, 12:57:18 pm »
Many thanks for the help Dbannon.

After about 3 days of effort I got it fixed.

Having seen that Fedora don't even support cross compiling and make it impossible for i386, I gave up on my usual prefence of letting the distro handle this package and decided to go from project source for both fpc and lazarus.

Using the distro's 3.2.2 I built 3.3.1 with cross for win32 on i386 and win64 on x64.
make clean all OS_TARGET=win64 CPU_TARGET=x86_64
make clean all OS_TARGET=win32 CPU_TARGET=i386

As you point out the fpc.cfg needed editing because Fedora (logically) puts the x64 builds in /usr/lib64 . It seems with upstream all goes in /usr/lib .

Having built lazarus, and running startlazarus, I was able to select  my 3.3.1 tree in the IDE setup dialogue.
This time it found what it wanted and it all fired up.

The was a grumble about multiple copies of some units files.  It seems lazarus provides these as well as the compiler. I renamed the lazarus units and notunits and it seems fine with that. I don't know whether that was the best choice.

Now I would like to build for win32 on x64 which is what the actual target platform is. A lot of old hardware is x64 but the cheapo entry level windows "Home" gave you a 32 bit OS on 64bit h/w.

Code: Pascal  [Select][+][-]
  1. make clean all OS_TARGET=win32 CPU_TARGET=x86_64
  2. Makefile:235: *** The Makefile doesn't support target x86_64-win32, please run fpcmake first.  Stop.
  3.  

 
Code: Pascal  [Select][+][-]
  1. fpcmake -T x86_64-win32
  2. Processing Makefile.fpc
  3. Error: No targets set
  4.  

Can you advise on how that works?

thanks.

« Last Edit: October 16, 2022, 01:05:56 pm by lazer »

dbannon

  • Hero Member
  • *****
  • Posts: 2370
    • tomboy-ng, a rewrite of the classic Tomboy
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #16 on: October 17, 2022, 02:00:00 am »
Again, by having a distro supplied FPC install there as well as the SourceForge one, you are complicating things so, so unnecessarily. You must now ensure that you PATH points to the new compiler's location BEFORE it get to /usr/bin (or whereever Fedora puts it).

Am I right in saying you are looking for x86_64-win32 ? I most certainly am not a windows expert but I suspect what you want is i386-win32.  If its win32 it assumes the i386 instruction set. All those instructions are available on x86_64 so it runs fine there. Saying win32 on x86_64 does not make sense IMHO.

I build binaries of my app for Win32 i386 and win64 x86_64 and have never been asked for any any other combination. And, to my chagrin, I get more Windows downloads than Linux !

Anyway, other comments, probably not significant -

You have not told us in which dir you are running it, maybe its in the Fedora supplied one and we have established that Fedora has removed the 32bit capability and, again guessing, probably the win32 capability.

Anyway, the Makefile is a ripper !  Have a look through it and see if it mentions win32 - maybe compare that to the Makefile in the content you downloaded from SourceForge.  Mine does mention i386-win32 but most certainly not a 64bit version of that.

Please read https://wiki.freepascal.org/Cross_compiling_for_Windows_under_Linux - the second paragraph is particularly significant.

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

lazer

  • Full Member
  • ***
  • Posts: 215
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #17 on: October 17, 2022, 08:32:14 am »
Thanks, that's probably a fake installation I invented.  I have as little to do with winWorld as possible. An intentionally crippled win32 OS running on x64 hardware would probably refuse to have anything to do with x64 instructions. So what I was envisaging does not make sense.

Before building from source, I removed distro fpc and lazarus, but then found there was no compiler to build with ( I had imagined the tarball would include binaries so that it was not dependent on unknown distro or other compilers ).

I had to reinstall Fedora's fpc to build the upstream source code.

Once I have done makeinstall and set up the symlinks , I checked bash finds the right version:
Code: Pascal  [Select][+][-]
  1. fpc -v
  2. Free Pascal Compiler version 3.3.1 [2022/10/16] for x86_64
  3. Copyright (c) 1993-2022 by Florian Klaempfl and others
  4. Fatal: No source file name in command line
  5. Fatal: Compilation aborted
  6. Error: /usr/bin/ppcx64 returned an error exitcode
  7.  

Just to have a clear conscience, I've now removed the distro fpc and reasserted the cfg and symlinks it kindly removed on the way out.
« Last Edit: October 17, 2022, 08:58:09 am by lazer »

dbannon

  • Hero Member
  • *****
  • Posts: 2370
    • tomboy-ng, a rewrite of the classic Tomboy
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #18 on: October 17, 2022, 09:18:18 am »
Before building from source, I removed distro fpc and lazarus, but then found there was no compiler to build with ( I had imagined the tarball would include binaries so that it was not dependent on unknown distro or other compilers ).
Both the rpm and the tarball includes the native compiles and all the other, related binaries. Not cross compilers but all native stuff is there. See https://wiki.freepascal.org/Installing_the_Free_Pascal_Compiler#FPC_Tar_Balls there is a series of, perhaps, 15 lines that end with the "fpc -v" command demonstrating a clean install.

I had to reinstall Fedora's fpc to build the upstream source code.
No you did not.
Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

lazer

  • Full Member
  • ***
  • Posts: 215
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #19 on: October 17, 2022, 10:48:38 am »
Thanks for the link.
Quote
Compiling the FPC source

    First install the release FPC from rpm/deb or tar balls as described above.

That is what I was following.

Thaddy

  • Hero Member
  • *****
  • Posts: 12950
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #20 on: October 17, 2022, 10:50:06 am »
afaik fedora supports multi-arch but then you must install it.
In memory of Gordon Moore  (January 3, 1929 – March 24, 2023) Just double the heaven every two years from now.

lazer

  • Full Member
  • ***
  • Posts: 215
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #21 on: October 17, 2022, 11:46:40 am »
Yeah, thanks, I'm done with Fedora on this one. A distro is supposed to make life easier and take some of the load. When it makes life harder , I'm out.  Plus support and bug reporting is near non existent on Fedora. Though I have found it generally fairly reliable as long as you stay well behind the curve and let others find the bugs first.  That's why I'm still on F35. ;)




dbannon

  • Hero Member
  • *****
  • Posts: 2370
    • tomboy-ng, a rewrite of the classic Tomboy
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #22 on: October 17, 2022, 12:36:18 pm »
Fedora is an alpha test platform for RedHat. But a bit unfair to blame them here.

You started by insisting on sticking with distro FPC and now you are, apparently, insisting that the Official FPC tar balls don't have any binaries  :o

Anyway, Ubuntu ?  With Ubuntu, you get the same release their commercial customers are using. They have dropped 32bit releases but still have 32bit libraries available in, at least, U2004, supported for some time yet. I cannot speak for U2204 but think its still OK. Debian still makes 32bit releases and has all the 32bit compatibility libraries available for 64bit. I made some comment about the demise of 32bit over there and was quite firmly taken to task. But, please note, Debian/Ubuntu Distro installs of FPC are not, IMHO, suitable for building cross compilers.

Its still a case of installing FPC from the Tarball or RPM and building the cross compilers from there.

I am unaware of any distro that ships FPC Crosscompilers from its repo. I build my releases, Linux (32, 64) debs, rpms etc, Windows (32, 64), RasPi, Pacman from a Ubuntu2004 Virtual Box VM. I guess I could strip out the private stuff and send it to you, its a sizable file ....

Davo





Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

lazer

  • Full Member
  • ***
  • Posts: 215
Re: getting fpc cross-compiling on Fedora Linux.
« Reply #23 on: October 17, 2022, 01:45:49 pm »
Quote
Official FPC tar balls don't have any binaries 
No I didn't.

Quote
You started by insisting on sticking with distro FPC
I started saying I prefered to use distro pkg where possible . When I found it was impossible to build the i386 cross compiler I decided that was not a useful option. Changing ones opinion as a result of new information is often a good idea.
Quote
I could strip out the private stuff and send it to you,
Very kind, but I think I've got clean upto date installation with all cross stuff I need know.  Now to battle with the debugger ...

Thanks for your help on this issue.

 

TinyPortal © 2005-2018