Recent

Author Topic: Cross compile out of the box  (Read 11501 times)

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Cross compile out of the box
« on: September 14, 2017, 03:41:56 pm »
I would love to see working cross compilation available out of the box.

I work mainly on a Mac, but my servers run Linux.

I've never gotten cross compilation to work, so right now I have to use a VM or go grab another machine just to compile for Windows and Linux, not a very good process.

It would also help when trying to convince management that we should try out FPC/Lazarus, any developer on any OS can create and compile the software that will run on various servers and user machines.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Cross compile out of the box
« Reply #1 on: September 14, 2017, 03:49:13 pm »
what do you think about a DevOps layer with Bitbucket and Jenkins for CD/CI?
i think it is used even with Java for cross platform.
Lazarus 2.0.2 64b on Debian LXDE 10

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cross compile out of the box
« Reply #2 on: September 14, 2017, 03:53:36 pm »
I've never gotten cross compilation to work, so right now I have to use a VM or go grab another machine just to compile for Windows and Linux, not a very good process.

I've never quite understood the appeal of cross-compiling, since you still have to copy the resulting executable and any files it depends on at runtime to the target platform. I've always found it easier to just do what you do on my Mac: Ubuntu on VirtualBox (easy to copy files to Ubu from a shared Mac folder) and Windows on an AWS server (again, using a shared folder to copy files).


Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Cross compile out of the box
« Reply #3 on: September 14, 2017, 04:10:09 pm »
I'm using Brook framework to write APIs.

I code and test locally on my Mac, then it's time to get it onto the linux server.

With cross compile I can just compile and transfer the executable.

Without cross compile, I have to load up a vm, transfer the source files or use a linked folder, compile on the vm, then transfer files.

Which means I have to set up a whole VM, version control access, guest additions, fix screen resolution issues, set up folder access, set up Lazarus with the packages I use for a second time.

Now rinse and repeat that once more for Windows.

Or I could cross compile.

That's what the appeal is.

Trying to convince others to develop server software using FPC?

Good luck once they hear about all the extra steps just because cross compilation doesn't work out of the box.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cross compile out of the box
« Reply #4 on: September 14, 2017, 04:13:27 pm »
Good luck once they hear about all the extra steps just because cross compilation doesn't work out of the box.

I assume you've tried to follow the instructions given here:

http://wiki.lazarus.freepascal.org/Cross_compiling

There's nothing out of the box about cross compiling.

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Cross compile out of the box
« Reply #5 on: September 14, 2017, 04:23:07 pm »
I have indeed, and those steps are not the only ones needed.

Exactly, it doesn't support cross compiling out of the box, but it could, it would be a good selling point when trying to sell devs and management on FPC compared to say Java.

It makes life easier.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cross compile out of the box
« Reply #6 on: September 14, 2017, 04:25:55 pm »
It makes life easier.

If you have Windows or Linux AWS instances, setting up FPC and other tools is pretty easy:

https://macpgmr.github.io/MacXPlatform/PascalDynLibs_4.html


Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Cross compile out of the box
« Reply #7 on: September 14, 2017, 04:29:38 pm »
I'll take a look at that page Phil, but it's still not cross compiling out of the box, which is a big selling point.

Tudi, I would like to have a solid devops path for FPC.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Cross compile out of the box
« Reply #8 on: September 14, 2017, 04:47:32 pm »
which is a big selling point.

Is it? I wouldn't put cross-compiling very high on the list of reasons to use Java over Pascal.

I would put FPC in the same group with C, C++ and Swift, where normally you set up the tools on the target platform.


avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Cross compile out of the box
« Reply #9 on: September 15, 2017, 08:51:46 am »
I would love to see working cross compilation available out of the box.
This works for me: http://wiki.freepascal.org/fpcupdeluxe#Crosscompiling
I haven't tested it with Mac, so I don't know if that can be usefull to you.
« Last Edit: September 15, 2017, 08:53:22 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Cross compile out of the box
« Reply #10 on: September 15, 2017, 08:56:41 am »
@avra
I am in the process of adding some more cross-options for Darwin.
Later today, I will publish a new release with some good working cross-compilers.
Still testing now ... please be patient ... ;-)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Cross compile out of the box
« Reply #11 on: September 15, 2017, 04:50:02 pm »
Alright. New release ready. v1.4.0m.
With cross-compilers fom Darwin towards Linux i386 and x86_64 (and some more).

See included picture: don't forget:
Code: Pascal  [Select][+][-]
  1. {$linklib libc_nonshared.a}

Should be / could be / maybe "out-of-the-box" !
New and clean install recommended.
(in case of previous install: remove fpc- and config_lazarus-directories)

Enjoy.
« Last Edit: September 15, 2017, 05:01:31 pm by DonAlfredo »

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Cross compile out of the box
« Reply #12 on: September 16, 2017, 09:52:11 pm »
@DonAlfredo Many thanks!

I couldn't install the 64bit version of FPC/Lazarus through FPCUPDeluxe but the 32bit version works.

I grabbed the latest build, 1.4.0m, both 32 and 64 bit, ended up using 32bit darwin carbon.

The cross compilers installer works great.

I installed cross compilers for both Linux and Windows, and both produced flawless executables, tested and confirmed on real machines (No VM or emulators).

I would still love for this to be the default setup out of the box when downloading from the Lazarus website (This is what people new to Lazarus finds) but having such an easy setup with fpcup deluxe is fantastic.

On a sidenote, the online package manager also works great with the trunk versions of fpc/lazarus, I had issues with earlier versions just not working.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1738
Re: Cross compile out of the box
« Reply #13 on: September 16, 2017, 10:44:54 pm »
Thanks for the positive feedback  :D
Glad that it worked for you.
I am still working on Mac 64 bit.
So stay tuned.

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Cross compile out of the box
« Reply #14 on: September 17, 2017, 12:17:11 am »
It's well deserved, kudos man.

 

TinyPortal © 2005-2018