Amiga-Development

Please login or register.

Login with username, password and session length
Advanced search  

News:

Created for developers of all Amiga camps

Pages: 1 2 [3]

Author Topic: Compile speed and binary size on AmigaOS 3  (Read 544 times)

0 Members and 1 Guest are viewing this topic.

Chain-Q

  • Newbie
  • *
  • Posts: 9
  • Stealth Ranger
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #30 on: August 08, 2017, 03:28:12 PM »

Here's a set of binaries of Darwin-i386 to Amiga-68k binutils for a cross-compile setup:
http://charlie.amigaspirit.hu/software/fpc/amiga/

If you want to build them yourself, I recommend cahir's cross-GCC setup for Amiga:
https://github.com/cahirwpz/amigaos-cross-toolchain

But it's actually easier to build vasm and vlink for cross-compiling than binutils.

Just grab vasm and vlink latest stable source from http://sun.hasenbraten.de/vasm and http://sun.hasenbraten.de/vlink .

Extract them, then for vasm: make CPU=m68k SYNTAX=std for vlink simply make

Should build vasmm68k_std and vlink as needed by FPC. Then the cross build should use arguments -Avasm and -XV to enable vasm and vlink support. Of course you need a working compiler setup on macOS for this, which means basically you need XCode and the Command Line Tools. Bottom line, if for example Homebrew works, these builds should work as well.

Then my FPC cross-build script looks something like this:

#!/bin/sh
cd $HOME/fpc/svn/trunk
export PATH=$PATH:$HOME/vasm:$HOME/vlink

make clean crossall crossinstall \
CPU_TARGET=m68k OS_TARGET=amiga \
CROSSOPT="-Avasm -XV" \
FPC=$HOME/fpc-boot/ppc386 \
INSTALL_PREFIX=$HOME/fpc-bin/m68k-amiga/


Which means basically you only need a bootstrap compiler (ppc386), and vasm/vlink in the path. Plus a target directory to install stuff after the build is done. Then you'll get a working Darwin to Amiga/68k crosscompiler in $HOME/fpc-bin/m68k-amiga.
Logged

Chain-Q

  • Newbie
  • *
  • Posts: 9
  • Stealth Ranger
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #31 on: August 08, 2017, 03:33:08 PM »

One more note, building FPC itself is actually very fast. It's between 2-5 minutes in a reasonably fast x86 machine with SSD or SSHD. So no one should be afraid to try it and it's not a lengthy process either. (Compare: on a poor little 68060 under NetBSD, the compiler build cycle alone is 4 hours 20 minutes, without building the packages...)
Logged

magorium

  • Full Member
  • ***
  • Posts: 221
  • Programming is an art form that fights back
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #32 on: August 08, 2017, 05:06:19 PM »

Thank you very much Chain-Q !

That:
a) would at least take away the burden for TS to build his own binutils
b) answered my question if vlink/vasm is compilable on/for mac (as i hadn't checked for that yet).


In addition to that, it is just as easy to add support for targeting other platforms with that (same) Free Pascal compiler.

The main hurdle there is (again) the binutils. The rest is more or less about configuring things correctly, providing the correct parameters or placing executables/compiled units inside the correct locations.

Aros, for instance, require some additional steps in order to produce gnu binutils.
- download gnu sources for the (AROS supported version of the) binutils
- patch those sources with the patches that can be found inside AROS source-tree
- build binutils
- build collect AROS
- Install/copy produced executables to your binutils directory

And you should be able to target AROS as well (with gnu binutils), using the same compiler.

Alternatively the 64-bit MacOS binutils to be able to target Aros can also be downloaded from here

Something similar can be done for cross-compiling to MorphOS, AmigaOS4 or whatever target you wish to cross-compile for.

As a fun fact: did you know that cross-compiling that way also offers the possibilty to use Lazarus IDE to edit and (cross-)compile your sources ? The only requirement for that is installing Lazarus on your Mac and point Lazarus configuration to use your (own) compiled Free Pascal compiler.

Note that compiling the Free Pascal sources from trunk offers you the most advanced version for our AROS, MorphOS and Amiga targets (native API calls). Version 3.0.2 (and upcoming 3.0.4) of Free Pascal release versions lacks a bit behind as we were/are still improving things.

Please keep that in mind as some (source) incompatibilities could arise (when using a newer compiler) from using such 'older' compiler (with regards to native 'Amiga' api calls). In case you run into difficulties with that then please do not hesitate to inform us about that so we are able to address that (either by providing a solution or that we can document that properly).

regards,
Ron.
« Last Edit: August 08, 2017, 05:10:11 PM by magorium »
Logged

magorium

  • Full Member
  • ***
  • Posts: 221
  • Programming is an art form that fights back
    • View Profile
Re: Compile speed and binary size on AmigaOS 3
« Reply #33 on: August 08, 2017, 05:52:27 PM »

Can I cross-compile with FreePascal for a different target?
Yes, see also steps mentioned above. e.g. not by default.
I have to correct myself there a little.

FP-IDE editor is able to target platforms that uses the same processor that your host uses. It is restricted to that as FP-IDE uses its own internal compiler.
Logged
Pages: 1 2 [3]