Project

General

Profile

Build from Source » History » Revision 15

Revision 14 (wirelesss, 12/02/2016 06:56 PM) → Revision 15/66 (wirelesss, 12/07/2016 03:00 PM)

{{>toc}} 

 h1. Build from Source 

 bq. *Before you consider building from source, be aware that there are [[Nightly Builds]] 
 available for Debian + Ubuntu platforms. These are recommended for normal users.* 

 Osmocom projects use autoconf/automake. 
 The general pattern for building is: 

 <pre> 
 cd source-tree 
 autoreconf -fi 
 ./configure 
 make 
 make check 
 make install 
 sudo ldconfig 
 </pre> 

 The @./configure@ step may need further configuration options, and 
 @./configure@ will tell you which dependencies are still missing, if any. 
 See below for project specific details and troubleshooting. 

 The @make@ step may be sped up by using multiple CPU cores: 

 <pre> 
 make -j 8 
 </pre> 

 We take care to make our builds parallelizable with @-j@, but in case 
 @make -j@ fails, issuing a simple @make@ could fix the problem (expecting 
 this only in libsmpp34). 


 h1. Dependencies 

 Which libraries are needed by various Osmocom programs is best resolved during 
 the @./configure@ step described below. This script checks for any missing 
 dependencies and issues corresponding error messages. 

 Here is a (probably incomplete) overview of dependencies between Osmocom 
 projects: 

 | _To build ..._ | _... you also need ..._ | 
 | osmo-bts | libosmocore, libosmo-abis, openbsc (source tree only), L1 headers depending on BTS model | 
 | osmo-pcu | libosmocore, L1 headers depending on BTS model | 
 | openbsc: osmo-nitb, osmo-bsc, osmo-sgsn, osmo-bsc_nat, osmo-bsc_mgcp | libosmocore, libosmo-abis, libosmo-netif, libosmo-sccp, libsmpp34 | 
 | openbsc: 3G osmo-cscn (branch sysmocom/iu) | libosmocore, libosmo-abis, libosmo-netif (branch sysmocom/sctp), libosmo-sccp (branch sysmocom/iu), asn1c, libasn1c, osmo-iuh | 
 | osmo-iuh | libosmocore, libosmo-netif, libosmo-sccp, asn1c, libasn1c | 

 h1. Download Sources 

 The latest Osmocom sources are available from git at https://git.osmocom.org, 
 where each project's overview page displays the actual git URL. 

 The projects' repository URLs generally are of the pattern: 
 <pre>git://git.osmocom.org/project-name</pre> 
 (To contribute, see [[Coding Standards#Submitting-Patches|Submitting Patches]]) 

 For example, to verify libosmocore's git repository URL, browse to 
 https://git.osmocom.org/libosmocore/ and observe the URL shown at the 
 bottom of the page under _Clone_: @git://git.osmocom.org/libosmocore@ 

 Then download this URL using the @git@ client: 

 <pre> 
 git clone git://git.osmocom.org/libosmocore 
 </pre> 

 It is also possible to download specific releases' tarballs for each git ref 
 that is defined. For example, browse to https://git.osmocom.org/libosmocore/, 
 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 

 All of these download instructions hold true for any of the git repositories 
 besides libosmocore. 

 h1. Build from debian packages 
      
 Following example is related to GPRS build: 

 Lets assume needed source codes are already downloaded. 
 * libosmocore 
 * libosmo-abis 
 * libosmo-netif 
 * openbsc 
 * openggsn 



 <pre> 
 cd openggsn 
 dpkg-buildpackage -tc -uc -us 
 sudo dpkg -i ../*.deb 
 </pre> 


 <pre> 
 cd libosmocore; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb 
 cd libosmo-abis; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb 
 cd libosmo-netif; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb 
 cd openbsc/openbsc; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb  
 </pre> 

 h1. Details and Troubleshooting 

 Here is a list of the most common configuration items or pitfalls to be 
 aware of when building specific Osmocom projects. 


 h2. Non-GNU Systems 

 On systems like FreeBSD, you need to run @gmake@ instead of @make@. 

 h2. Cross-Compiling for a BTS Platform 

 To build new software for the sysmoBTS and Litecell 1.5, you will typically 
 cross-compile using an SDK matching the BTS. You should find specific instructions 
 in, for example, the sysmoBTS manual. 

 h2. General ./configure options 

 To provide the installation location, which is /usr/local by default: 
 <pre> 
 ./configure --prefix=$HOME/my_osmocom_inst 
 </pre> 

 If you choose a non-standard location, later builds may fail to find it. 
 For example, if you built libosmocore with a custom prefix, a subsequent 
 build of libosmo-abis, which needs libosmocore installed, may fail. 
 You can tell a build process where to look for libraries to compile against 
 using the @PKG_CONFIG_PATH@ environment variable. 

 Furthermore, when you want to run binaries compiled against libraries 
 installed in a non-standard location, you will have to use the 
 @LD_LIBRARY_PATH@ environment variable to successfully load the binary. 
 Particularly, the @make check@ step typically runs such binaries, 
 as well as when you would like to run the installed binaries yourself. 

 For example: 

 <pre> 
 mkdir -p $HOME/osmo/src 
 cd $HOME/osmo/src 
 git clone git://git.osmocom.org/libosmocore 
 cd libosmocore 
 autoreconf -fi 
 ./configure --prefix=$HOME/osmo/inst --disable-pcsc 
 make -j5 
 make check 
 make install 

 cd .. 
 git clone git://git.osmocom.org/libosmo-abis 
 cd libosmo-abis 
 autoreconf -fi 
 export PKG_CONFIG_PATH=$HOME/osmo/inst/lib/pkgconfig 
 ./configure --prefix=$HOME/osmo/inst 
 make -j5 
 export LD_LIBRARY_PATH=$HOME/osmo/inst/lib 
 make check 
 make install 
 </pre> 

 Note that PKG_CONFIG_PATH points at the prefix's lib/pkgconfig and is needed 
 during the configure step of a library; 

 And that LD_LIBRARY_PATH is needed when running binaries that need libraries 
 installed in the non-standard location, here via @make check@. 

 Furthermore, when installing to an SDK's sysroot location, you would usually 
 set @DESTDIR@ to the sysroot with @--prefix=/usr@, resulting in an install 
 location of @$DESTDIR/usr@. 


 h2. libosmocore 

 When @libpcsclite@ is not easily available, e.g. when building for a BTS target platform: 
 <pre> 
 ./configure --disable-pcsc 
 </pre> 

 h2. openbsc 

 @openbsc@ is so far the only source tree where the build commands must be run 
 a level deeper than the source tree's root. Enter the second @openbsc@ dir: 

 <pre> 
 git clone git://git.osmocom.org/openbsc 
 cd openbsc/openbsc 
 autoreconf -fi 
 [...] 
 </pre> 

 h1. Example: completely build openbsc 

 This is an example of a complete build process for 2G openbsc and openggsn, 
 including SMPP and the "nat" binaries, to the @/usr/local@ prefix; it is assumed 
 that your system by default scans @/usr/local@ for installed libraries: 

 <pre> 
 osmo_src=$HOME/osmo/src 
 mkdir -p $osmo_src 

 cd $osmo_src 
 git clone git://git.osmocom.org/libosmocore 
 cd libosmocore 
 autoreconf -fi 
 ./configure 
 make -j5 
 make check 
 make install 

 cd $osmo_src 
 git clone git://git.osmocom.org/libosmo-abis 
 cd libosmo-abis 
 autoreconf -fi 
 ./configure 
 make -j5 
 make check 
 make install 

 cd $osmo_src 
 git clone git://git.osmocom.org/libosmo-netif 
 cd libosmo-netif 
 autoreconf -fi 
 ./configure 
 make -j5 
 make check 
 make install 

 cd $osmo_src 
 git clone git://git.osmocom.org/libosmo-sccp 
 cd libosmo-sccp 
 autoreconf -fi 
 ./configure 
 make -j5 
 make check 
 make install 

 cd $osmo_src 
 git clone git://git.osmocom.org/libsmpp34 
 cd libsmpp34 
 autoreconf -fi 
 ./configure 
 make 
 make check 
 make install 

 cd $osmo_src 
 git clone git://git.osmocom.org/openggsn 
 cd openggsn 
 autoreconf -fi 
 ./configure 
 make -j5 
 make check 
 make install 

 cd $osmo_src 
 git clone git://git.osmocom.org/openbsc 
 cd openbsc/openbsc 
 autoreconf -fi 
 ./configure --enable-smpp --enable-osmo-bsc --enable-nat 
 make -j5 
 make check 
 make install 

 which osmo-nitb 
 osmo-nitb --version 
 </pre> 

 h1. Example: build script 

 This is a shell script that builds openbsc and openggsn, 
 expecting the git clones to be ready in the current directory: 

 attachment:build_2G.sh
Add picture from clipboard (Maximum size: 48.8 MB)