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