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