Project

General

Profile

Build from Source » History » Version 9

neels, 11/15/2016 07:43 PM

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