Project

General

Profile

Build from Source » History » Version 17

neels, 12/08/2016 03:01 PM

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