User Tools

Site Tools


build_iotivity_with_ubuntu_build_machine

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
build_iotivity_with_ubuntu_build_machine [2017/03/15 20:49]
Ben Lloyd Pearson
build_iotivity_with_ubuntu_build_machine [2017/10/26 14:39] (current)
Mats Wichmann
Line 3: Line 3:
 ===== Setup ===== ===== Setup =====
  
-Before [[build]]ing [[sources]] for your [[os]] make sure to install needed tools. This guide works for Ubuntu 12.04 or newer. +Before [[build]]ing [[sources]] for your [[os]] make sure to install needed tools. This guide works for Ubuntu 12.04 or newer (12.04 itself is now out of support and is not recommended).
  
 +Various installations of Ubuntu may have some or all of the following already installed, but that should not cause problems.
  
 === Install build env === === Install build env ===
Line 13: Line 13:
       valgrind doxygen wget unzip       valgrind doxygen wget unzip
  
-===  Install external libraries: ===+===  Install ​development support for external libraries: ===
  
   $ sudo apt-get install \   $ sudo apt-get install \
       libboost-dev libboost-program-options-dev libboost-thread-dev \       libboost-dev libboost-program-options-dev libboost-thread-dev \
       uuid-dev libexpat1-dev libglib2.0-dev libsqlite3-dev libcurl4-gnutls-dev       uuid-dev libexpat1-dev libglib2.0-dev libsqlite3-dev libcurl4-gnutls-dev
- 
- 
  
    
 ===== Build ===== ===== Build =====
  
-Next, you'​ll ​need to get the [[sources]] for IoTivity. Change ​directories ​to the top directory ​of iotivity ​source code. You'll be building with scons, and you should always run the '​scons'​ command in this directory.+Next, you need to get the [[sources]] for IoTivity. Change ​directory ​to the top of the IoTivity ​source code. You'll be building with scons, and you should always run the '​scons'​ command in this directory ​(it's safe: it will fail otherwise, complaining there is no ``SConstruct`` file).
  
  
Line 31: Line 29:
   $ scons   $ scons
  
-(Note: C++ sdk requires cerealPlease follow the instruction in the [[build]] +Note that some required external pieces install automatically,​ but others do notIt is normal ​to get a couple of prompts to fetch something with git before everything will build through.
-message ​to install cereal.)+
  
 ===   Build debug binaries: === ===   Build debug binaries: ===
Line 56: Line 53:
 === Run the samples === === Run the samples ===
  
-<​code>​ $ export LD_LIBRARY_PATH=<​iotivity>/​out/​linux/​x86_64/​release </​code>​ +<​code ​bash> $ export LD_LIBRARY_PATH=<​iotivity>/​out/​linux/​x86_64/​release </​code>​ 
-  * Run the c++ samples in <​iotivity>/​out/​linux/​x86_64/​release/​resource/​examples + 
-  * Run the c samples in <​iotivity>/​out/​linux/​x86_64/​release/​resource/​csdk/​stack/​samples/​linux/​SimpleClientServer+  * Run the c++ samples in ``<​iotivity>/​out/​linux/​x86_64/​release/​resource/​examples`` 
 +  * Run the c samples in ``<​iotivity>/​out/​linux/​x86_64/​release/​resource/​csdk/​stack/​samples/​linux/​SimpleClientServer`` 
 ('<​iotivity>'​ is the path to the '​iotivity'​ project. If your device is x86, arm, or arm64, please change '​x86_64'​ to the proper arch.) ('<​iotivity>'​ is the path to the '​iotivity'​ project. If your device is x86, arm, or arm64, please change '​x86_64'​ to the proper arch.)
  
 ====== How to build IoTivity projects ====== ====== How to build IoTivity projects ======
  
-IoTivity includes a series of projects. You can find all these projects here: +IoTivity includes a series of projects. You can find all these projects here :
-    https://​gerrit.iotivity.org/​gerrit/#/​admin/​projects/​+
  
-You can build the IoTivity project on Linux, Windows, or MAC OSX for various ​OS ( +  https://​gerrit.iotivity.org/​gerrit/#/​admin/​projects/​ 
-Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...). + 
-The output of the build is in this directory:+You can build the IoTivity project on Linux, Windows, or MAC OSX for various  
 +operating systems (Linux, Tizen, Android, Arduino, Windows, MAC OSX, iOS ...). 
 +The output of the build is in this directory :
   <top directory of the project>/​out/<​target_os>/<​target_arch>/<​build_type>/​   <top directory of the project>/​out/<​target_os>/<​target_arch>/<​build_type>/​
-e.g. +For example : 
- iotivity/​out/​android/​armeabi-v7a/​release/​.+  iotivity/​out/​android/​armeabi-v7a/​release/​
  
 This document uses the '​iotivity'​ project as an example; the way to build other This document uses the '​iotivity'​ project as an example; the way to build other
 projects is almost the same. projects is almost the same.
 +
 +Cross-building (targeting a architecture/​OS combination that is not the same
 +as the build machine) is weakly supported at the moment. ​ You may have to do
 +some work to get builds to work, except in a few well debugged cases:
 +building for an Android target works, building on Mac for iOS works, building
 +for Tizen works.
  
 =====  IoTivity project build tool scons ===== =====  IoTivity project build tool scons =====
-  
  
 Scons is a cross-platform build tool, its usage is quite similar to GNU make. Scons is a cross-platform build tool, its usage is quite similar to GNU make.
 To build a project, you just require to run following command at the directory To build a project, you just require to run following command at the directory
-where SConstruct file exists(SConstruct is the entrance of scons build, it's +where an ``SConstruct`` file exists(``SConstruct`` is the entrance of scons build, it's 
-equivalent to Makefile of '​make'​) : +equivalent to ``Makefile`` of '​make'​) : <code bash> ​$ scons [options] [target]</​code>​
-      ​$ scons [options] [target]+
  
 In additional, usually the scons build script of a project provides useful help In additional, usually the scons build script of a project provides useful help
-information(include build options). To see the help information:​ +information(include build options). To see the help information : <code bash> ​$ scons [options] -h</​code>​
-      ​$ scons [options] -h+
  
 Note: If no value is specified for an option, the default value will be used. Note: If no value is specified for an option, the default value will be used.
Line 98: Line 101:
  
 Some more options may be required, please care the '​error'​ notification when build. Some more options may be required, please care the '​error'​ notification when build.
-For help about how to set an option, please run: +For help about how to set an option, please run : <code bash> ​$ scons TARGET_OS=xxx TARGET_ARCH=yyy [XXX=zzz ...] -h</​code>​
-     $ scons TARGET_OS=xxx TARGET_ARCH=yyy [XXX=zzz ...] -h+
  
  
Line 106: Line 108:
 ==== Scons ==== ==== Scons ====
  
-    ​Please refer to the following page to install scons: +Please refer to the following page to install scons: 
-      http://​www.scons.org/​doc/​production/​HTML/​scons-user.html#​chap-build-install + 
-      (Note: on Windows, install Python 2.x before installing scons)+  ​http://​www.scons.org/​doc/​production/​HTML/​scons-user.html#​chap-build-install 
 + 
 +(Note: on Windows, install Python 2.x before installing scons) 
 + 
 +The safest way to insure an up to date scons is to build a Python virtualenv 
 +and ``pip install scons`` in it.
  
 ==== IDE/SDK Prerequites ==== ==== IDE/SDK Prerequites ====
Line 174: Line 181:
  
  
-===== Build IoTivity project on Linux(Ubuntu) =====+===== Build IoTivity project on Linux (Ubuntu) =====
  
 === Build IoTivity project for Linux === === Build IoTivity project for Linux ===
-      ​$ cd <top directory of the project>​ + 
-      $ sudo apt-get install libboost-dev libexpat1-dev libboost-thread-dev +  ​$ cd <top directory of the project>​ 
-      $ scons+  $ sudo apt-get install libboost-dev libexpat1-dev libboost-thread-dev 
 +  $ scons
  
 === Build IoTivity project for Android === === Build IoTivity project for Android ===
-      ​$ cd <top directory of the project>​ + 
-      $ scons TARGET_OS=android TARGET_ARCH=xxx +  ​$ cd <top directory of the project>​ 
-(xxx can be x86, armeabi, armeabi-v7a,​ armeabi-v7a-hard. To see all of its +  $ scons TARGET_OS=android TARGET_ARCH=xxx 
-allowed ​value, please execute command ​'scons TARGET_OS=android -Q -h')+ 
 +(xxx can be x86, armeabi, armeabi-v7a,​ armeabi-v7a-hard. To see all  
 +allowed ​values, please execute command ​``scons TARGET_OS=android -Q -h``)
  
 === Build IoTivity project for Arduino === === Build IoTivity project for Arduino ===
-      ​$ cd <top directory of the project>​ + 
-      $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy +  ​$ cd <top directory of the project>​ 
-(xxx can be avr, arm; yyy is the name of the board, to get its allowed ​value +  $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy 
-run: scons TARGET_OS=arduino TARGET_ARCH=xxx -h. You may see a option '​CPU'​ in + 
-the output of above command line, that's due to some boards ​have different +(xxx can be avr, arm; yyy is the name of the board, to get allowed ​values 
-processors, to specify the processor, add 'CPU=zzz' ​in the command line. If no+run: ``scons TARGET_OS=arduino TARGET_ARCH=xxx -h``. You may see a option '​CPU'​ in 
 +the output of above command line, that's due to some boards ​having ​different 
 +processors, to specify the processor, add ``CPU=zzz`` in the command line. If no
 '​CPU'​ option exists, that means the board only support one kind of processor, '​CPU'​ option exists, that means the board only support one kind of processor,
-it'​s ​unnecessary to specify it)+and it is unnecessary to specify it)
  
 === Build Iotivity project for Tizen === === Build Iotivity project for Tizen ===
-      ​$ cd <top directory of the project>​ + 
-      $ gbs build -A xxx --packaging-dir tools/​tizen/​+  ​$ cd <top directory of the project>​ 
 +  $ gbs build -A xxx --packaging-dir tools/​tizen/​ 
 (xxx can be i586 or armv7l, we provide the spec file required by gbs tool at (xxx can be i586 or armv7l, we provide the spec file required by gbs tool at
 toools/​tizen directory. gbs is default build tool for [[Tizen]] platfrom, we can toools/​tizen directory. gbs is default build tool for [[Tizen]] platfrom, we can
Line 205: Line 219:
 https://​source.tizen.org/​documentation/​developer-guide/​getting-started-guide) https://​source.tizen.org/​documentation/​developer-guide/​getting-started-guide)
  
-==== Build IoTivity project on Android ====+==== Build IoTivity project on Android ​(same as on Ubuntu) ​==== 
 + 
 +=== Build IoTivity project for Android === 
 + 
 +  $ cd <top directory of the project>​ 
 +  $ scons TARGET_OS=android TARGET_ARCH=xxx
  
-=== Build IoTivity project for Android(It'​s the same as on Ubuntu) === 
-      $ cd <top directory of the project> 
-      $ scons TARGET_OS=android TARGET_ARCH=xxx 
 (xxx can be x86, armeabi, armeabi-v7a,​ armeabi-v7a-hard ...) (xxx can be x86, armeabi, armeabi-v7a,​ armeabi-v7a-hard ...)
  
-=== Build IoTivity project for Arduino(It's the same as on Ubuntu) === +=== Build IoTivity project for Arduino (same as on Ubuntu) === 
-      $ cd <top directory of the project>​ + 
-      $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy+  ​$ cd <top directory of the project>​ 
 +  $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy 
 (xxx can be avr, arm; yyy is the name of the board, to get its allowed value (xxx can be avr, arm; yyy is the name of the board, to get its allowed value
-run: scons TARGET_OS=arduino TARGET_ARCH=xxx -h. You may see a option '​CPU'​ in+run: ``scons TARGET_OS=arduino TARGET_ARCH=xxx -h``. You may see a option '​CPU'​ in
 the output of above command line, that's due to some boards have different the output of above command line, that's due to some boards have different
-processor, to specify the processor, add 'CPU=zzz' ​in the command line. If no+processor, to specify the processor, add ``CPU=zzz`` in the command line. If no
 '​CPU'​ option exists, that means the board only support one kind of processor, '​CPU'​ option exists, that means the board only support one kind of processor,
 it's unnecessary to specify it) it's unnecessary to specify it)
- 
  
 Note: Currently most IoTivity project doesn'​t support Windows, so you can't set Note: Currently most IoTivity project doesn'​t support Windows, so you can't set
Line 227: Line 244:
  
 That's to say if the project doesn'​t support Windows, run: That's to say if the project doesn'​t support Windows, run:
-      ​$ scons TARGET_OS=windows ....+ 
 +  ​$ scons TARGET_OS=windows .... 
 or run on Windows or run on Windows
-      $ scons 
-may always fail. 
  
 +  $ scons
 +
 +may always fail.
  
 ==== Build IoTivity project on Mac OSX ==== ==== Build IoTivity project on Mac OSX ====
  
 === Build IoTivity project for Mac OSX === === Build IoTivity project for Mac OSX ===
-      ​$ cd <top directory of the project>​ + 
-      $ scons SYS_VERSION=yyy+  ​$ cd <top directory of the project>​ 
 +  $ scons SYS_VERSION=yyy 
 (yyy is the OSX version, e.g. 10.10) (yyy is the OSX version, e.g. 10.10)
  
 === Build IoTivity project for Android(It'​s the same as on Ubuntu) === === Build IoTivity project for Android(It'​s the same as on Ubuntu) ===
-      ​$ cd <top directory of the project>​ + 
-      $ scons TARGET_OS=android TARGET_ARCH=xxx+  ​$ cd <top directory of the project>​ 
 +  $ scons TARGET_OS=android TARGET_ARCH=xxx 
 (xxx can be x86, armeabi, armeabi-v7a,​ armeabi-v7a-hard) (xxx can be x86, armeabi, armeabi-v7a,​ armeabi-v7a-hard)
  
 === Build IoTivity project for IOS === === Build IoTivity project for IOS ===
-      ​$ cd <top directory of the project>​ + 
-      $ scons TARGET_OS=ios TARGET_ARCH=xxx SYS_VERSION=yyy+  ​$ cd <top directory of the project>​ 
 +  $ scons TARGET_OS=ios TARGET_ARCH=xxx SYS_VERSION=yyy 
 (xxx can be i386, x86_64, armv7, armv7s, arm64, yyy is IOS version, e.g. 8.3) (xxx can be i386, x86_64, armv7, armv7s, arm64, yyy is IOS version, e.g. 8.3)
  
Line 255: Line 281:
  
 To build: To build:
 +
      $ auto_build.sh <​path-to-android-ndk>​      $ auto_build.sh <​path-to-android-ndk>​
 +
 To clean: To clean:
 +
      $ auto_build.sh -c      $ auto_build.sh -c
  
 2) For Arduino build, the Time library should >=1.3. The old can only be built 2) For Arduino build, the Time library should >=1.3. The old can only be built
 with Arduino IDE 1.0.x with Arduino IDE 1.0.x
 +
build_iotivity_with_ubuntu_build_machine.txt · Last modified: 2017/10/26 14:39 by Mats Wichmann