Cross-compile vs native

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross-compile vs native

Brian
A question to those who must maintain a Linux version and a Windows versions application.

Do you tend to cross-compile from Linux or do you compile native (with separate projects) on each OS (Linux and Windows)?

Thanks
Brian
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Felipe Monteiro de Carvalho
I compile native for linux, windows and Mac and cross-compile only for Android.

I use the same project unit for every system except Android.

--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Mark Morgan Lloyd-5
In reply to this post by Brian
Brian wrote:
> A question to those who must maintain a Linux version and a Windows versions
> application.
>
> Do you tend to cross-compile from Linux or do you compile native (with
> separate projects) on each OS (Linux and Windows)?

Native where possible, but that's more habit than anything else.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Ewald-2
In reply to this post by Brian
On 01/27/2015 09:56 PM, Brian wrote:
> A question to those who must maintain a Linux version and a Windows versions
> application.
>
> Do you tend to cross-compile from Linux or do you compile native (with
> separate projects) on each OS (Linux and Windows)?

Native, because of two reasons:
    - Without the target system, the application cannot be tested
thoroughly, and if one has the target system, why not build on it?
    - Some dependencies (such as autogenerated code) need to be compiled
on the target system. It could probably be done on a linux system as
well, but same argument as above...

Projects are identical on both platforms though (except for a few ifdefs
to access OS-specific functionality).

--
Ewald


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

tonyp
In reply to this post by Brian
Native on Windows, cross-compile for Linux.

-----Original Message-----
From: Brian
Sent: Tuesday, January 27, 2015 10:56 PM
To: [hidden email]
Subject: [fpc-pascal] Cross-compile vs native

A question to those who must maintain a Linux version and a Windows versions
application.

Do you tend to cross-compile from Linux or do you compile native (with
separate projects) on each OS (Linux and Windows)?

Thanks
Brian



--
View this message in context:
http://free-pascal-general.1045716.n5.nabble.com/Cross-compile-vs-native-tp5720834.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Graeme Geldenhuys-6
In reply to this post by Brian
On 2015-01-27 20:56, Brian wrote:
> Do you tend to cross-compile from Linux or do you compile native (with
> separate projects) on each OS (Linux and Windows)?


In my experience I found that having various VM's for each target works
best. The least amount of hassle, and all VM's sync the source code from
the same code repository and all can be compiled with the same command line.

  In my case:   fpc @extrafpc.cfg <project_name>

The extrafpc.cfg file contains all the settings I need for DEBUG and
RELEASE builds.

Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

leledumbo
Administrator
In reply to this post by Brian
> Do you tend to cross-compile from Linux or do you compile native (with separate projects) on each OS (Linux and Windows)?

Cross compile from Linux. I can use Wine to test Windows compatiblity and I don't have Windows anyway :D
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Michael Schnell
In reply to this post by Ewald-2
On 01/27/2015 10:27 PM, Ewald wrote:
>      - Without the target system, the application cannot be tested ..
This is true, only because remote debugging is not well supported.

In fact I sometimes to programs to be run on a headless system (e.g. a
NAS) Here you can't install Lazarus, because you don't have a GUI.

You easily can install fpc and compile native, though.

So I ended up testing the software on a PC (as far as possible without
the hardware) and finally compile it on the target system.

I did not bother to install the cross compiler (the problem here is not
fpc itself, but the cross-libraries that are necessary link the project
for the target system).

If I would be able to use Lazarus on the development system to
remote-debug the target system, the effort to install the complete
cross-compile infrastructure would be viable.

-Michael

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Mark Morgan Lloyd-5
Michael Schnell wrote:
> On 01/27/2015 10:27 PM, Ewald wrote:
>>      - Without the target system, the application cannot be tested ..
> This is true, only because remote debugging is not well supported.
>
> In fact I sometimes to programs to be run on a headless system (e.g. a
> NAS) Here you can't install Lazarus, because you don't have a GUI.

A headless system can still map a GUI to a desktop computer using X,
VNC, SSH etc.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Ewald-2
In reply to this post by Michael Schnell
On 01/28/2015 10:01 AM, Michael Schnell wrote:
> On 01/27/2015 10:27 PM, Ewald wrote:
>>      - Without the target system, the application cannot be tested ..
> This is true, only because remote debugging is not well supported.

For remote debugging a target system is needed as well? So even if
remote debugging would be easy-peasy, the part you quotes still stands:
no target system: no decent testing.



>
> In fact I sometimes to programs to be run on a headless system (e.g. a
> NAS) Here you can't install Lazarus, because you don't have a GUI.

[this might be an extremely silly proposition, please forgive me] Why
don't you run lazarus through ssh? Or use vnc?


>
> You easily can install fpc and compile native, though.
>
> So I ended up testing the software on a PC (as far as possible without
> the hardware) and finally compile it on the target system.
>
> I did not bother to install the cross compiler (the problem here is
> not fpc itself, but the cross-libraries that are necessary link the
> project for the target system).
>
> If I would be able to use Lazarus on the development system to
> remote-debug the target system, the effort to install the complete
> cross-compile infrastructure would be viable.

I believe you are saying that you would like to cross-compile and debug
the system remotely (which, judging from your other posts, are mostly
embedded platforms?), but due to difficulties/roadblocks you are forced
to compile it natively and debug it on the target system.

Well, _if_ the cross-compilation works, why not just ssh in to the
target system and run gdb there? Please forgive my ignorance as I do not
know the exact details of your setup.

--
Ewald


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Michael Schnell
On 01/28/2015 12:51 PM, Ewald wrote:
>
> [this might be an extremely silly proposition, please forgive me] Why
> don't you run lazarus through ssh? Or use vnc?
The (small) target system does not have any graphic-related stuff like
X, qt or gtk. So VNC,  or remote X will not work.

Of course I can  access a command line via SSH.


> Well, _if_ the cross-compilation works, why not just ssh in to the
> target system and run gdb there?
Happily, in fact the client system is advanced enough to allow running
the full gdb (not just gdb-server).

Of course this does work. And I did just this. But direct manual work on
gdb is rather painful. That is why it would be great to use Lazarus for
remote debugging.

To do this there are two ways:

1) (this is activated in Lazarus by default) using remote gdb on the
server and have same access gdb-server on the client. Here I have not
been able to find / compile the appropriate remote gdb / gdb-server pair
for the ARM target.

2) (the code to do this is commented out in Lazarus and supposedly not
decently working) accessing a full gdb on the client via SSH.

-Michael
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

fredvs
In reply to this post by Brian
Hello.

I do main development on Linux 64.

For Windows, i use wine on Linux 64, (fpc.exe 32/64 installed without problem) and compile the source via wine-fpc.exe.

The advantage is that you do not have to copy your source to a virtual machine or a other native Windows.
And you may test your exe too on the same system ;-)

Fred
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

Brian
Thanks for all the suggestions.

I rather like Fred's method using Linux / Wine , and after getting it working under Wine ,  I would do an end test native on on a Windows PC.
Reply | Threaded
Open this post in threaded view
|

Re: Cross-compile vs native

fredvs
You may also install Lazarus.exe via wine.
With the SeupLazarus.exe, it install fpc.exe too ;-)
Many thanks ;-)