You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

227 lines
10 KiB

  1. From 2533c88e18de689dbb26cfd4d585b1a991533c76 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
  3. Date: Tue, 21 Jul 2015 22:00:18 +0200
  4. Subject: [PATCH] build: make build fail if unresolved symbols found
  5. gcc links shared libs also when there are still some unresolved
  6. symbols, you have to specify it explicitly to make it fail in such
  7. cases. I think a compiler should fail in such cases otherwise
  8. someone will add some not intended dependencies or some existing
  9. dependencies are not getting declared.
  10. This patch makes gcc fail in such cases. I have only activated this for
  11. libs build in a Linux build and explicitly deactivates it for windows
  12. (does this even work at all?) This should be build tested with Android
  13. also.
  14. This was build tested for Linux and Android.
  15. This patch depends on some other patches I send which are fixing the
  16. problems I found with this change.
  17. Change-Id: I9ab79896ca2e86e9226cd9b39060a0763ef89694
  18. Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
  19. Reviewed-on: https://gerrit.iotivity.org/gerrit/1802
  20. Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
  21. Reviewed-by: Erich Keane <erich.keane@intel.com>
  22. Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
  23. Reviewed-by: Uze Choi <uzchoi@samsung.com>
  24. ---
  25. extlibs/expat/SConscript | 3 +++
  26. .../csdk/connectivity/samples/android/SConscript | 1 +
  27. resource/csdk/connectivity/src/SConscript | 3 +++
  28. resource/oc_logger/SConscript | 3 +++
  29. resource/src/SConscript | 3 +++
  30. service/notification-manager/SConscript | 3 +++
  31. service/protocol-plugin/plugin-manager/SConscript | 4 ++++
  32. .../plugin-manager/src/Android/jni/SConscript | 1 +
  33. service/protocol-plugin/plugins/SConscript | 3 +++
  34. .../plugins/mqtt-fan/lib/cpp/SConscript | 3 +++
  35. .../resource-manipulation/src/common/SConscript | 5 ++++-
  36. .../src/resourceContainer/SConscript | 3 +++
  37. .../src/resourceContainer/unittests/SConscript | 3 +++
  38. .../src/serverBuilder/SConscript | 3 +++
  39. service/soft-sensor-manager/SConscript | 3 +++
  40. service/things-manager/SConscript | 3 +++
  41. service/things-manager/sdk/java/jni/SConscript | 3 +++
  42. 17 files changed, 49 insertions(+), 1 deletion(-)
  43. --- a/extlibs/expat/SConscript
  44. +++ b/extlibs/expat/SConscript
  45. @@ -35,6 +35,9 @@ if target_os not in ['windows', 'winrt']
  46. '-fexceptions', '-fno-common'])
  47. expat_env.AppendUnique(CPPDEFINES = ['HAVE_EXPAT_CONFIG_H'])
  48. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  49. + expat_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  50. +
  51. ######################################################################
  52. # Source files and Targets
  53. ######################################################################
  54. --- a/resource/csdk/connectivity/src/SConscript
  55. +++ b/resource/csdk/connectivity/src/SConscript
  56. @@ -27,6 +27,9 @@ env.AppendUnique(CPPPATH = [ os.path.joi
  57. if ca_os not in ['arduino', 'windows', 'winrt']:
  58. env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
  59. +if ca_os not in ['darwin', 'ios', 'windows', 'winrt']:
  60. + env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  61. +
  62. if ca_os in ['darwin','ios']:
  63. env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
  64. --- a/resource/oc_logger/SConscript
  65. +++ b/resource/oc_logger/SConscript
  66. @@ -42,6 +42,9 @@ if target_os not in ['arduino', 'windows
  67. liboc_logger_env.AppendUnique(CFLAGS = ['-Wall', '-std=c99', '-fPIC'])
  68. liboc_logger_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x', '-fPIC'])
  69. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  70. + liboc_logger_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  71. +
  72. ######################################################################
  73. # Source files and Targets
  74. ######################################################################
  75. --- a/resource/src/SConscript
  76. +++ b/resource/src/SConscript
  77. @@ -51,6 +51,9 @@ if target_os == 'linux':
  78. if target_os not in ['windows', 'winrt']:
  79. oclib_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-fPIC'])
  80. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  81. + oclib_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  82. +
  83. if target_os == 'android':
  84. oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
  85. oclib_env.AppendUnique(LIBS = ['boost_thread', 'gnustl_shared', 'log'])
  86. --- a/service/notification-manager/SConscript
  87. +++ b/service/notification-manager/SConscript
  88. @@ -65,6 +65,9 @@ notimgr_env.PrependUnique(LIBS = [
  89. if target_os not in ['windows', 'winrt']:
  90. notimgr_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
  91. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  92. + notimgr_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  93. +
  94. if target_os == 'linux':
  95. notimgr_env.AppendUnique(LIBS = ['pthread'])
  96. --- a/service/protocol-plugin/plugin-manager/SConscript
  97. +++ b/service/protocol-plugin/plugin-manager/SConscript
  98. @@ -61,6 +61,10 @@ if target_os == 'android':
  99. pmimpl_env = plugin_manager_env.Clone()
  100. pmimpl_env.PrependUnique(CCFLAGS = ['-fPIC'])
  101. pmimpl_env.PrependUnique(LIBS = File(env.get('BUILD_DIR') + '/libcpluff.a'))
  102. +
  103. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  104. + pmimpl_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  105. +
  106. pmimpl = pmimpl_env.SharedLibrary('pmimpl', pmimpl_src)
  107. plugin_manager_env.InstallTarget([ppm, pmimpl], 'libppm')
  108. --- a/service/protocol-plugin/plugin-manager/src/Android/jni/SConscript
  109. +++ b/service/protocol-plugin/plugin-manager/src/Android/jni/SConscript
  110. @@ -23,6 +23,7 @@ ppm_jni_env.PrependUnique(LIBS = ['pmimp
  111. ppm_jni_env.AppendUnique(CPPPATH = [ppm_sdk+'/src'])
  112. ppm_jni_env.AppendUnique(CPPPATH = [ppm_sdk+'/../lib/cpluff/libcpluff'])
  113. ppm_jni_env.AppendUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs/rapidxml'])
  114. +ppm_jni_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  115. ######################################################################
  116. # Source files and Targets
  117. --- a/service/protocol-plugin/plugins/SConscript
  118. +++ b/service/protocol-plugin/plugins/SConscript
  119. @@ -40,6 +40,9 @@ if target_os not in ['windows', 'winrt']
  120. plugins_env.PrependUnique(CCFLAGS = ['-fPIC'])
  121. plugins_env.AppendUnique(LINKFLAGS = ['-fPIC'])
  122. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  123. + plugins_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  124. +
  125. if target_os not in ['arduino', 'android']:
  126. plugins_env.AppendUnique(LIBS = ['pthread'])
  127. --- a/service/protocol-plugin/plugins/mqtt-fan/lib/cpp/SConscript
  128. +++ b/service/protocol-plugin/plugins/mqtt-fan/lib/cpp/SConscript
  129. @@ -16,6 +16,9 @@ mosquittopp_env.AppendUnique(CPPPATH = [
  130. if target_os not in ['windows', 'winrt']:
  131. mosquittopp_env.AppendUnique(CFLAGS = ['-Wall', '-ggdb', '-O2', '-fPIC'])
  132. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  133. + mosquittopp_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  134. +
  135. if target_os == 'linux':
  136. mosquittopp_env.AppendUnique(LIBS = ['pthread'])
  137. --- a/service/resource-encapsulation/src/resourceContainer/SConscript
  138. +++ b/service/resource-encapsulation/src/resourceContainer/SConscript
  139. @@ -88,6 +88,9 @@ if target_os not in ['windows', 'winrt']
  140. if target_os != 'android':
  141. resource_container_env.AppendUnique(CXXFLAGS = ['-pthread'])
  142. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  143. + resource_container_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  144. +
  145. if target_os == 'android':
  146. resource_container_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
  147. resource_container_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
  148. --- a/service/resource-encapsulation/src/resourceContainer/unittests/SConscript
  149. +++ b/service/resource-encapsulation/src/resourceContainer/unittests/SConscript
  150. @@ -144,6 +144,9 @@ if int(containerJavaSupport):
  151. test_bundle_env = container_gtest_env.Clone()
  152. test_bundle_env.AppendUnique(CCFLAGS = ['-fPIC'])
  153. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  154. + test_bundle_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  155. +
  156. TEST_BUNDLE_DIR = 'TestBundle/'
  157. test_bundle_env.AppendUnique(CPPPATH = [
  158. TEST_BUNDLE_DIR + 'include',
  159. --- a/service/resource-encapsulation/src/serverBuilder/SConscript
  160. +++ b/service/resource-encapsulation/src/serverBuilder/SConscript
  161. @@ -54,6 +54,9 @@ if target_os not in ['windows', 'winrt']
  162. if target_os != 'android':
  163. server_builder_env.AppendUnique(CXXFLAGS = ['-pthread'])
  164. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  165. + server_builder_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  166. +
  167. if target_os == 'android':
  168. server_builder_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
  169. server_builder_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
  170. --- a/service/soft-sensor-manager/SConscript
  171. +++ b/service/soft-sensor-manager/SConscript
  172. @@ -45,6 +45,9 @@ if target_os not in ['windows', 'winrt']
  173. soft_sensor_manager_env.AppendUnique(LIBS = ['pthread'])
  174. soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-pthread'])
  175. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  176. + soft_sensor_manager_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  177. +
  178. if target_os == 'android':
  179. soft_sensor_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
  180. soft_sensor_manager_env.AppendUnique(LIBS = ['gnustl_shared'])
  181. --- a/service/things-manager/SConscript
  182. +++ b/service/things-manager/SConscript
  183. @@ -43,6 +43,9 @@ if target_os not in ['windows', 'winrt']
  184. things_manager_env.AppendUnique(CXXFLAGS = ['-pthread'])
  185. things_manager_env.AppendUnique(LIBS = ['pthread'])
  186. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  187. + things_manager_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  188. +
  189. if target_os == 'android':
  190. things_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
  191. things_manager_env.PrependUnique(LIBS = ['gnustl_shared'])
  192. --- a/service/things-manager/sdk/java/jni/SConscript
  193. +++ b/service/things-manager/sdk/java/jni/SConscript
  194. @@ -27,6 +27,9 @@ tm_jni_env.AppendUnique(CPPPATH = [tm_sd
  195. tm_jni_env.AppendUnique(CPPPATH = [base_jni])
  196. tm_jni_env.AppendUnique(CPPPATH = ['tm/inc', 'jniutil/inc', extlibs+'/timer/'])
  197. +if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
  198. + tm_jni_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
  199. +
  200. ######################################################################
  201. # Source files and Targets
  202. ######################################################################