From: Harish Kumara Marappa Date: Thu, 21 May 2015 13:49:43 +0000 (+0530) Subject: Fix for tizen build failure issue. X-Git-Tag: 1.2.0+RC1~1680 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25973756a67448dc33a0b479ae2b6877cee88842;p=platform%2Fupstream%2Fiotivity.git Fix for tizen build failure issue. Removed glib package dependency and added uuid package dependency. Change-Id: I31ab7b2946dea000a499248276160fb20cd2214d Signed-off-by: Harish Kumara Marappa Reviewed-on: https://gerrit.iotivity.org/gerrit/1066 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/Readme.scons.txt b/Readme.scons.txt index ef0542f..d433b3b 100644 --- a/Readme.scons.txt +++ b/Readme.scons.txt @@ -115,6 +115,16 @@ Java codes, this isn't required) so you don't need to add it in command line each time. The build script will guide you to do that.) +Tizen: +To build for tizen platform cereal library is needed. +Please download cereal if it is not present in extlibs/cereal folder +and apply the patch as following: + $ git clone https://github.com/USCiLab/cereal.git extlibs/cereal/cereal + $ cd extlibs/cereal/cereal + $ git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245 + $ git apply ../../../resource/patches/cereal_gcc46.patch + + * 3. External libraries IoTivity project depends on some external libraries, such as boost, expat ... During building, the existence of external library will be checked, if it doesn't @@ -151,10 +161,10 @@ it's unnecessary to specify it) 4. Build Iotivity project for Tizen $ cd - $ gbs build -A xxx --packaging-dir tools/tizen/ -(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 -refer the following wiki to setup Tizen development environment: + $ sh gbsbuild.sh +(we provide the spec file required by gbs tool at toools/tizen directory. +gbs is default build tool for Tizen platfrom, we can refer the following +wiki to setup Tizen development environment: https://source.tizen.org/documentation/developer-guide/getting-started-guide) === Build IoTivity project on Android === diff --git a/build_common/SConscript b/build_common/SConscript index afe6f56..16a81f9 100644 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -267,10 +267,7 @@ else: If target_os is not Yocto, continue with the regular build process ''' # Load config of target os - if target_os in ['linux', 'tizen']: - env.SConscript('linux/SConscript') - else: - env.SConscript(target_os + '/SConscript') + env.SConscript(target_os + '/SConscript') # Delete the temp files of configuration if env.GetOption('clean'): diff --git a/build_common/linux/SConscript b/build_common/linux/SConscript index a95c187..b1640e1 100644 --- a/build_common/linux/SConscript +++ b/build_common/linux/SConscript @@ -22,11 +22,6 @@ env.AppendUnique(CCFLAGS = ['-Wall', '-fPIC']) env.AppendUnique(LIBS = ['uuid']) env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread']) -if env.get('TARGET_OS') == 'tizen': - env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-DSLP_SDK_LOG', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE']) - env.ParseConfig("pkg-config glib-2.0 gthread-2.0 --cflags --libs") - env.ParseConfig("pkg-config dlog --cflags --libs") - # Set arch flags target_arch = env.get('TARGET_ARCH') if target_arch in ['x86']: diff --git a/build_common/tizen/SConscript b/build_common/tizen/SConscript new file mode 100644 index 0000000..cc3b535 --- /dev/null +++ b/build_common/tizen/SConscript @@ -0,0 +1,46 @@ +## +# This script set linux specific flags (GNU GCC) +# +## +Import('env') + +print "Reading linux configuration script" + +# Set release/debug flags +if env.get('RELEASE'): + env.AppendUnique(CCFLAGS = ['-Os']) + env.AppendUnique(CPPDEFINES = ['NDEBUG']) +else: + env.AppendUnique(CCFLAGS = ['-g']) + +if env.get('LOGGING'): + env.AppendUnique(CPPDEFINES = ['-DTB_LOG']) + +env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '__linux__']) +env.AppendUnique(CFLAGS = ['-std=gnu99']) +env.AppendUnique(CCFLAGS = ['-Wall', '-fPIC']) +env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread']) + +if env.get('TARGET_OS') == 'tizen': + env.AppendUnique(CCFLAGS = ['-D__TIZEN__', '-DSLP_SDK_LOG', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE']) + env.ParseConfig("pkg-config dlog --cflags --libs") + +# Set arch flags +target_arch = env.get('TARGET_ARCH') +if target_arch in ['x86']: + env.AppendUnique(CCFLAGS = ['-m32']) + env.AppendUnique(LINKFLAGS = ['-m32']) +elif target_arch in ['x86_64']: + env.AppendUnique(CCFLAGS = ['-m64']) + env.AppendUnique(LINKFLAGS = ['-m64']) +elif target_arch.find('v7a-hard') > 0: + env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) + env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard']) + env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard']) + env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard']) +elif target_arch.find('v7a') > 0: + env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) +elif target_arch.find('arm64') >= 0: + env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) +else: + env.AppendUnique(CPPFLAGS = ['-march=armv5te']) diff --git a/resource/csdk/SConscript b/resource/csdk/SConscript index 9a6fced..82ed700 100644 --- a/resource/csdk/SConscript +++ b/resource/csdk/SConscript @@ -63,10 +63,13 @@ if target_os not in ['windows', 'winrt']: liboctbstack_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) -if target_os in ['android', 'linux']: +if target_os in ['android', 'linux', 'tizen']: liboctbstack_env.AppendUnique(LIBS = ['connectivity_abstraction']) liboctbstack_env.AppendUnique(LIBS = ['coap', 'm']) +if target_os == 'tizen': + liboctbstack_env.ParseConfig("pkg-config --cflags --libs uuid") + if target_os not in ['android', 'arduino', 'windows', 'winrt']: liboctbstack_env.AppendUnique(LIBS = ['pthread']) diff --git a/resource/csdk/connectivity/src/ip_adapter/SConscript b/resource/csdk/connectivity/src/ip_adapter/SConscript index 57ddf1b..2320380 100644 --- a/resource/csdk/connectivity/src/ip_adapter/SConscript +++ b/resource/csdk/connectivity/src/ip_adapter/SConscript @@ -10,6 +10,9 @@ target_os = env.get('TARGET_OS') inc_files = env.get('CPPPATH') src_dir = './ip_adapter/' +if target_os == 'tizen': + env.ParseConfig("pkg-config --cflags --libs capi-network-wifi") + #Source files to build common for all platforms if target_os == 'arduino': env.AppendUnique(CA_SRC=[src_dir+'caipadapter_singlethread.c']) diff --git a/resource/third_party_libs.scons b/resource/third_party_libs.scons index 9932616..46b80bd 100644 --- a/resource/third_party_libs.scons +++ b/resource/third_party_libs.scons @@ -47,11 +47,6 @@ if target_os in ['linux', 'tizen']: ''' % target_arch conf = Configure(lib_env) - - if target_os in ['tizen'] and not conf.CheckLib('glib-2.0'): - print 'Install glib-2.0 to compile on Tizen platforms' - Exit(1) - conf.Finish() diff --git a/service/soft-sensor-manager/SConscript b/service/soft-sensor-manager/SConscript index ac460e4..1a645ef 100644 --- a/service/soft-sensor-manager/SConscript +++ b/service/soft-sensor-manager/SConscript @@ -156,9 +156,6 @@ ssmcore_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) ssmcore_env.AppendUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap']) -if target_os in ['tizen']: - ssmcore_env.ParseConfig('pkg-config --libs glib-2.0'); - shared_libssmcore = ssmcore_env.SharedLibrary( target = 'SSMCore', source = [ssm_core_cpp_src, ssm_core_c_src] diff --git a/service/third_party_libs.scons b/service/third_party_libs.scons index 182fdef..6ddeebc 100644 --- a/service/third_party_libs.scons +++ b/service/third_party_libs.scons @@ -49,11 +49,11 @@ if target_os in ['linux', 'tizen']: conf = Configure(lib_env) - if not conf.CheckLib('boost_thread', language='C++'): + if target_os not in ['tizen'] and not conf.CheckLib('boost_thread', language='C++'): print 'Did not find boost_thread, exiting!' Exit(1) - if not conf.CheckLib('boost_system', language='C++'): + if target_os not in ['tizen'] and not conf.CheckLib('boost_system', language='C++'): print 'Did not find boost_system, exiting!' Exit(1) diff --git a/tools/tizen/iotivity.spec b/tools/tizen/iotivity.spec index 381ccf2..e908d7b 100644 --- a/tools/tizen/iotivity.spec +++ b/tools/tizen/iotivity.spec @@ -16,8 +16,7 @@ BuildRequires: boost-thread BuildRequires: boost-system BuildRequires: boost-filesystem BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(gthread-2.0) -BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(capi-network-wifi) BuildRequires: pkgconfig(capi-network-bluetooth) Requires(postun): /sbin/ldconfig @@ -59,7 +58,7 @@ export RPM_ARCH=%{_arch} %endif -scons -j 4 TARGET_OS=tizen TARGET_ARCH=$RPM_ARCH TARGET_TRANSPORT=WIFI +scons -j 4 TARGET_OS=tizen TARGET_ARCH=$RPM_ARCH TARGET_TRANSPORT=IP %install rm -rf %{buildroot} @@ -75,7 +74,6 @@ cp out/tizen/*/release/service/protocol-plugin/plugins/mqtt-light/*.so %{buildro cp resource/csdk/stack/include/ocstack.h %{buildroot}%{_includedir} cp resource/csdk/stack/include/ocstackconfig.h %{buildroot}%{_includedir} -#cp resource/csdk/ocsocket/include/ocsocket.h %{buildroot}%{_includedir} cp resource/oc_logger/include/oc_logger.hpp %{buildroot}%{_includedir} cp resource/oc_logger/include/oc_log_stream.hpp %{buildroot}%{_includedir} cp resource/oc_logger/include/oc_logger.h %{buildroot}%{_includedir}