Project

General

Profile

Build from Source » History » Version 38

neels, 12/05/2017 10:25 PM

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 1 neels
./configure
15 1 neels
make
16 1 neels
make check
17 1 neels
make install
18 15 wirelesss
sudo ldconfig
19 1 neels
</pre>
20 1 neels
21 3 neels
The @./configure@ step may need further configuration options, and
22 3 neels
@./configure@ will tell you which dependencies are still missing, if any.
23 3 neels
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 1 neels
<pre>
28 1 neels
make -j 8
29 1 neels
</pre>
30 1 neels
31 1 neels
We take care to make our builds parallelizable with @-j@, but in case
32 1 neels
@make -j@ fails, issuing a simple @make@ could fix the problem (expecting
33 1 neels
this only in libsmpp34).
34 1 neels
35 1 neels
36 1 neels
h1. Dependencies
37 1 neels
38 1 neels
Which libraries are needed by various Osmocom programs is best resolved during
39 1 neels
the @./configure@ step described below. This script checks for any missing
40 6 neels
dependencies and issues corresponding error messages.
41 1 neels
42 1 neels
Here is a (probably incomplete) overview of dependencies between Osmocom
43 1 neels
projects:
44 1 neels
45 1 neels
| _To build ..._ | _... you also need ..._ |
46 1 neels
| osmo-bts | libosmocore, libosmo-abis, openbsc (source tree only), L1 headers depending on BTS model |
47 1 neels
| osmo-pcu | libosmocore, L1 headers depending on BTS model |
48 1 neels
| 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 1 neels
52 20 Darkstar
h1. External dependencies
53 20 Darkstar
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 21 neels
-- this is a collection of various dependencies used by various osmocom projects:
56 20 Darkstar
57 20 Darkstar
| _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 1 neels
65 3 neels
The latest Osmocom sources are available from git at https://git.osmocom.org,
66 3 neels
where each project's overview page displays the actual git URL.
67 3 neels
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 3 neels
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 3 neels
76 6 neels
Then download this URL using the @git@ client:
77 3 neels
78 1 neels
<pre>
79 1 neels
git clone git://git.osmocom.org/libosmocore
80 1 neels
</pre>
81 1 neels
82 6 neels
It is also possible to download specific releases' tarballs for each git ref
83 6 neels
that is defined. For example, browse to https://git.osmocom.org/libosmocore/,
84 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
85 6 neels
86 16 neels
All of these download instructions hold true for any of the git repositories,
87 16 neels
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 17 neels
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 1 neels
<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 17 neels
sudo dpkg -i ../libosmocore*.deb
101 13 wirelesss
</pre>
102 13 wirelesss
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 17 neels
* they allow you to easily install the same binaries on several machines,
107 17 neels
* you don't need to keep the source tree around,
108 17 neels
* they guarantee a clean de-installation later.
109 17 neels
110 17 neels
Note: when not using debian packages, i.e. after a '@make install@' directly from the source tree,
111 17 neels
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 12 wirelesss
aware of when building specific Osmocom projects.
117 12 wirelesss
118 6 neels
119 6 neels
h2. Non-GNU Systems
120 6 neels
121 6 neels
On systems like FreeBSD, you need to run @gmake@ instead of @make@.
122 6 neels
123 7 neels
h2. Cross-Compiling for a BTS Platform
124 7 neels
125 7 neels
To build new software for the sysmoBTS and Litecell 1.5, you will typically
126 7 neels
cross-compile using an SDK matching the BTS. You should find specific instructions
127 7 neels
in, for example, the sysmoBTS manual.
128 7 neels
129 6 neels
h2. General ./configure options
130 6 neels
131 6 neels
To provide the installation location, which is /usr/local by default:
132 6 neels
<pre>
133 6 neels
./configure --prefix=$HOME/my_osmocom_inst
134 6 neels
</pre>
135 6 neels
136 6 neels
If you choose a non-standard location, later builds may fail to find it.
137 6 neels
For example, if you built libosmocore with a custom prefix, a subsequent
138 6 neels
build of libosmo-abis, which needs libosmocore installed, may fail.
139 6 neels
You can tell a build process where to look for libraries to compile against
140 6 neels
using the @PKG_CONFIG_PATH@ environment variable.
141 6 neels
142 6 neels
Furthermore, when you want to run binaries compiled against libraries
143 6 neels
installed in a non-standard location, you will have to use the
144 6 neels
@LD_LIBRARY_PATH@ environment variable to successfully load the binary.
145 6 neels
Particularly, the @make check@ step typically runs such binaries,
146 6 neels
as well as when you would like to run the installed binaries yourself.
147 6 neels
148 6 neels
For example:
149 6 neels
150 6 neels
<pre>
151 6 neels
mkdir -p $HOME/osmo/src
152 6 neels
cd $HOME/osmo/src
153 6 neels
git clone git://git.osmocom.org/libosmocore
154 6 neels
cd libosmocore
155 6 neels
autoreconf -fi
156 6 neels
./configure --prefix=$HOME/osmo/inst --disable-pcsc
157 6 neels
make -j5
158 7 neels
make check
159 7 neels
make install
160 36 neels
sudo ldconfig
161 7 neels
162 7 neels
cd ..
163 7 neels
git clone git://git.osmocom.org/libosmo-abis
164 7 neels
cd libosmo-abis
165 7 neels
autoreconf -fi
166 7 neels
export PKG_CONFIG_PATH=$HOME/osmo/inst/lib/pkgconfig
167 7 neels
./configure --prefix=$HOME/osmo/inst
168 7 neels
make -j5
169 7 neels
export LD_LIBRARY_PATH=$HOME/osmo/inst/lib
170 7 neels
make check
171 7 neels
make install
172 36 neels
sudo ldconfig
173 6 neels
</pre>
174 6 neels
175 7 neels
Note that PKG_CONFIG_PATH points at the prefix's lib/pkgconfig and is needed
176 7 neels
during the configure step of a library;
177 7 neels
178 7 neels
And that LD_LIBRARY_PATH is needed when running binaries that need libraries
179 7 neels
installed in the non-standard location, here via @make check@.
180 7 neels
181 7 neels
Furthermore, when installing to an SDK's sysroot location, you would usually
182 7 neels
set @DESTDIR@ to the sysroot with @--prefix=/usr@, resulting in an install
183 7 neels
location of @$DESTDIR/usr@.
184 7 neels
185 6 neels
h2. libosmocore
186 6 neels
187 6 neels
When @libpcsclite@ is not easily available, e.g. when building for a BTS target platform:
188 6 neels
<pre>
189 6 neels
./configure --disable-pcsc
190 6 neels
</pre>
191 1 neels
192 7 neels
h2. openbsc
193 7 neels
194 7 neels
@openbsc@ is so far the only source tree where the build commands must be run
195 7 neels
a level deeper than the source tree's root. Enter the second @openbsc@ dir:
196 7 neels
197 7 neels
<pre>
198 7 neels
git clone git://git.osmocom.org/openbsc
199 7 neels
cd openbsc/openbsc
200 7 neels
autoreconf -fi
201 7 neels
[...]
202 7 neels
</pre>
203 7 neels
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 19 neels
<pre>
209 37 neels
cd osmo-msc
210 19 neels
./configure --enable-iu
211 19 neels
</pre>
212 19 neels
213 38 neels
h1. Example: completely build osmo-bsc, osmo-msc, osmo-sgsn and osmo-ggsn
214 7 neels
215 31 laforge
This is an example of a complete build process for 2G openbsc and osmo-ggsn,
216 7 neels
including SMPP and the "nat" binaries, to the @/usr/local@ prefix; it is assumed
217 7 neels
that your system by default scans @/usr/local@ for installed libraries:
218 7 neels
219 7 neels
<pre>
220 7 neels
osmo_src=$HOME/osmo/src
221 7 neels
mkdir -p $osmo_src
222 7 neels
223 7 neels
cd $osmo_src
224 7 neels
git clone git://git.osmocom.org/libosmocore
225 7 neels
cd libosmocore
226 7 neels
autoreconf -fi
227 7 neels
./configure
228 7 neels
make -j5
229 7 neels
make check
230 1 neels
make install
231 38 neels
sudo ldconfig
232 7 neels
233 7 neels
cd $osmo_src
234 7 neels
git clone git://git.osmocom.org/libosmo-abis
235 7 neels
cd libosmo-abis
236 7 neels
autoreconf -fi
237 7 neels
./configure
238 7 neels
make -j5
239 7 neels
make check
240 1 neels
make install
241 38 neels
sudo ldconfig
242 7 neels
243 7 neels
cd $osmo_src
244 7 neels
git clone git://git.osmocom.org/libosmo-netif
245 7 neels
cd libosmo-netif
246 7 neels
autoreconf -fi
247 7 neels
./configure
248 7 neels
make -j5
249 7 neels
make check
250 1 neels
make install
251 38 neels
sudo ldconfig
252 7 neels
253 7 neels
cd $osmo_src
254 7 neels
git clone git://git.osmocom.org/libosmo-sccp
255 7 neels
cd libosmo-sccp
256 7 neels
autoreconf -fi
257 7 neels
./configure
258 7 neels
make -j5
259 7 neels
make check
260 1 neels
make install
261 38 neels
sudo ldconfig
262 7 neels
263 7 neels
cd $osmo_src
264 7 neels
git clone git://git.osmocom.org/libsmpp34
265 7 neels
cd libsmpp34
266 7 neels
autoreconf -fi
267 7 neels
./configure
268 7 neels
make
269 7 neels
make check
270 1 neels
make install
271 38 neels
sudo ldconfig
272 1 neels
273 7 neels
cd $osmo_src
274 38 neels
git clone git://git.osmocom.org/osmo-mgw
275 38 neels
cd osmo-mgw
276 7 neels
autoreconf -fi
277 7 neels
./configure
278 1 neels
make -j5
279 1 neels
make check
280 1 neels
make install
281 38 neels
sudo ldconfig
282 1 neels
283 1 neels
cd $osmo_src
284 38 neels
git clone git://git.osmocom.org/libasn1c
285 38 neels
cd libasn1c
286 1 neels
autoreconf -fi
287 38 neels
./configure
288 38 neels
make
289 38 neels
make check
290 38 neels
make install
291 38 neels
sudo ldconfig
292 38 neels
293 38 neels
cd $osmo_src
294 38 neels
git clone git://git.osmocom.org/osmo-msc
295 38 neels
cd osmo-msc
296 38 neels
autoreconf -fi
297 38 neels
./configure --enable-iu
298 1 neels
make -j5
299 1 neels
make check
300 1 neels
make install
301 38 neels
sudo ldconfig
302 1 neels
303 38 neels
cd $osmo_src
304 38 neels
git clone git://git.osmocom.org/osmo-sgsn
305 38 neels
cd osmo-sgsn
306 38 neels
autoreconf -fi
307 38 neels
./configure --enable-iu
308 38 neels
make -j5
309 38 neels
make check
310 38 neels
make install
311 38 neels
sudo ldconfig
312 38 neels
313 38 neels
cd $osmo_src
314 38 neels
git clone git://git.osmocom.org/osmo-ggsn
315 38 neels
cd osmo-ggsn
316 38 neels
autoreconf -fi
317 38 neels
./configure
318 38 neels
make -j5
319 38 neels
make check
320 38 neels
make install
321 38 neels
sudo ldconfig
322 38 neels
323 38 neels
which osmo-msc
324 38 neels
osmo-msc --version
325 6 neels
</pre>
326 6 neels
327 9 neels
h1. Example: build script
328 31 laforge
329 9 neels
This is a shell script that builds openbsc and osmo-ggsn,
330 9 neels
expecting the git clones to be ready in the current directory:
331 9 neels
332 1 neels
attachment:build_2G.sh
Add picture from clipboard (Maximum size: 48.8 MB)