Project

General

Profile

Build from Source » History » Version 39

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