Build from Source » History » Version 20
Darkstar, 03/10/2017 10:48 PM
external dependencies. source: my own learning curve ;-)
1 | 1 | neels | {{>toc}} |
---|---|---|---|
2 | |||
3 | h1. Build from Source |
||
4 | |||
5 | bq. *Before you consider building from source, be aware that there are [[Nightly Builds]] |
||
6 | 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 | If you want to build on specific Linux distros, you might need to install additional dependencies before the build will succeed. |
||
55 | |||
56 | | _To build on ..._ | _...you might need to install these packages:_ | |
||
57 | |Ubuntu 16.10 | libpcsclite-dev libtalloc-dev libortp-dev libsctp-dev libdbi-dev libdbd-sqlite3 libsqlite3-dev sqlite3 libc-ares-dev | |
||
58 | |||
59 | 1 | neels | h1. Download Sources |
60 | |||
61 | 3 | neels | The latest Osmocom sources are available from git at https://git.osmocom.org, |
62 | where each project's overview page displays the actual git URL. |
||
63 | |||
64 | 1 | neels | The projects' repository URLs generally are of the pattern: |
65 | 3 | neels | <pre>git://git.osmocom.org/project-name</pre> |
66 | 6 | neels | (To contribute, see [[Coding Standards#Submitting-Patches|Submitting Patches]]) |
67 | 3 | neels | |
68 | For example, to verify libosmocore's git repository URL, browse to |
||
69 | 1 | neels | https://git.osmocom.org/libosmocore/ and observe the URL shown at the |
70 | 3 | neels | bottom of the page under _Clone_: @git://git.osmocom.org/libosmocore@ |
71 | |||
72 | 6 | neels | Then download this URL using the @git@ client: |
73 | 3 | neels | |
74 | 1 | neels | <pre> |
75 | git clone git://git.osmocom.org/libosmocore |
||
76 | </pre> |
||
77 | |||
78 | 6 | neels | It is also possible to download specific releases' tarballs for each git ref |
79 | that is defined. For example, browse to https://git.osmocom.org/libosmocore/, |
||
80 | 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 |
||
81 | |||
82 | 16 | neels | All of these download instructions hold true for any of the git repositories, |
83 | not limited to libosmocore. |
||
84 | 6 | neels | |
85 | 17 | neels | h1. Build debian packages |
86 | 1 | neels | |
87 | 17 | neels | Most Osmocom projects are setup and ready for building debian packages. |
88 | See the @debian/@ subdir in each source tree. |
||
89 | 13 | wirelesss | |
90 | 17 | neels | For example, to build a libosmocore debian package: |
91 | 1 | neels | |
92 | <pre> |
||
93 | 17 | neels | cd libosmocore/ |
94 | 13 | wirelesss | dpkg-buildpackage -tc -uc -us |
95 | 17 | neels | # then, you can install the package on your system with |
96 | sudo dpkg -i ../libosmocore*.deb |
||
97 | 13 | wirelesss | </pre> |
98 | |||
99 | 17 | neels | These steps are identical for all other Osmocom projects that are ready for debian packaging. |
100 | 13 | wirelesss | |
101 | 17 | neels | Advantages of debian packages: |
102 | * they allow you to easily install the same binaries on several machines, |
||
103 | * you don't need to keep the source tree around, |
||
104 | * they guarantee a clean de-installation later. |
||
105 | |||
106 | Note: when not using debian packages, i.e. after a '@make install@' directly from the source tree, |
||
107 | you can also achieve a clean de-installation with '@make uninstall@'. |
||
108 | 11 | wirelesss | |
109 | 12 | wirelesss | h1. Details and Troubleshooting |
110 | 11 | wirelesss | |
111 | 12 | wirelesss | Here is a list of the most common configuration items or pitfalls to be |
112 | aware of when building specific Osmocom projects. |
||
113 | |||
114 | 6 | neels | |
115 | h2. Non-GNU Systems |
||
116 | |||
117 | On systems like FreeBSD, you need to run @gmake@ instead of @make@. |
||
118 | |||
119 | 7 | neels | h2. Cross-Compiling for a BTS Platform |
120 | |||
121 | To build new software for the sysmoBTS and Litecell 1.5, you will typically |
||
122 | cross-compile using an SDK matching the BTS. You should find specific instructions |
||
123 | in, for example, the sysmoBTS manual. |
||
124 | |||
125 | 6 | neels | h2. General ./configure options |
126 | |||
127 | To provide the installation location, which is /usr/local by default: |
||
128 | <pre> |
||
129 | ./configure --prefix=$HOME/my_osmocom_inst |
||
130 | </pre> |
||
131 | |||
132 | If you choose a non-standard location, later builds may fail to find it. |
||
133 | For example, if you built libosmocore with a custom prefix, a subsequent |
||
134 | build of libosmo-abis, which needs libosmocore installed, may fail. |
||
135 | You can tell a build process where to look for libraries to compile against |
||
136 | using the @PKG_CONFIG_PATH@ environment variable. |
||
137 | |||
138 | Furthermore, when you want to run binaries compiled against libraries |
||
139 | installed in a non-standard location, you will have to use the |
||
140 | @LD_LIBRARY_PATH@ environment variable to successfully load the binary. |
||
141 | Particularly, the @make check@ step typically runs such binaries, |
||
142 | as well as when you would like to run the installed binaries yourself. |
||
143 | |||
144 | For example: |
||
145 | |||
146 | <pre> |
||
147 | mkdir -p $HOME/osmo/src |
||
148 | cd $HOME/osmo/src |
||
149 | git clone git://git.osmocom.org/libosmocore |
||
150 | cd libosmocore |
||
151 | autoreconf -fi |
||
152 | ./configure --prefix=$HOME/osmo/inst --disable-pcsc |
||
153 | make -j5 |
||
154 | 7 | neels | make check |
155 | make install |
||
156 | |||
157 | cd .. |
||
158 | git clone git://git.osmocom.org/libosmo-abis |
||
159 | cd libosmo-abis |
||
160 | autoreconf -fi |
||
161 | export PKG_CONFIG_PATH=$HOME/osmo/inst/lib/pkgconfig |
||
162 | ./configure --prefix=$HOME/osmo/inst |
||
163 | make -j5 |
||
164 | export LD_LIBRARY_PATH=$HOME/osmo/inst/lib |
||
165 | make check |
||
166 | make install |
||
167 | 6 | neels | </pre> |
168 | |||
169 | 7 | neels | Note that PKG_CONFIG_PATH points at the prefix's lib/pkgconfig and is needed |
170 | during the configure step of a library; |
||
171 | |||
172 | And that LD_LIBRARY_PATH is needed when running binaries that need libraries |
||
173 | installed in the non-standard location, here via @make check@. |
||
174 | |||
175 | Furthermore, when installing to an SDK's sysroot location, you would usually |
||
176 | set @DESTDIR@ to the sysroot with @--prefix=/usr@, resulting in an install |
||
177 | location of @$DESTDIR/usr@. |
||
178 | |||
179 | |||
180 | 6 | neels | h2. libosmocore |
181 | |||
182 | When @libpcsclite@ is not easily available, e.g. when building for a BTS target platform: |
||
183 | <pre> |
||
184 | ./configure --disable-pcsc |
||
185 | </pre> |
||
186 | 1 | neels | |
187 | 7 | neels | h2. openbsc |
188 | |||
189 | @openbsc@ is so far the only source tree where the build commands must be run |
||
190 | a level deeper than the source tree's root. Enter the second @openbsc@ dir: |
||
191 | |||
192 | <pre> |
||
193 | git clone git://git.osmocom.org/openbsc |
||
194 | cd openbsc/openbsc |
||
195 | autoreconf -fi |
||
196 | [...] |
||
197 | </pre> |
||
198 | |||
199 | 19 | neels | h2. openbsc for 3G |
200 | |||
201 | Be sure to pass the @--enable-iu@ configure option so that osmo-msc gets Iu interface support. |
||
202 | |||
203 | <pre> |
||
204 | cd openbsc/openbsc |
||
205 | ./configure --enable-iu |
||
206 | </pre> |
||
207 | |||
208 | 7 | neels | h1. Example: completely build openbsc |
209 | |||
210 | This is an example of a complete build process for 2G openbsc and openggsn, |
||
211 | including SMPP and the "nat" binaries, to the @/usr/local@ prefix; it is assumed |
||
212 | that your system by default scans @/usr/local@ for installed libraries: |
||
213 | |||
214 | <pre> |
||
215 | osmo_src=$HOME/osmo/src |
||
216 | mkdir -p $osmo_src |
||
217 | |||
218 | cd $osmo_src |
||
219 | git clone git://git.osmocom.org/libosmocore |
||
220 | cd libosmocore |
||
221 | autoreconf -fi |
||
222 | ./configure |
||
223 | make -j5 |
||
224 | make check |
||
225 | make install |
||
226 | |||
227 | cd $osmo_src |
||
228 | git clone git://git.osmocom.org/libosmo-abis |
||
229 | cd libosmo-abis |
||
230 | autoreconf -fi |
||
231 | ./configure |
||
232 | make -j5 |
||
233 | make check |
||
234 | make install |
||
235 | |||
236 | cd $osmo_src |
||
237 | git clone git://git.osmocom.org/libosmo-netif |
||
238 | cd libosmo-netif |
||
239 | autoreconf -fi |
||
240 | ./configure |
||
241 | make -j5 |
||
242 | make check |
||
243 | make install |
||
244 | |||
245 | cd $osmo_src |
||
246 | git clone git://git.osmocom.org/libosmo-sccp |
||
247 | cd libosmo-sccp |
||
248 | autoreconf -fi |
||
249 | ./configure |
||
250 | make -j5 |
||
251 | make check |
||
252 | make install |
||
253 | |||
254 | cd $osmo_src |
||
255 | git clone git://git.osmocom.org/libsmpp34 |
||
256 | cd libsmpp34 |
||
257 | autoreconf -fi |
||
258 | ./configure |
||
259 | make |
||
260 | make check |
||
261 | make install |
||
262 | |||
263 | cd $osmo_src |
||
264 | git clone git://git.osmocom.org/openggsn |
||
265 | cd openggsn |
||
266 | autoreconf -fi |
||
267 | ./configure |
||
268 | make -j5 |
||
269 | make check |
||
270 | make install |
||
271 | |||
272 | cd $osmo_src |
||
273 | git clone git://git.osmocom.org/openbsc |
||
274 | cd openbsc/openbsc |
||
275 | autoreconf -fi |
||
276 | ./configure --enable-smpp --enable-osmo-bsc --enable-nat |
||
277 | make -j5 |
||
278 | make check |
||
279 | 1 | neels | make install |
280 | 8 | neels | |
281 | which osmo-nitb |
||
282 | osmo-nitb --version |
||
283 | 7 | neels | </pre> |
284 | 6 | neels | |
285 | h1. Example: build script |
||
286 | 9 | neels | |
287 | This is a shell script that builds openbsc and openggsn, |
||
288 | expecting the git clones to be ready in the current directory: |
||
289 | |||
290 | attachment:build_2G.sh |