Project

General

Profile

Build from Source » History » Version 43

neels, 05/25/2018 12:06 PM

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