<html><head></head><body><div>Hi Michalis,</div><div><br></div><div>On Wed, 2016-02-17 at 20:49 +0100, Michalis Kamburelis wrote:</div><blockquote type="cite"><pre>2016-02-16 12:37 GMT+01:00 Abou Al Montacir <<a href="mailto:abou.almontacir@sfr.fr">abou.almontacir@sfr.fr</a>>:
<blockquote type="cite">
Using multi-arch you are probably able to compile for Debian for an other
CPU.
</blockquote>

As far as I understood, Debian multi-arch is about installing
libraries for multiple architectures on the same system (
<a href="https://wiki.debian.org/Multiarch">https://wiki.debian.org/Multiarch</a> ). This is very useful for
cross-compiling of course. But does Debian multi-arch also deal with
distributing cross-compilers itself?
</pre></blockquote><div>Not completely for now but partially. If you are compiling for the same CPU traget but with other OS (like Debian freeBSD, ...) this will work.</div><div>If you are compiling for same OS but with an other CPU target then indeed this will not work, you will need a cross compiler.</div><blockquote type="cite"><pre>
I mean, in an ideal future, I would like to install on my Debian Linux
(x86_64) an FPC binary that runs on x86_64 and can compile to arm
(e.g. running Android OS) or i386 (e.g. running 32-bit Linux or
Windows OS). That is, "ppcross386" or "ppcrossarm", running on x86_64.
I would like to install them of course using pure "apt-get install
..." calls (without the need to make cross-compiler myself from FPC
sources, like I do now). Is this within the scope of Debian
multi-arch?
</pre></blockquote><div>The cross compiler himself is not, but this can be fixed easily.</div><div>Normally for this you need to use fpc -P<cpu> -Xp<path>. This is undocumented feature but is very useful.</div><div>Please see compiler/utils/fpc.pp lines 167-240 for code selecting the compiler backend.</div><div>This code could also be modified to use qemu as a workaround and install the native arm compiler package for example</div><blockquote type="cite"><pre>
If this is within the scope of Debian multi-arch, or just your TODO,
then it's great! I volunteer for testing, as cross-compiling with FPC
is very very useful for me:)
</pre></blockquote><div>I don't think this is within Debian mult-arch but sure in my todo list.</div><blockquote type="cite"><pre>
<blockquote type="cite">
However for Windows a Android, you will need to recompile RTL, but this
could be done using fpc-source
</blockquote>

Sure, you can use fpc-source for that. But that's a little cheating:)
</pre></blockquote><div>I agree</div><blockquote type="cite"><pre>
I mean, using FPC sources, you can compile for yourself FPC RTL for
Windows, or FPC RTL for Android, or FPC cross-compiler from x86_64 to
arm. But doing this is more complicated than just installing package
like "fpc-windows-rtl" or "fpc-android-rtl" and
</pre></blockquote><div>Windows is a special case. </div><blockquote type="cite"><pre>"fpc-android-arm-cross-compiler":) If you can (or want) to work with
FPC sources, then you can probably do all this with upstream sources
from freepascal.org, no need to really install Debian package
fpc-source.
</pre></blockquote><div>I agree, it should be done the Debian way, install and run no need for compilation.</div><blockquote type="cite"><pre>
BTW, I'm not sure whether FPC Makefile/fpmake system supports
out-of-tree build. So to use fpc-source like that, you may need to "cp
-R /usr/share/fpcsrc/XXX ..." them to your home.
</pre></blockquote><div>Not sure, but we handle already this with Lazarus which may recompile files.</div><blockquote type="cite"><pre>
<blockquote type="cite">
You cannot cross-compile to Android. For this, you're missing

This will come soon or late. It is on my todo list to make it easy to build
APK using FPC on a Debian box. I just need time, but maybe I should write
some wiki page about it.

</blockquote>

That's excellent news!:) Right now my instruction for setting up
environment for using Castle Game Engine + Android look quite long
(describe getting Android SDK, then Android NDK, then FPC
cross-compiler to Android+Arm). See here:

  <a href="https://github.com/castle-engine/castle-engine/wiki/Android">https://github.com/castle-engine/castle-engine/wiki/Android</a>

It would be absolutely fantastic if I could one day write there "If
you're on Debian, no need to read this, just apt-get instal
fpc-for-android"!
</pre></blockquote><div>That is what I want too!</div><div><pre style="color: rgb(0, 0, 0);">-- 
Cheers,
Abou Al Montacir</pre></div></body></html>