1 == Quick guide: build and run IoTivity projects on Ubuntu ==
4 Go to the top directory of 'iotivity' project(Note: should always run 'scons'
5 command in this directory)
8 $ sudo apt-get install git-core scons ssh build-essential g++ doxygen valgrind
10 Install external libraries:
11 $ sudo apt-get install libboost-dev libboost-program-options-dev libboost-thread-dev uuid-dev libssl-dev libtool libglib2.0-dev
13 Build release binaries:
15 (Note: C sdk requires tinycbor. Please follow the instruction in the build
16 message to install tinycbor)
28 $ export LD_LIBRARY_PATH=<iotivity>/out/linux/x86_64/release
29 Run the c++ samples in <iotivity>/out/linux/x86_64/release/resource/examples
30 Run the c samples in <iotivity>/out/linux/x86_64/release/resource/csdk/stack/samples/linux/SimpleClientServer
31 ('<iotivity>' is the path to 'iotivity' project. If your device is x86, arm,
32 or arm64, please change 'x86_64' to the proper arch)
34 3. To build and test IoTivity with Security enabled (required for certification)
35 follow the instructions found in:
36 <iotivity>/resource/csdk/security/README-building-and-running-secure-IoTivity-stack.txt
38 == How to build IoTivity projects ==
40 IoTivity includes a series of projects. You can find all these projects here:
41 https://gerrit.iotivity.org/gerrit/#/admin/projects/
43 You can build IoTivity project on Linux / Windows / MAC OSX for various OS(
44 Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...).
45 The output of the build is in:
46 <top directory of the project>/out/<target_os>/<target_arch>/<build_type>/
48 iotivity/out/android/armeabi-v7a/release/.
50 This document takes 'iotivity' project as example, the way to build other
51 projects is almost the same.
53 === IoTivity project build tool scons ===
55 Scons is a cross-platform build tool, its usage is quite similar to GNU make.
56 To build a project, you just require to run following command at the directory
57 where a SConstruct file exists(SConstruct is the entrance of scons build, it's
58 equivalent to Makefile of 'make') :
59 $ scons [options] [target]
61 In additional, usually the scons build script of a project provides useful help
62 information(include build options). To see the help information:
65 Note: If no value is specified for an option, the default value will be used.
66 The change of options value may impact the help information and the behavior
69 Generally, it's required to specify the target OS and target ARCH, that's to say
70 tell Scons which OS and which ARCH you'd like build this project for. By default,
71 the target OS and ARCH is the same as the host.
73 Some more options may be required, please care the 'error' notification when build.
74 For help about how to set an option, please run:
75 $ scons TARGET_OS=xxx TARGET_ARCH=yyy [XXX=zzz ...] -h
82 Please refer to the following page to install scons:
83 http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
84 (Note: on Windows, install Python 2.x before installing scons)
86 * 2. IDE/SDK Prerequites
87 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
88 please go to the relative page to download and install the required IDE/SDK.
91 To build for Android, Andorid NDK and SDK are required.
92 Android NDK: http://developer.android.com/tools/sdk/ndk/index.html
93 Android SDK: http://developer.android.com/sdk/index.html
94 (Note: as in some IoTivity projects, C++11 features are used, recommend Android
98 To build for Arduino, Arduino IDE is required.
99 Arduino IDE: http://arduino.cc/en/Main/Software
100 (Note: recommend install Arduino IDE >=1.5.8)
102 Arduino builds are dependent on latest Time library. Download it from here:
103 http://www.pjrc.com/teensy/td_libs_Time.html
104 and extract to <arduino_ide_root>/libraries/
106 (Note: If you are using Arduino IDE 1.5.8 BETA on Windows, it may pop up some
107 dll isn't found. please copy relative dll from the IDE directory to
108 C:\Windows\SysWOW64. IDE 1.5.7 doesn't have this issue. Other version IDE isn't
112 To build for Mac OSX or IOS, Xcode is required.
113 Xcode: https://developer.apple.com/xcode/downloads/
116 To build the Java code, JDK is required.
117 JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
118 (If the project doesn't include Java code or you wouldn't like build the
119 Java codes, this isn't required)
121 (Note: for convenience, suggest add the IDE/SDK path in environment variable,
122 so you don't need to add it in command line each time. The build script will
123 guide you to do that.)
126 To build for tizen platform tinycbor library is needed.
127 Please download tinycbor if it is not present in extlibs/tinycbor folder
128 by doing the following:
129 $ git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor
132 * 3. External libraries
133 IoTivity project depends on some external libraries, such as boost ...
134 During building, the existence of external library will be checked, if it doesn't
135 exist, the build script will try to download, unpack and build the library or
136 notify user to install it.
138 Downloading and unpacking may fail due to network problem or required unpacking
139 tool isn't installed. An message will be displayed, please follow the message
143 === Build IoTivity project ===
146 * Possible values for <TARGET_TRANSPORT> are: ALL, IP, BLE
148 1. Go to root directory
149 $ cd <top directory of the project>
150 $ sudo apt-get install libboost-dev libboost-thread-dev libssl-dev libtool
152 2. Execute following command(s) to start build based on transport selection required
154 -> Building for all transports :
155 $ scons TARGET_OS=linux TARGET_TRANSPORT=ALL
157 -> Building for a specific transport :
158 $ scons TARGET_OS=linux TARGET_TRANSPORT=IP
160 -> Building for multiple transports :
161 $ scons TARGET_OS=linux TARGET_TRANSPORT=IP,BLE TARGET_ARCH=xxx
163 -> Clean Build (all transports) :
164 $ scons TARGET_OS=linux TARGET_TRANSPORT=ALL -c (for clean)
167 * Possible values for <TARGET_TRANSPORT> are: ALL, IP, BT, BLE
168 * Possible values for <TARGET_ARCH> are: x86, armeabi, armeabi-v7a, armeabi-v7a-hard
169 (To see all of its allowed value, please execute command 'scons TARGET_OS=android -Q -h')
171 1. Go to root directory
172 $ cd <top directory of the project>
174 2. Execute following command(s) to start build based on transport selection required
176 -> Building for all transports :
177 $ scons TARGET_OS=android TARGET_TRANSPORT=ALL TARGET_ARCH=xxx
179 -> Building for a specific transport :
180 $ scons TARGET_OS=android TARGET_TRANSPORT=IP TARGET_ARCH=xxx
182 -> Building for multiple transports :
183 $ scons TARGET_OS=android TARGET_TRANSPORT=IP,BT,BLE TARGET_ARCH=xxx
185 -> Clean Build (all transports) :
186 $ scons TARGET_OS=android TARGET_TRANSPORT=ALL -c (for clean)
189 * Possible values for <TARGET_TRANSPORT> are: ALL, IP, BT, BLE
191 1. Go to root directory
192 $ cd <top directory of the project>
194 2. Execute following command(s) to start build based on transport selection required
196 -> Building for all transports :
197 $ scons TARGET_OS=tizen TARGET_TRANSPORT=ALL
199 -> Building for a specific transport :
200 $ scons TARGET_OS=tizen TARGET_TRANSPORT=IP
202 -> Building for multiple transports :
203 $ scons TARGET_OS=tizen TARGET_TRANSPORT=IP,BT,BLE TARGET_ARCH=xxx
205 -> Clean Build (all transports) :
206 $ scons TARGET_OS=tizen TARGET_TRANSPORT=ALL -c (for clean)
208 (we provide the spec file required by gbs tool at toools/tizen directory.
209 gbs is default build tool for Tizen platform, we can refer the following
210 wiki to setup Tizen development environment:
211 https://source.tizen.org/documentation/developer-guide/getting-started-guide)
214 * Possible values for <TARGET_TRANSPORT> are: IP, BLE
215 * Possible values for <TARGET_ARCH> are: arv, arm
216 (arv: arduino due, arm: arduino mega)
217 * Possible values for <BOARD> are: arduino_due_x_dbg, arduino_due_x, mega
218 * Possible values for <SHIELD> are: ETH, WIFI
219 (It is required in the case of the arduino due.)
221 1. Go to root directory
222 $ cd <top directory of the project>
223 $ sudo apt-get install dos2unix
225 2. Execute following command(s) to start build based on transport selection required
227 -> Building for a specific transport :
228 $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy SHIELD=zzz
230 (To get allowed values run: scons TARGET_OS=arduino TARGET_ARCH=xxx SHIELD=zzz -h.
231 You may see a option 'CPU' in the output of above command line, that's due to
232 some boards have different processors, to specify the processor, add 'CPU=zzz'
233 in the command line. If no 'CPU' option exists, that means the board only
234 support one kind of processor, it's unnecessary to specify it)
237 * Possible values for <SYS_VERSION> are: OSX version, e.g. 10.9
239 1. Go to root directory
240 $ cd <top directory of the project>
242 2. Execute following command(s) to start build based on transport selection required
244 -> Building for a specific transport :
245 $ scons SYS_VERSION=yyy
248 * Possible values for <TARGET_ARCH> are: i386, x86_64, armv7, armv7s, arm64
249 * Possible values for <SYS_VERSION> are: IOS version, e.g. 7.0
251 1. Go to root directory
252 $ cd <top directory of the project>
254 2. Execute following command(s) to start build based on transport selection required
256 -> Building for a specific transport :
257 $ scons TARGET_OS=ios TARGET_ARCH=xxx SYS_VERSION=yyy
260 * Possible values for <TARGET_ARCH> are: amd64
262 For convenience to build projects supported on Windows a batch file (run.bat) is provided
263 to run many build combinations with TARGET_OS to 'windows'.
265 1. Go to root directory
266 $ cd <top directory of the project>
267 2. To clean before building:
269 3. To build debug amd64 binaries:
271 See run.bat for more example usage parameters
274 * VERBOSE=true or false (Show compilation)
275 * RELEASE=true or false (Build for release?)
276 * LOGGING=true or false (Enable stack logging)
277 * SECURED=1 or 0 (Build with DTLS)
278 * TEST=1 or 0 (Run unit tests)
279 * BUILD_SAMPLE=ON or OFF (Build with sample)
280 * ROUTING=GW or EP (Enable routing)
281 * WITH_TCP=true or false (Enable CoAP over TCP Transport, arduino is not supported)
282 * WITH_RA=true or false (Build with Remote Access module)
283 * RD_MODE=CLIENT or SERVER (Build including Resource Directory)
284 * SIMULATOR=true or false (Build with simulator module)
285 * Possible values for <WITH_MQ> are: PUB,SUB,BROKER (Build including Message Queue)
286 -> PUB : publisher, SUB : subscriber, BROKER : MQ broker(not supported yet)
287 * LOG_LEVEL=DEBUG or INFO or WARNING or ERROR or FATAL
288 (select log level to print, LOGGING option should be true)
289 default is debug level with no private log.
290 ex) LOG_LEVEL=DEBUG : All logs including DEBUG, INFO, WARNING, ERROR, FATAL level is printed.
291 and private log is disabled.
292 LOG_LEVEL=INFO : The logs including INFO, WARNING, ERROR, FATAL level is printed.
293 and private log is disabled.
294 LOG_LEVEL=WARNING : The logs including WARNING, ERROR, FATAL level is printed.
295 LOG_LEVEL=ERROR : The logs including ERROR, FATAL level is printed.
296 LOG_LEVEL=FATAL : FATAL level is printed.
299 1) for convenience, a script (auto_build.sh) is provided to run possible build
300 at once. Following is the usage:
303 $ auto_build.sh <path-to-android-ndk>