Tuesday, October 1, 2019

A pre-configured development machine for AROS

One of the best (and also most scaring) features of AROS is its own build environment, which is driven by metamake files and can be a little difficult to understand. But, even before playing with the develoment system, the simplier need to install Linux and configure it for AROS development can be a show-stopper to many people. Well, no more: here you can find an already configured Linux machine based on Ubuntu 18.04: just download, unpack, add run it with VMware Player.

DOWNLOAD AROS Development Environment .vmx
(4.5 GB, .7z file format)


In order to run it, you need

- VMware Worksation/Player 15 for Linux or Windows (or Fusion for MacOS X)
- A dual core (or better) processor
- 4 GB (or more) RAM
- 20-50 GB of disk space (*)
- Internet connection

VirtualBox: The machine has been created for VMware, but it's been reported to work correctly on VirtualBox as well. To run it with VirtualBox, create a new virtual machine and attach the provided .vmdk file as disk drive. Use the suggested specs for CPU, RAM, etc.

(*) The virtual machine is configured with a 40 GB vmdk hard disk image in thin provisioning. This means that it will initially take about 18 GB of space, but it will grow with time. The VM is configured to use 2 GB of memory and a single core processor, but you're encouraged to update these settings to 2 CPUs and 3 GB of RAM. Moreover, no hardware virtualization is initially set: please add "Intel VT-x/EPT or AMD-V/RVI" virtualisation and "CPU performance counters" virtualisation to increase performances. If your system supports it, add IOMMU virtualisation as well.

AROS x86-64 being compiled on Linux
The machine provides a bare Linux 64bit installation with development stuff, AROS sources (updated to Sept. 30th, 2019) and VMware Tools. The initial screen resolution is 1440x900, but it can be easily adjusted resizing its window. The VM already supports clipboard sharing and drag'n'drop of files to transfer files between the host and the guest operating system. Pre-configured user is called 'arosdev' with password 'arosdev': please change the latter as soon as possible, to enhance security.

COMPILING AROS

We have already configured AROS to build for the x86-64 ABIv1 target. This means we have also downloaded all necessary stuff (which would normally require another GB of downloads) and placed it in a separate directory. To begin with, you only need to know that:

~/sources  includes AROS source tree, the one you can get with git from the following address: https://github.com/aros-development-team/AROS.git

~/portsrc  includes package needed when compiling AROS (portsources). You'd normally be supposed to download them every time you build AROS from scratch

~/x86-64  is the directory you must build AROS from. You will find instructions on your desktop.

So, if you want to compile AROS for x86-64, you only need to start a shell and enter:

cd x86-64
make

NOTE: on this virtual machine we've already given the needed configure and make commands, which would have been:
../sources/configure --target=pc-x86_64 --enable-ccache --with-gcc-version=9.1.0 --with-binutils-version=2.32 --with-portssources=~/portsrc 
make -j 2 && make -j 2 distfiles
otherwise, you'd be assumed to compile at least once the whole sources, before doing anything else!

COMPILING AROS FOR DIFFERENT ARCHITECTURES

You are encouraged to create also different directories from /home/arosdev with different AROS targets, for instance ~/m68k or ~/arm, and use them to build your sources also for different CPU architectures. Remember: once you start using the AROS build system for your sources, you can easily build them for several targets on the same Linux machine. Just remember to specify --with-portssources=~/portsrc when configuring. For instance, let's assume you wish to create the linux hosted version of 64bit AROS. First of all, open a shell and be sure you're in your home directory

cd ~

then, create a ~/linux-64 directory

mkdir linux-64

now move into your newly-created directory

cd linux-64

and configure AROS sources for the new target

../sources/configure --target=linux-x86_64 --enable-ccache --with-gcc-version=9.1.0 --with-binutils-version=2.32 --with-portssources=~/portsrc

and then you can build

make -j 2

You may need to install other required components. Please remember to keep a internet connection alive while building. Required commands and switches may vary for different targets, please join AROS developers team for further information. 

NOTE: x86-64 AROS is using a work-in-progress version of ABI v1, while 32bit Icaros Desktop is still bound to AROS ABIv0. This development environment IS NOT suited for compiling to ABIv0 i386. If you wish to release your apps for current 32bit version of Icaros, please learn how to adapt and compile on aros.sourceforge.net.

HOW TO COMPILE YOUR APPLICATIONS

If you're going to write applications for AROS, you have several available options: writing your program inside AROS directly and using AROS gcc to compile it, using a crosscompiler on Linux and, last but not least, letting the AROS build environment to manage your sources. Currently, you must use the build system (since 64bit AROS gcc does not work at the moment). This means you must learn how to use its metamake system. This will take some extra time but it will be well spent.  Why? For two very simple reasons:

1. you integrate your sources once, and you can compile it forever (or, at least, until something else inside AROS breaks your code...)

2. you can compile the same sources for several AROS target and, believe in me, if you wish to release your app for x86, x64, 68k and ARM, this can be extremely useful

As already explained, for Icaros 64 we are using the AROS build system. We have created a /icaros subdirectory inside our local source repository with, inside, every application we need to be ready-to-compile for the distribution. For now, mainly shell utilities we use in our shell scripts, but nothing prevents us from integrating also more complex stuff, once we'll get the proper metamake.src file.

IMPORTANT: you are only supposed to keep AROS sources updated. Either configuring git on the Linux Development Environment or by simply downloading them from https://github.com/aros-development-team/AROS.git with a browser, and then overwriting older files with newer ones: x86-64 is a moving target, some times the ABI will change breaking binary compatibility with formerly compiled programs. Just update sources, reconfigure, make and let your programs work again!

ADDING YOUR SOFTWARE


Now that we have a working AROS build system, it's time to use it to compile your software. You will do this providing both source files and a metamake script called 'mmakefile.src'. One for each project you need. Metamake scripts are a sort of recipe that tells the crosscompiler what to do. Unluckily, I am not able to tell you how to correctly write one, but I can give you at least a vague idea. Inside of ~/sources, create a 'personal' drawer for your programs.

md personal

and, inside of ~/sources/personal, create a different 'projectname' subdirectory for each program, for instance ~/sources/personal/myproject

Now, let's imagine you have a myproject.c and myproject.h files for your program: you should place them into ~/sources/personal/myproject and create a mmakefile.src script in the same directory, for instance:


include $(SRCDIR)/config/aros.cfg

#MM local-personal-myproject : includes linklibs

FILES := myproject    ← myproject.c without .c
EXEDIR := $(AROS_CONTRIB)/$(AROS_DIR_DEVELOPER)/Build    ← destination path for binary file
NOWARN_FLAGS := $(NOWARN_FORMAT)
USER_CFLAGS := $(NOWARN_FLAGS)

%build_prog mmake=local-personal-myproject \
progname=myproject targetdir=$(EXEDIR) \   ← executable name
files=$(FILES)

%common

Pay attention to the first line (#MM local-personal-myproject : includes linklibs), the bold part is the one you will call with the make command, from the root of the target directory

cd ~/x86-64

make local-personal-myproject


If you need further information, please read also the following resources:

The AROS build system, and how MetaMake works on aros.org

Aros/Developer/BuildSystem on Wikibooks.org

"How I compiled deark for 64bit AROS" on this site.

NEED HELP?


Unluckily we can't provide user support on this virtual machine. But we have a discussion topic already set up for this on AROS-EXEC. Please ask your question there:

> Discussion about the Dev Env on AROS-EXEC.org

Translate