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