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