Project

General

Profile

Build from Source » History » Version 53

osmith, 09/26/2018 02:15 PM
add osmo-sip-connector to dependencies list

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