decf87305f2937757062d14addb32bd8809626d0
[web/altusmetrum] / AltOS / building.mdwn
1 # Building AltOS
2
3 The AltOS source tree has a fairly long list of build dependencies, because
4 it builds firmware for a number of different processor cores, ground station 
5 software in Java, various utilities in C, documentation, etc.  Because Bdale
6 and Keith are both [Debian GNU/Linux](https://debian.org) developers, by far
7 the easiest way to build from source is to start with a 
8 Debian 'unstable' installation and take advantage of 
9 Debian tools and processes.  From this platform, it is possible to build 
10 installable packages not only for Debian,
11 but also for Windows, Mac OS X, and generic Linux.
12
13 Since many people would prefer to work from an actually released version of
14 Debian, in October 2020 Bdale worked through the steps required to take a
15 clean install of Debian 10 (buster) and get to a working build.  Here's that
16 recipe, as sent to a customer who asked how to do it:
17
18 <pre>
19   I actually had to install a fresh buster instance in a VM so that I
20   could chase this down.  And then there was an "of course!" moment.
21
22   The complication is based on the fact that Keith and I both run Debian
23   'unstable', aka 'sid', all the time since we're Debian developers.  And
24   it turns out that to build our master branch, you need an ARM cross tool
25   chain that's just newer than what's in buster.  Fortunately, that can be
26   installed without perturbing the rest of the system much.
27
28   I took serious notes on how to go from nothing to a working build on
29   buster, here's the recipe:
30
31        # make sure we're on latest buster
32        apt update && apt upgrade
33
34        # set up build dependencies, etc .. the json lib is a new build dep
35        # since buster, so install it manually as 'apt build-dep' won't
36        apt install build-essential git libjson-c-dev
37        apt build-dep altos
38
39        # move from newlib to picolibc, requires updating cross compiler too
40        dpkg --purge libnewlib-nano-arm-none-eabi
41
42        - to get latest ARM cross toolchain, temporarily add to 
43          /etc/apt/sources.list a line like:
44
45                deb http://deb.debian.org/debian/ sid main
46
47        apt update
48
49        # this pulls in the latest compiler, runtime library, and dependencies
50        # like gcc-10-base and two related libraries
51        apt install gcc-arm-none-eabi picolibc-arm-none-eabi
52
53        - probably safest to now comment out the sid line in sources.list, and
54          make sure the packaging system forgets about sid for now with
55        apt update
56
57        git clone git://git.gag.com/fw/altos
58        cd altos
59        git checkout master
60        ./autogen.sh
61        make
62
63        That happily ran to completion for me.
64
65        Hope this helps!
66 </pre>
67
68 Install [Debian](http://debian.org), then type 'apt-get build-dep altos' 
69 and all of the required build dependencies should be automatically installed.
70
71 The notes we use to do a complete build for release are in the file
72 Releasing in the root of the source tree.  You do *not* need to follow these
73 instructions to do a build for yourself, but since that document is likely
74 to be kept up to date better than this one, feel free to check there for
75 hints on things that might have changed, and/or feel free to reach out to
76 us for help if you get stuck.
77
78 If you really want to try and build our source tree on a development platform
79 other than Debian, feel free... just don't expect us to help!  It's hard
80 enough keeping everything working on one development platform...
81