* * *

Author Topic: cross platform build pkg?  (Read 1329 times)

lazer

  • New member
  • *
  • Posts: 25
cross platform build pkg?
« on: October 05, 2017, 03:54:30 pm »
Hi,

one of the significant interests of fpc/lazarus is ability to code once , build everywhere: ie cross-complilation for different platforms.  However, this does not seem to be available in prebuilt packages.

Digging out the appropriate sources files, configuring and shoe-horning into existing distro is quite complex and undesirable from the point of view of having to maintain an out of tree package.

An alternative pkg with the cross-compilers built , would be a nice option.

Since this would not have more dependency issues than a std build, it would likely get adopted by distros too.

Cross-platform development seems to be a great feature of fpc/laz but probably does not get fully explained due to the difficulty of setting it up.


Any chance of that being possible?

thx


JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3263
  • I like bugs.
Re: cross platform build pkg?
« Reply #1 on: October 05, 2017, 07:32:20 pm »
one of the significant interests of fpc/lazarus is ability to code once , build everywhere: ie cross-compilation for different platforms. 
The slogan is actually "Write Once, Compile Anywhere".
No, it is not the same as cross-compilation. For example I compile programs + Lazarus IDE on different OS but I don't use cross-compilation.
On a desktop system it is often easier to install the native version of compiler (+ Lazarus) and use it.
Sometimes cross-compilation is important, for example with embedded targets. There happens to be now another thread for the same question:
 http://forum.lazarus.freepascal.org/index.php/topic,38504
At least 2 solutions, CodeTyphon and Fpcupdeluxe were given.

avra

  • Hero Member
  • *****
  • Posts: 1172
    • Additional info
Re: cross platform build pkg?
« Reply #2 on: October 05, 2017, 08:02:46 pm »
Any chance of that being possible?
It is already possible. I use fpcupdeluxe to download several Lazarus/FPC combos (trunk/stable) on the same pc, and everything needed to cross compile from one of them (Win32) to Win64/Lin32/Lin64 at a click of a button.
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

Leledumbo

  • Hero Member
  • *****
  • Posts: 7745
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: cross platform build pkg?
« Reply #3 on: October 06, 2017, 08:02:27 am »
fpcupdeluxe is the best way to go, since providing precompiled package will probably be a waste of resource. FPC supports over 20 combinations of host->target pair, so we need at least some pairs that people really use. Some people that really cross compile, target exotic platforms such as embedded (that requires precise configuration options when building the toolchain), amiga compatible OS, etc. Some distros like archlinux provide them in its user repository, but that's easier since the host is specific, hence only target platform needs to be the concern. You see, it's not that simple to solve and let people learn how to build one (manually or using helper like fpcupdeluxe) is the better choice.

GetMem

  • Hero Member
  • *****
  • Posts: 2468
Re: cross platform build pkg?
« Reply #4 on: October 06, 2017, 08:14:12 am »
I never understood the hype around cross-compiling. Like it or not, releasing a program slightly complex then a "Hello world" application requires OS specific tweaks, sometimes even debugging to find widgetset specific bugs. Whenever is possible installing Lazarus/FPC is a must in my opinion.  Ok, there are specific cases when this is not possible as @Juha mentioned above and cross-compiling come in handy. As a conclusion cross-compiling is useful but overrated feature or am I mistaken?

Ps: Nowadays installing different distros it's quite trivial because of Virtual Machines.
« Last Edit: October 06, 2017, 08:22:44 am by GetMem »

Leledumbo

  • Hero Member
  • *****
  • Posts: 7745
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: cross platform build pkg?
« Reply #5 on: October 06, 2017, 09:03:24 am »
As a conclusion cross-compiling is useful but overrated feature or am I mistaken?
I wouldn't say it's overrated. It certainly is useful without being overrated. You can generate binaries for multiple platforms in a single build, which are then transferred to each of your testers that do testing in specific OS. Much faster and more efficient than having multiple virtual machines running just for the sake of building internally. This is of course if you have testers, if you're a full stack, then you decide what's best for you.

lazer

  • New member
  • *
  • Posts: 25
Re: cross platform build pkg?
« Reply #6 on: October 06, 2017, 05:30:15 pm »
Any chance of that being possible?
It is already possible. I use fpcupdeluxe to download several Lazarus/FPC combos (trunk/stable) on the same pc, and everything needed to cross compile from one of them (Win32) to Win64/Lin32/Lin64 at a click of a button.

Thanks for the tip.  I was not aware of either of these tools.

Sadly a tool which requires the user to basically become a memner of %wheel makes a joke of linux security.  I may as well just go back to using Windows XP and stop worrying about cross-compilation.

http://www.pilotlogic.com/sitejoom/index.php/wiki/135-wiki/codetyphon-host-oses/522-ct-on-redhat-enterprise-7-3


Quote
    add at the end of /etc/sudoers the line:

    username ALL=(ALL) NOPASSWD: ALL


fpcupdeluxe looked a bit more reasonable but dumped out with an ugly crash at my first attempt to install a x-compiler.

Looks like I may need to do it the hard way.

avra

  • Hero Member
  • *****
  • Posts: 1172
    • Additional info
Re: cross platform build pkg?
« Reply #7 on: October 06, 2017, 07:40:07 pm »
fpcupdeluxe looked a bit more reasonable but dumped out with an ugly crash at my first attempt to install a x-compiler.
Have you satisfied the linux requirements mentioned here: https://github.com/newpascal/fpcupdeluxe ?
Quote
- Linux
=======
- GNU make
- the binutils (make etc); e.g. in a package called build-essential
- bunzip2 (probably present in most distributions)
- unzip
- untar
- subversion client: svn
- gdb is not needed for building FPC/Lazarus but needed for debugging
  your Lazarus programs
- libX11, libgdk_pixbuf-2.0, libpango-1.0, libgdk-x11-2.0

E.g. on Debian or Ubuntu, do something like:
sudo aptitude install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev

You can also ask for help here: http://forum.lazarus.freepascal.org/index.php/topic,34645.630.html

DonAlfredo is very friendly and helpful, but it would be wise to read that topic a little before jumping into copy/paste of fpcudeluxe error output. Maybe someone else has already faced your problem.
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

lazer

  • New member
  • *
  • Posts: 25
Re: cross platform build pkg?
« Reply #8 on: October 06, 2017, 08:14:12 pm »
thanks for the tips. I have made a fair bit of progress and solved the fpc version issues. command line fpc is now doing what I expect cross platform.

I need to convince Lazarus to play ball now.

These GUI tools look quite nice but this kind of gritty development I would much rather do from an environment where I can see and control what is happening rather than have it hidden behind a pretty interface and not know what is going on.

« Last Edit: October 06, 2017, 08:16:41 pm by lazer »

avra

  • Hero Member
  • *****
  • Posts: 1172
    • Additional info
Re: cross platform build pkg?
« Reply #9 on: October 07, 2017, 09:56:54 am »
These GUI tools look quite nice but this kind of gritty development I would much rather do from an environment where I can see and control what is happening rather than have it hidden behind a pretty interface and not know what is going on.
I fully understand and respect your approach, however everything fpcupdeluxe does is logged to console or file so you can analyze what happens and dig as deep as you want to.
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

lazer

  • New member
  • *
  • Posts: 25
Re: cross platform build pkg?
« Reply #10 on: October 07, 2017, 10:30:08 am »
That's very helpful. I wish Lazarus did the same ( or if it does that I knew where that is ! ).

I am currently trying to debug Laz croos-compilation and my own prog. , when fpcupdeluxe just crashed in an ugly heap  at the first use I got the impression I was getting deeper and deeper into the rabbit hole. If it had given a means to get around the laz set up issues, I would probably have gone with it but since it is just adding a third level of debugging I'll have to give it a pass.

It may be trivial but I have to draw a line. Shame, on the face of it it looked quite good.


avra

  • Hero Member
  • *****
  • Posts: 1172
    • Additional info
Re: cross platform build pkg?
« Reply #11 on: October 07, 2017, 01:21:16 pm »
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

Handoko

  • Hero Member
  • *****
  • Posts: 1801
  • My goal: build my own game engine using Lazarus
Re: cross platform build pkg?
« Reply #12 on: October 07, 2017, 01:26:16 pm »
The project seems interesting, unfortunately no new updates since 2014. Did anyone ever try it? Does it work with current Lazarus/FPC?

avra

  • Hero Member
  • *****
  • Posts: 1172
    • Additional info
Re: cross platform build pkg?
« Reply #13 on: October 07, 2017, 02:23:46 pm »
The project seems interesting, unfortunately no new updates since 2014. Did anyone ever try it? Does it work with current Lazarus/FPC?
I haven't tested because I am happy with fpcupdeluxe. I dug another similar one, also looks abandoned but someone might find it useful:
https://sourceforge.net/projects/fpccrosscompilermaker
ct2laz - Easily convert components and projects between Lazarus and CodeTyphon

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus