Project

General

Profile

Build from Source » History » Version 13

wirelesss, 12/02/2016 06:28 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 10 wirelesss
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
All of these download instructions hold true for any of the git repositories
76
besides libosmocore.
77
78 12 wirelesss
h1. Build from debian packages
79 13 wirelesss
      
80
Following example is related to GPRS build:
81
82
We assume that needed source code is already downloaded.
83
* libosmocore
84
* libosmo-abis
85
* libosmo-netif
86
* openbsc
87
* openggsn
88
89
90
91
<pre>
92
cd openggsn
93
dpkg-buildpackage -tc -uc -us
94
sudo dpkg -i ../*.deb
95
</pre>
96
97 11 wirelesss
98
<pre>
99 12 wirelesss
cd libosmocore; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
100
cd libosmo-abis; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
101
cd libosmo-netif; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
102
cd openbsc/openbsc; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb 
103 11 wirelesss
</pre>
104
105 12 wirelesss
h1. Details and Troubleshooting
106 11 wirelesss
107 12 wirelesss
Here is a list of the most common configuration items or pitfalls to be
108
aware of when building specific Osmocom projects.
109
110 6 neels
111
h2. Non-GNU Systems
112
113
On systems like FreeBSD, you need to run @gmake@ instead of @make@.
114
115 7 neels
h2. Cross-Compiling for a BTS Platform
116
117
To build new software for the sysmoBTS and Litecell 1.5, you will typically
118
cross-compile using an SDK matching the BTS. You should find specific instructions
119
in, for example, the sysmoBTS manual.
120
121 6 neels
h2. General ./configure options
122
123
To provide the installation location, which is /usr/local by default:
124
<pre>
125
./configure --prefix=$HOME/my_osmocom_inst
126
</pre>
127
128
If you choose a non-standard location, later builds may fail to find it.
129
For example, if you built libosmocore with a custom prefix, a subsequent
130
build of libosmo-abis, which needs libosmocore installed, may fail.
131
You can tell a build process where to look for libraries to compile against
132
using the @PKG_CONFIG_PATH@ environment variable.
133
134
Furthermore, when you want to run binaries compiled against libraries
135
installed in a non-standard location, you will have to use the
136
@LD_LIBRARY_PATH@ environment variable to successfully load the binary.
137
Particularly, the @make check@ step typically runs such binaries,
138
as well as when you would like to run the installed binaries yourself.
139
140
For example:
141
142
<pre>
143
mkdir -p $HOME/osmo/src
144
cd $HOME/osmo/src
145
git clone git://git.osmocom.org/libosmocore
146
cd libosmocore
147
autoreconf -fi
148
./configure --prefix=$HOME/osmo/inst --disable-pcsc
149
make -j5
150 7 neels
make check
151
make install
152
153
cd ..
154
git clone git://git.osmocom.org/libosmo-abis
155
cd libosmo-abis
156
autoreconf -fi
157
export PKG_CONFIG_PATH=$HOME/osmo/inst/lib/pkgconfig
158
./configure --prefix=$HOME/osmo/inst
159
make -j5
160
export LD_LIBRARY_PATH=$HOME/osmo/inst/lib
161
make check
162
make install
163 6 neels
</pre>
164
165 7 neels
Note that PKG_CONFIG_PATH points at the prefix's lib/pkgconfig and is needed
166
during the configure step of a library;
167
168
And that LD_LIBRARY_PATH is needed when running binaries that need libraries
169
installed in the non-standard location, here via @make check@.
170
171
Furthermore, when installing to an SDK's sysroot location, you would usually
172
set @DESTDIR@ to the sysroot with @--prefix=/usr@, resulting in an install
173
location of @$DESTDIR/usr@.
174
175
176 6 neels
h2. libosmocore
177
178
When @libpcsclite@ is not easily available, e.g. when building for a BTS target platform:
179
<pre>
180
./configure --disable-pcsc
181
</pre>
182 1 neels
183 7 neels
h2. openbsc
184
185
@openbsc@ is so far the only source tree where the build commands must be run
186
a level deeper than the source tree's root. Enter the second @openbsc@ dir:
187
188
<pre>
189
git clone git://git.osmocom.org/openbsc
190
cd openbsc/openbsc
191
autoreconf -fi
192
[...]
193
</pre>
194
195
h1. Example: completely build openbsc
196
197
This is an example of a complete build process for 2G openbsc and openggsn,
198
including SMPP and the "nat" binaries, to the @/usr/local@ prefix; it is assumed
199
that your system by default scans @/usr/local@ for installed libraries:
200
201
<pre>
202
osmo_src=$HOME/osmo/src
203
mkdir -p $osmo_src
204
205
cd $osmo_src
206
git clone git://git.osmocom.org/libosmocore
207
cd libosmocore
208
autoreconf -fi
209
./configure
210
make -j5
211
make check
212
make install
213
214
cd $osmo_src
215
git clone git://git.osmocom.org/libosmo-abis
216
cd libosmo-abis
217
autoreconf -fi
218
./configure
219
make -j5
220
make check
221
make install
222
223
cd $osmo_src
224
git clone git://git.osmocom.org/libosmo-netif
225
cd libosmo-netif
226
autoreconf -fi
227
./configure
228
make -j5
229
make check
230
make install
231
232
cd $osmo_src
233
git clone git://git.osmocom.org/libosmo-sccp
234
cd libosmo-sccp
235
autoreconf -fi
236
./configure
237
make -j5
238
make check
239
make install
240
241
cd $osmo_src
242
git clone git://git.osmocom.org/libsmpp34
243
cd libsmpp34
244
autoreconf -fi
245
./configure
246
make
247
make check
248
make install
249
250
cd $osmo_src
251
git clone git://git.osmocom.org/openggsn
252
cd openggsn
253
autoreconf -fi
254
./configure
255
make -j5
256
make check
257
make install
258
259
cd $osmo_src
260
git clone git://git.osmocom.org/openbsc
261
cd openbsc/openbsc
262
autoreconf -fi
263
./configure --enable-smpp --enable-osmo-bsc --enable-nat
264
make -j5
265
make check
266 1 neels
make install
267 8 neels
268
which osmo-nitb
269
osmo-nitb --version
270 7 neels
</pre>
271 6 neels
272
h1. Example: build script
273 9 neels
274
This is a shell script that builds openbsc and openggsn,
275
expecting the git clones to be ready in the current directory:
276
277
attachment:build_2G.sh
Add picture from clipboard (Maximum size: 48.8 MB)