Project

General

Profile

Build from Source » History » Version 9

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