blob: 7f1b5946bb0d850390da36ba0ede89a0d2125b44 [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 \
Oliver Smithaa015b12021-12-10 17:10:25 +010016 libsctp-dev sqlite3 libusb-1.0-0-dev libmnl-dev libsofia-sip-ua-glib-dev
Neels Hofmeyr569f8ff2018-01-06 21:20:28 +010017
Oliver Smithaa015b12021-12-10 17:10:25 +010018./gen_makefile.py default.opts iu.opts no_dahdi.opts -I -m make
Neels Hofmeyr569f8ff2018-01-06 21:20:28 +010019
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
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020043Run ./gen_makefile.py with a choice of choice of configure options.
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020044
Neels Hofmeyr00e6a572017-09-20 19:41:09 +020045
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020046Examples:
47
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020048CN with full 2G and 3G support:
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020049
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020050 ./gen_makefile.py default.opts iu.opts -m make
Neels Hofmeyr015f3012017-12-10 13:39:08 +010051 cd make
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020052 make cn
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020053
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020054Other make targets exist for specific use cases:
Neels Hofmeyrd3707d02017-09-03 23:57:55 +020055
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020056 - 'usrp':
57 Build the CN, OsmoBSC, OsmoBTS and OsmoTRX (default, e.g. when connecting
58 to an USRP)
59
60 - 'cn-bsc':
61 Build the CN and OsmoBSC (e.g. when connecting to an external sysmoBTS)
62
63 - 'osmo-msc':
64 Build only the OsmoMSC project and its dependencies (this can be used for
65 any project in all.deps).
66
67 - '.make.osmo-ttcn3-hacks.clone'
68 Clone the osmo-ttcn3-hacks git repository (it cannot be built by osmo-dev,
69 but cloning it is still useful.)
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020070
71If you make modifications in one of the source trees, this Makefile will pick
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020072it up, rebuild the project and also rebuild all dependencies (according to
73all.deps).
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020074
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020075If you modify the all.deps or *.opts file, you can easily run 'make regen' in a
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020076make-* subdir to regenerate the Makefile from the same files.
77
78In your make-* subdir there are empty status files that are touched for every
79completed make target. From these, 'make' can detect what needs to be rebuilt.
80You can manually remove them to force a rebuild of a specific target.
81
82For example, if you 'rm .make.libosmocore.autoconf', libosmocore and all
83projects depending on libosmocore will be rebuilt from scratch.
84
Oliver Smith0a4d8ea2021-07-29 14:32:29 +020085For more details on the *.opts and all.deps syntax, read the docs at the top of
Neels Hofmeyr0a1bdff2017-08-13 03:22:42 +020086./gen_makefile.py.
87
88It is also easily possible to keep sources and build trees in various
89configurations, see the command line options of ./gen_makefile.py.
Neels Hofmeyrfeeedad2017-08-23 00:13:33 +020090
91
Neels Hofmeyr7aeaf422018-11-19 02:54:11 +010092=== Install in /usr
93
94By default, the Osmocom install prefix is /usr/local, while (currently) the
95default systemd *.service files expect binaries installed in /usr/bin. To
96install in /usr instead, use prefix_usr.opts, which sets --prefix=/usr.
97
98
Neels Hofmeyr1cbec192018-11-19 02:56:04 +010099=== Systemd Service Files
100
101If you encounter problems installing *.service files, no_systemd.opts may help:
102
103Systemd recommends installing service files in the distribution's single
104service file location; that may sound sane, but if that location is
105/lib/systemd/system, that means even a --prefix=/home/private/prefix ends up
106trying to install service files system-wide in /lib/systemd/system, making all
107attempts to install to a user-writable location fail.
108
109no_systemd.opts disables installing *.service files.
110
111
Neels Hofmeyra0ccef32017-10-02 00:26:12 +0200112=== Build Environment
113
Neels Hofmeyr015f3012017-12-10 13:39:08 +0100114For dependencies, see the "External dependencies" on:
Neels Hofmeyra0ccef32017-10-02 00:26:12 +0200115
116 https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source
117
Neels Hofmeyr015f3012017-12-10 13:39:08 +0100118If /usr/local/ is not writable by your user, pass the --sudo-make-install
119option to gen_makefile.py above (a custom --prefix is not yet supported).
120
121If your system doesn't have this by default, you will need:
Neels Hofmeyra0ccef32017-10-02 00:26:12 +0200122
123 export LD_LIBRARY_PATH="/usr/local/lib"
124
125and
126
127 export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
128
129to your environment. To use the installed binaries after installation, also
130
131 export PATH="$PATH:/usr/local/bin"
132
133
Neels Hofmeyrfeeedad2017-08-23 00:13:33 +0200134=== osmo-uninstall.sh
135
136Remove osmocom built binaries and headers from given prefix,
137default is /usr/local.
Neels Hofmeyrf6402d82017-09-04 04:32:21 +0200138
139
140=== src/*
141
142Find other useful scripts in src/, see src/README.
Neels Hofmeyrc3adf3e2018-11-06 15:35:37 +0100143
144
Oliver Smithe3985642019-10-11 16:37:59 +0200145=== ttcn3/ttcn3.sh
146
Oliver Smith8bdd7ab2020-05-05 14:16:35 +0200147Run a given testsuite with docker, so it behaves exactly the same as when
148jenkins runs it [1], but use osmo-dev to build all related Osmocom components
149and the testsuite, and mount them inside the docker containers. After building
150the docker containers for the first time (which takes rather long), this gives
151short test cycles: just modify something, run the script again and the relevant
152objects will be built directly, already built objects do not need to be
153rebuilt. (This is a big speed improvement over just using docker containers as
154you don't need to push your sources to a git server first, have the docker
155containers fetch the git sources and build the modified component from scratch
156again.)
157
158The docker containers are used, so we don't have to maintain a second set of
159configs which works without docker (that was tried before, and found not to be
160feasible).
Oliver Smithe3985642019-10-11 16:37:59 +0200161
162Example usage:
163
164 ./ttcn3/ttcn3.sh mgw
Oliver Smithf3eb0ba2021-08-10 15:41:47 +0200165 IMAGE_SUFFIX=latest ./ttcn3/ttcn3.sh mgw
Oliver Smithe3985642019-10-11 16:37:59 +0200166
Oliver Smithe3985642019-10-11 16:37:59 +0200167More about the testsuites:
168https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites
169
Oliver Smith8bdd7ab2020-05-05 14:16:35 +0200170[1] https://jenkins.osmocom.org/jenkins/view/TTCN3/
Oliver Smithe3985642019-10-11 16:37:59 +0200171
Neels Hofmeyrc3adf3e2018-11-06 15:35:37 +0100172=== Troubleshooting
173
174When using sanitize.opts, osmo-trx is not built with the address sanitizer
175enabled. Linking a sanitizer-enabled libosmocore will not work.