blob: 055f6512af6cd1b553eb8df7e3c22adfbe5e46f5 [file] [log] [blame]
Neels Hofmeyr697a6172018-08-22 17:32:21 +02001=== WHAT IS THIS?
2
3* quickly build the entire Osmocom core network stack from source, with a
4 generated top-level makefile (see the rest of this README file below).
5
6* quickly configure, launch and tear down an entire Osmocom core network on
7 your box (see net/README).
8
9
Neels Hofmeyr569f8ff2018-01-06 21:20:28 +010010=== Quick Start
11
12sudo apt install \
13 build-essential gcc g++ make automake autoconf libtool pkg-config \
14 libtalloc-dev libpcsclite-dev libortp-dev libsctp-dev libssl-dev libdbi-dev \
15 libdbd-sqlite3 libsqlite3-dev libpcap-dev libc-ares-dev libgnutls28-dev \
16 libsctp-dev sqlite3
17
18./gen_makefile.py 3G+2G.deps default.opts iu.opts -I -m make
19
20cd make
21make
22
23- 'make' will ask for sudo password to run 'make install' and 'ldconfig'.
24 To run non-interactively:
25
26 - 'make install':
27 chown $USER: /usr/local
28 Then call gen_makefile.py once without the -I option
29
30 - 'ldconfig':
31 echo "$USER ALL= NOPASSWD: /sbin/ldconfig" > /etc/sudoers.d/ldconfig
32
33
Neels Hofmeyrfeeedad2017-08-23 00:13:33 +020034=== gen_makefile.py
35
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020036This provides a set of top-level makefiles to build variants of the Osmocom
37source trees. It is inteded for the core network components and related
38projects, but works generically.
39
40The idea is to have all your Osmocom git clones in ./src, while keeping one or
41more separate build trees in ./make-*.
42
43Run ./gen_makefile.py with a choice of projects (2G only or also 3G?)
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020044and a choice of configure options.
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020045
Neels Hofmeyr00e6a572017-09-20 19:41:09 +020046
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020047Examples:
48
49Full 2G and 3G support:
50
Neels Hofmeyr015f3012017-12-10 13:39:08 +010051 ./gen_makefile.py 3G+2G.deps default.opts iu.opts -m make
52 cd make
53 make
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020054
Neels Hofmeyr015f3012017-12-10 13:39:08 +0100552G only, and a custom dir name of 'make-2G':
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020056
Neels Hofmeyr95ea8ec2017-09-06 18:54:58 +020057 ./gen_makefile.py 2G.deps default.opts -m make-2G
Neels Hofmeyr015f3012017-12-10 13:39:08 +010058 cd make-2G
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020059 make
60
61If you make modifications in one of the source trees, this Makefile will pick
62it up, rebuild the project and also rebuild all dependencies (according to the
63*.deps file the Makefile was generated from).
64
65If you modify the *.deps or *.opts file, you can easily run 'make regen' in a
66make-* subdir to regenerate the Makefile from the same files.
67
68In your make-* subdir there are empty status files that are touched for every
69completed make target. From these, 'make' can detect what needs to be rebuilt.
70You can manually remove them to force a rebuild of a specific target.
71
72For example, if you 'rm .make.libosmocore.autoconf', libosmocore and all
73projects depending on libosmocore will be rebuilt from scratch.
74
75For more details on the *.opts and *.deps syntax, read the docs at the top of
76./gen_makefile.py.
77
78It is also easily possible to keep sources and build trees in various
79configurations, see the command line options of ./gen_makefile.py.
Neels Hofmeyrfeeedad2017-08-23 00:13:33 +020080
81
Neels Hofmeyr7aeaf422018-11-19 02:54:11 +010082=== Install in /usr
83
84By default, the Osmocom install prefix is /usr/local, while (currently) the
85default systemd *.service files expect binaries installed in /usr/bin. To
86install in /usr instead, use prefix_usr.opts, which sets --prefix=/usr.
87
88
Neels Hofmeyr1cbec192018-11-19 02:56:04 +010089=== Systemd Service Files
90
91If you encounter problems installing *.service files, no_systemd.opts may help:
92
93Systemd recommends installing service files in the distribution's single
94service file location; that may sound sane, but if that location is
95/lib/systemd/system, that means even a --prefix=/home/private/prefix ends up
96trying to install service files system-wide in /lib/systemd/system, making all
97attempts to install to a user-writable location fail.
98
99no_systemd.opts disables installing *.service files.
100
101
Neels Hofmeyra0ccef32017-10-02 00:26:12 +0200102=== Build Environment
103
Neels Hofmeyr015f3012017-12-10 13:39:08 +0100104For dependencies, see the "External dependencies" on:
Neels Hofmeyra0ccef32017-10-02 00:26:12 +0200105
106 https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source
107
Neels Hofmeyr015f3012017-12-10 13:39:08 +0100108If /usr/local/ is not writable by your user, pass the --sudo-make-install
109option to gen_makefile.py above (a custom --prefix is not yet supported).
110
111If your system doesn't have this by default, you will need:
Neels Hofmeyra0ccef32017-10-02 00:26:12 +0200112
113 export LD_LIBRARY_PATH="/usr/local/lib"
114
115and
116
117 export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
118
119to your environment. To use the installed binaries after installation, also
120
121 export PATH="$PATH:/usr/local/bin"
122
123
Neels Hofmeyrfeeedad2017-08-23 00:13:33 +0200124=== osmo-uninstall.sh
125
126Remove osmocom built binaries and headers from given prefix,
127default is /usr/local.
Neels Hofmeyrf6402d82017-09-04 04:32:21 +0200128
129
130=== src/*
131
132Find other useful scripts in src/, see src/README.
Neels Hofmeyrc3adf3e2018-11-06 15:35:37 +0100133
134
Oliver Smithe3985642019-10-11 16:37:59 +0200135=== ttcn3/ttcn3.sh
136
137Clone and build all dependencies, then run a given TTCN-3 testsuite and all
138required components. This is intended to make test-cycles as short as possible,
139without any manual configuration effort and without the need to rebuild the
140entire testsuite, SUT (subject under test, e.g. osmo-mgw) and dependencies from
141scratch for each code change. Instead, ttcn3.sh will make use of osmo-dev's
142generated global makefile and only build what actually changed.
143
144Example usage:
145
146 ./ttcn3/ttcn3.sh mgw
147
148Note that not all testsuites are supported at this point, see the output of
149ttcn3.sh without any argument for more information.
150
151More about the testsuites:
152https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites
153
154
Neels Hofmeyrc3adf3e2018-11-06 15:35:37 +0100155=== Troubleshooting
156
157When using sanitize.opts, osmo-trx is not built with the address sanitizer
158enabled. Linking a sanitizer-enabled libosmocore will not work.