Project

General

Profile

Build from Source » History » Version 63

fixeria, 03/18/2022 11:19 AM
build osmo-hlr before osmo-msc

1 1 neels
h1. Build from Source
2 58 fixeria
3
{{>toc}}
4 1 neels
5 59 fixeria
bq. *Before you consider building from source, be aware that there are [[Binary Packages]] available for Debian + Ubuntu platforms. These are recommended for normal users.*
6 1 neels
7 5 neels
Osmocom projects use autoconf/automake.
8 2 neels
The general pattern for building is:
9 1 neels
10
<pre>
11
cd source-tree
12
autoreconf -fi
13 50 osmith
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
14 1 neels
./configure
15
make
16
make check
17 46 osmith
sudo make install
18 15 wirelesss
sudo ldconfig
19 1 neels
</pre>
20
21 3 neels
The @./configure@ step may need further configuration options, and
22
@./configure@ will tell you which dependencies are still missing, if any.
23
See below for project specific details and troubleshooting.
24 1 neels
25 6 neels
The @make@ step may be sped up by using multiple CPU cores:
26 1 neels
27
<pre>
28
make -j 8
29
</pre>
30
31
We take care to make our builds parallelizable with @-j@, but in case
32 41 neels
@make -j@ fails, issuing a simple @make@ could fix the problem.
33 1 neels
34 60 osmith
Please note that @make install@ may overwrite existing Osmocom configuration files. This depends on the @--prefix@ chosen in the @./configure@ step, and the default is @/usr/local@. For example, if you are running @sudo make install@ for OsmoMSC, with the default prefix, and you already have a @/usr/local/etc/osmocom/osmo-msc.cfg@, then it will be overwritten.
35
36 1 neels
h1. Dependencies
37
38
Which libraries are needed by various Osmocom programs is best resolved during
39
the @./configure@ step described below. This script checks for any missing
40 6 neels
dependencies and issues corresponding error messages.
41 1 neels
42
Here is a (probably incomplete) overview of dependencies between Osmocom
43
projects:
44
45
| _To build ..._ | _... you also need ..._ |
46 61 fixeria
| osmo-bts | libosmocore, libosmo-abis, L1 headers depending on BTS model |
47 1 neels
| osmo-pcu | libosmocore, L1 headers depending on BTS model |
48 40 neels
| osmo-hlr | libosmocore, libosmo-abis |
49
| osmo-mgw | libosmocore, libosmo-abis, libosmo-netif |
50 62 fixeria
| osmo-msc | libosmocore, libosmo-abis, libosmo-netif, libosmo-sccp, osmo-hlr (for libosmo-gsup-client), osmo-mgw (for libosmo-mgcp-client), libsmpp34 (for --enable-smpp); for 3G, use --enable-iu and add: osmo-iuh, libasn1c |
51 40 neels
| osmo-bsc | libosmocore, libosmo-abis, libosmo-netif, libosmo-sccp, osmo-mgw (for libosmo-mgcp-client) |
52 62 fixeria
| osmo-sgsn | libosmocore, osmo-ggsn, osmo-hlr (for libosmo-gsup-client); for 3G, use --enable-iu and add: osmo-iuh, libasn1c |
53 40 neels
| osmo-ggsn | libosmocore |
54 53 osmith
| osmo-sip-connector | libosmocore |
55 55 osmith
| osmo-trx | libosmocore |
56 1 neels
57 20 Darkstar
h1. External dependencies
58
59 21 neels
If you want to build on specific Linux distros, you might need to install additional dependencies before the build will succeed
60
-- this is a collection of various dependencies used by various osmocom projects:
61 20 Darkstar
62
| _To build on ..._ | _...you might need to install these packages:_ |
63 33 pespin
|Ubuntu 16.10 | libpcsclite-dev libtalloc-dev libortp-dev libsctp-dev libmnl-dev libdbi-dev libdbd-sqlite3 libsqlite3-dev sqlite3 libc-ares-dev libgnutls-dev |
64 56 osmith
|Debian 8 and 9| build-essential gcc g++ make automake autoconf libtool pkg-config libtalloc-dev libpcsclite-dev libortp-dev libsctp-dev libssl-dev libdbi-dev libdbd-sqlite3 libsqlite3-dev libpcap-dev libc-ares-dev libgnutls28-dev libsctp-dev sqlite3 libsofia-sip-ua-glib-dev libuhd-dev libusb-1.0-0-dev |
65 22 laforge
|FreeBSD 11|automake autoconf libtool git pkgconf talloc pcsc-lite python gmake ortp|
66 52 osmith
|Fedora 28|@development-tools autoconf automake gnutls-devel libtool libtalloc-devel pcsc-lite-devel ortp-devel openssl-devel lksctp-tools-devel libmnl-devel libdbi-devel libdbi-dbd-sqlite libpcap-devel sqlite-devel gcc-g++ uhd-devel libusb-devel fftw-devel boost-devel|
67 20 Darkstar
68 1 neels
h1. Download Sources
69
70 3 neels
The latest Osmocom sources are available from git at https://git.osmocom.org,
71
where each project's overview page displays the actual git URL.
72
73 1 neels
The projects' repository URLs generally are of the pattern:
74 3 neels
<pre>git://git.osmocom.org/project-name</pre>
75 6 neels
(To contribute, see [[Coding Standards#Submitting-Patches|Submitting Patches]])
76 3 neels
77
For example, to verify libosmocore's git repository URL, browse to
78 1 neels
https://git.osmocom.org/libosmocore/ and observe the URL shown at the
79 3 neels
bottom of the page under _Clone_: @git://git.osmocom.org/libosmocore@
80
81 6 neels
Then download this URL using the @git@ client:
82 3 neels
83 1 neels
<pre>
84
git clone git://git.osmocom.org/libosmocore
85
</pre>
86
87 6 neels
It is also possible to download specific releases' tarballs for each git ref
88
that is defined. For example, browse to https://git.osmocom.org/libosmocore/,
89
click on _refs_ on the top and select any branch or tag, e.g. "0.9.0":https://git.osmocom.org/libosmocore/tag/?h=0.9.0
90
91 16 neels
All of these download instructions hold true for any of the git repositories,
92
not limited to libosmocore.
93 6 neels
94 17 neels
h1. Build debian packages
95 1 neels
96 17 neels
Most Osmocom projects are setup and ready for building debian packages.
97
See the @debian/@ subdir in each source tree.
98 13 wirelesss
99 17 neels
For example, to build a libosmocore debian package:
100 1 neels
101
<pre>
102 17 neels
cd libosmocore/
103 57 osmith
sudo apt-get build-dep .
104 13 wirelesss
dpkg-buildpackage -tc -uc -us
105 17 neels
# then, you can install the package on your system with
106
sudo dpkg -i ../libosmocore*.deb
107 13 wirelesss
</pre>
108
109 17 neels
These steps are identical for all other Osmocom projects that are ready for debian packaging.
110 13 wirelesss
111 17 neels
Advantages of debian packages:
112
* they allow you to easily install the same binaries on several machines,
113
* you don't need to keep the source tree around,
114
* they guarantee a clean de-installation later.
115
116
Note: when not using debian packages, i.e. after a '@make install@' directly from the source tree,
117
you can also achieve a clean de-installation with '@make uninstall@'.
118 11 wirelesss
119 12 wirelesss
h1. Details and Troubleshooting
120 11 wirelesss
121 12 wirelesss
Here is a list of the most common configuration items or pitfalls to be
122
aware of when building specific Osmocom projects.
123
124 6 neels
125
h2. Non-GNU Systems
126
127
On systems like FreeBSD, you need to run @gmake@ instead of @make@.
128
129 7 neels
h2. Cross-Compiling for a BTS Platform
130
131
To build new software for the sysmoBTS and Litecell 1.5, you will typically
132
cross-compile using an SDK matching the BTS. You should find specific instructions
133
in, for example, the sysmoBTS manual.
134
135 6 neels
h2. General ./configure options
136
137
To provide the installation location, which is /usr/local by default:
138
<pre>
139
./configure --prefix=$HOME/my_osmocom_inst
140
</pre>
141
142
If you choose a non-standard location, later builds may fail to find it.
143
For example, if you built libosmocore with a custom prefix, a subsequent
144
build of libosmo-abis, which needs libosmocore installed, may fail.
145
You can tell a build process where to look for libraries to compile against
146
using the @PKG_CONFIG_PATH@ environment variable.
147
148
Furthermore, when you want to run binaries compiled against libraries
149
installed in a non-standard location, you will have to use the
150
@LD_LIBRARY_PATH@ environment variable to successfully load the binary.
151
Particularly, the @make check@ step typically runs such binaries,
152
as well as when you would like to run the installed binaries yourself.
153
154
For example:
155
156
<pre>
157
mkdir -p $HOME/osmo/src
158
cd $HOME/osmo/src
159
git clone git://git.osmocom.org/libosmocore
160
cd libosmocore
161
autoreconf -fi
162
./configure --prefix=$HOME/osmo/inst --disable-pcsc
163
make -j5
164 7 neels
make check
165
make install
166 36 neels
sudo ldconfig
167 7 neels
168
cd ..
169
git clone git://git.osmocom.org/libosmo-abis
170
cd libosmo-abis
171
autoreconf -fi
172
export PKG_CONFIG_PATH=$HOME/osmo/inst/lib/pkgconfig
173
./configure --prefix=$HOME/osmo/inst
174
make -j5
175
export LD_LIBRARY_PATH=$HOME/osmo/inst/lib
176
make check
177
make install
178 36 neels
sudo ldconfig
179 6 neels
</pre>
180
181 7 neels
Note that PKG_CONFIG_PATH points at the prefix's lib/pkgconfig and is needed
182
during the configure step of a library;
183
184
And that LD_LIBRARY_PATH is needed when running binaries that need libraries
185
installed in the non-standard location, here via @make check@.
186
187
Furthermore, when installing to an SDK's sysroot location, you would usually
188
set @DESTDIR@ to the sysroot with @--prefix=/usr@, resulting in an install
189
location of @$DESTDIR/usr@.
190
191 6 neels
h2. libosmocore
192
193
When @libpcsclite@ is not easily available, e.g. when building for a BTS target platform:
194
<pre>
195
./configure --disable-pcsc
196
</pre>
197 1 neels
198 7 neels
h2. openbsc
199
200
@openbsc@ is so far the only source tree where the build commands must be run
201
a level deeper than the source tree's root. Enter the second @openbsc@ dir:
202
203
<pre>
204
git clone git://git.osmocom.org/openbsc
205
cd openbsc/openbsc
206
autoreconf -fi
207
[...]
208
</pre>
209
210 37 neels
h2. osmo-msc and osmo-sgsn for 3G
211 19 neels
212 37 neels
Be sure to pass the @--enable-iu@ configure option to enable Iu interface support.
213 19 neels
214
<pre>
215 37 neels
cd osmo-msc
216 19 neels
./configure --enable-iu
217
</pre>
218
219 38 neels
h1. Example: completely build osmo-bsc, osmo-msc, osmo-sgsn and osmo-ggsn
220 7 neels
221 39 pespin
This is an example of a complete build process for 2G+3G core network,
222 7 neels
including SMPP and the "nat" binaries, to the @/usr/local@ prefix; it is assumed
223
that your system by default scans @/usr/local@ for installed libraries:
224 1 neels
225 39 pespin
If you don't require 3G, you can omit build of osmo-iuh and remove configure flag "--enable-iu" in osmo-msc and osmo-sgsn.
226
227 7 neels
<pre>
228
osmo_src=$HOME/osmo/src
229
mkdir -p $osmo_src
230
231
cd $osmo_src
232
git clone git://git.osmocom.org/libosmocore
233
cd libosmocore
234
autoreconf -fi
235
./configure
236
make -j5
237
make check
238 1 neels
make install
239 38 neels
sudo ldconfig
240 7 neels
241
cd $osmo_src
242
git clone git://git.osmocom.org/libosmo-abis
243
cd libosmo-abis
244
autoreconf -fi
245
./configure
246
make -j5
247
make check
248 1 neels
make install
249 38 neels
sudo ldconfig
250 7 neels
251
cd $osmo_src
252
git clone git://git.osmocom.org/libosmo-netif
253
cd libosmo-netif
254
autoreconf -fi
255
./configure
256
make -j5
257
make check
258 1 neels
make install
259 38 neels
sudo ldconfig
260 7 neels
261
cd $osmo_src
262
git clone git://git.osmocom.org/libosmo-sccp
263
cd libosmo-sccp
264
autoreconf -fi
265
./configure
266
make -j5
267
make check
268 1 neels
make install
269 38 neels
sudo ldconfig
270 7 neels
271
cd $osmo_src
272
git clone git://git.osmocom.org/libsmpp34
273
cd libsmpp34
274
autoreconf -fi
275
./configure
276
make
277
make check
278 1 neels
make install
279 38 neels
sudo ldconfig
280 1 neels
281 7 neels
cd $osmo_src
282 38 neels
git clone git://git.osmocom.org/osmo-mgw
283
cd osmo-mgw
284 7 neels
autoreconf -fi
285
./configure
286 1 neels
make -j5
287
make check
288
make install
289 38 neels
sudo ldconfig
290 1 neels
291
cd $osmo_src
292 38 neels
git clone git://git.osmocom.org/libasn1c
293
cd libasn1c
294 1 neels
autoreconf -fi
295 38 neels
./configure
296 1 neels
make
297 39 pespin
make check
298
make install
299
sudo ldconfig
300
301
cd $osmo_src
302
git clone git://git.osmocom.org/osmo-iuh
303
cd osmo-iuh
304
autoreconf -fi
305
./configure
306
make -j5
307 38 neels
make check
308
make install
309
sudo ldconfig
310
311
cd $osmo_src
312 63 fixeria
git clone git://git.osmocom.org/osmo-hlr
313
cd osmo-hlr
314
autoreconf -fi
315
./configure
316
make -j5
317
make check
318
make install
319
sudo ldconfig
320
321
cd $osmo_src
322 38 neels
git clone git://git.osmocom.org/osmo-msc
323
cd osmo-msc
324
autoreconf -fi
325
./configure --enable-iu
326 1 neels
make -j5
327
make check
328
make install
329 38 neels
sudo ldconfig
330 1 neels
331 38 neels
cd $osmo_src
332 42 neels
git clone git://git.osmocom.org/osmo-ggsn
333
cd osmo-ggsn
334 38 neels
autoreconf -fi
335 42 neels
./configure
336 38 neels
make -j5
337
make check
338
make install
339
sudo ldconfig
340
341
cd $osmo_src
342 42 neels
git clone git://git.osmocom.org/osmo-sgsn
343
cd osmo-sgsn
344 38 neels
autoreconf -fi
345 42 neels
./configure --enable-iu
346 1 neels
make -j5
347 38 neels
make check
348
make install
349
sudo ldconfig
350
351 42 neels
export LD_LIBRARY_PATH="/usr/local/lib"
352
export PATH="$PATH:/usr/local/bin"
353 38 neels
which osmo-msc
354
osmo-msc --version
355 6 neels
</pre>
356
357 9 neels
h1. Example: build script
358 31 laforge
359 9 neels
This is a shell script that builds openbsc and osmo-ggsn,
360
expecting the git clones to be ready in the current directory:
361
362 1 neels
attachment:build_2G.sh
363 43 neels
364
h1. Example: top-level Makefile
365
366
I (neels) use a top-level makefile to manage various configurations and build all source trees in sequence.
367
See https://git.osmocom.org/osmo-dev and look at the readme file.
368 47 osmith
369
h1. Example: script for cloning and building a single project
370
371
<pre>
372
#!/bin/sh -e
373
374
# Location where the git repositories will be stored (must exist)
375
DIR=~/code
376
377
# Check usage
378
if [ -z "$1" ]; then
379
	echo "usage: $(basename $0) PROJECT"
380
	exit 1
381
fi
382
383
# Clone
384 49 osmith
cd $DIR
385 47 osmith
if ! [ -d "$1" ]; then
386
	git clone "git://git.osmocom.org/$1"
387
fi
388
389
# Build
390 50 osmith
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig/"
391 49 osmith
cd $1
392 47 osmith
autoreconf -fi
393
./configure
394
make -j3
395
make check
396
sudo make install
397
sudo ldconfig
398
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)