codeql_buildscript.sh 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  4. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. #
  6. sudo apt update
  7. sudo apt install -y build-essential cmake g++-multilib libgcc-12-dev lib32gcc-12-dev ccache ninja-build
  8. WAMR_DIR=${PWD}
  9. # TODO: use pre-built llvm binary to build wamrc to
  10. # avoid static code analysing for llvm
  11. : '
  12. # build wamrc
  13. cd ${WAMR_DIR}/wamr-compiler
  14. ./build_llvm.sh
  15. rm -fr build && mkdir build && cd build
  16. cmake ..
  17. make -j
  18. if [[ $? != 0 ]]; then
  19. echo "Failed to build wamrc!"
  20. exit 1;
  21. fi
  22. '
  23. # build iwasm with default features enabled
  24. cd ${WAMR_DIR}/product-mini/platforms/linux
  25. rm -fr build && mkdir build && cd build
  26. cmake ..
  27. make -j
  28. if [[ $? != 0 ]]; then
  29. echo "Failed to build iwasm with default features enabled!"
  30. exit 1;
  31. fi
  32. # build iwasm with default features enabled on x86_32
  33. cd ${WAMR_DIR}/product-mini/platforms/linux
  34. rm -fr build && mkdir build && cd build
  35. cmake .. -DWAMR_BUILD_TARGET=X86_32
  36. make -j
  37. if [[ $? != 0 ]]; then
  38. echo "Failed to build iwasm with default features enabled on x86_32!"
  39. exit 1;
  40. fi
  41. # build iwasm with classic interpreter enabled
  42. cd ${WAMR_DIR}/product-mini/platforms/linux
  43. rm -rf build && mkdir build && cd build
  44. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_INTERP=0
  45. make -j
  46. if [[ $? != 0 ]]; then
  47. echo "Failed to build iwasm with classic interpreter enabled!"
  48. exit 1;
  49. fi
  50. # build iwasm with extra features enabled
  51. cd ${WAMR_DIR}/product-mini/platforms/linux
  52. rm -fr build && mkdir build && cd build
  53. cmake .. -DCMAKE_BUILD_TYPE=Debug \
  54. -DWAMR_BUILD_LIB_PTHREAD=1 -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
  55. -DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_SIMD=1 \
  56. -DWAMR_BUILD_TAIL_CALL=1 -DWAMR_BUILD_REF_TYPES=1 \
  57. -DWAMR_BUILD_CUSTOM_NAME_SECTION=1 -DWAMR_BUILD_MEMORY_PROFILING=1 \
  58. -DWAMR_BUILD_PERF_PROFILING=1 -DWAMR_BUILD_DUMP_CALL_STACK=1 \
  59. -DWAMR_BUILD_LOAD_CUSTOM_SECTION=1
  60. make -j
  61. if [[ $? != 0 ]]; then
  62. echo "Failed to build wamrc iwasm with extra features enabled!"
  63. exit 1;
  64. fi
  65. # build iwasm with global heap pool enabled
  66. cd ${WAMR_DIR}/product-mini/platforms/linux
  67. rm -fr build && mkdir build && cd build
  68. cmake .. -DCMAKE_BUILD_TYPE=Debug \
  69. -DWAMR_BUILD_ALLOC_WITH_USER_DATA=1 \
  70. -DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1 \
  71. -DWAMR_BUILD_GLOBAL_HEAP_POOL=1 \
  72. -DWAMR_BUILD_GLOBAL_HEAP_SIZE=131072
  73. make -j
  74. if [[ $? != 0 ]]; then
  75. echo "Failed to build iwasm with global heap pool enabled!"
  76. exit 1;
  77. fi
  78. # build iwasm with wasi-threads enabled
  79. cd ${WAMR_DIR}/product-mini/platforms/linux
  80. rm -fr build && mkdir build && cd build
  81. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LIB_WASI_THREADS=1
  82. make -j
  83. if [[ $? != 0 ]]; then
  84. echo "Failed to build iwasm with wasi-threads enabled!"
  85. exit 1;
  86. fi
  87. # build iwasm with GC enabled
  88. cd ${WAMR_DIR}/product-mini/platforms/linux
  89. rm -rf build && mkdir build && cd build
  90. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_GC=1
  91. make -j
  92. if [[ $? != 0 ]]; then
  93. echo "Failed to build iwasm with GC enabled!"
  94. exit 1;
  95. fi
  96. # build iwasm with exception handling enabled
  97. cd ${WAMR_DIR}/product-mini/platforms/linux
  98. rm -rf build && mkdir build && cd build
  99. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_EXCE_HANDLING=1
  100. make -j
  101. if [[ $? != 0 ]]; then
  102. echo "Failed to build iwasm with exception handling enabled!"
  103. exit 1;
  104. fi
  105. # build iwasm with memory64 enabled
  106. cd ${WAMR_DIR}/product-mini/platforms/linux
  107. rm -rf build && mkdir build && cd build
  108. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MEMORY64=1
  109. make -j
  110. if [[ $? != 0 ]]; then
  111. echo "Failed to build iwasm with memory64 enabled!"
  112. exit 1;
  113. fi
  114. # build iwasm with multi-memory enabled
  115. cd ${WAMR_DIR}/product-mini/platforms/linux
  116. rm -rf build && mkdir build && cd build
  117. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MULTI_MEMORY=1
  118. make -j
  119. if [[ $? != 0 ]]; then
  120. echo "Failed to build iwasm with multi-memory enabled!"
  121. exit 1;
  122. fi
  123. # build iwasm with hardware boundary check disabled
  124. cd ${WAMR_DIR}/product-mini/platforms/linux
  125. rm -rf build && mkdir build && cd build
  126. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_DISABLE_HW_BOUND_CHECK=1
  127. make -j
  128. if [[ $? != 0 ]]; then
  129. echo "Failed to build iwasm with hardware boundary check disabled!"
  130. exit 1;
  131. fi
  132. # build iwasm with quick AOT entry disabled
  133. cd ${WAMR_DIR}/product-mini/platforms/linux
  134. rm -rf build && mkdir build && cd build
  135. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_QUICK_AOT_ENTRY=0
  136. make -j
  137. if [[ $? != 0 ]]; then
  138. echo "Failed to build iwasm with quick AOT entry disabled!"
  139. exit 1;
  140. fi
  141. # build iwasm with wakeup of blocking operations disabled
  142. cd ${WAMR_DIR}/product-mini/platforms/linux
  143. rm -rf build && mkdir build && cd build
  144. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_DISABLE_WAKEUP_BLOCKING_OP=1
  145. make -j
  146. if [[ $? != 0 ]]; then
  147. echo "Failed to build iwasm with wakeup of blocking operations disabled!"
  148. exit 1;
  149. fi
  150. # build iwasm with module instance context disabled
  151. cd ${WAMR_DIR}/product-mini/platforms/linux
  152. rm -rf build && mkdir build && cd build
  153. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MODULE_INST_CONTEXT=0 \
  154. -DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_LIBC_WASI=0
  155. make -j
  156. if [[ $? != 0 ]]; then
  157. echo "Failed to build iwasm with module instance context disabled!"
  158. exit 1;
  159. fi
  160. # build iwasm with libc-uvwasi enabled
  161. cd ${WAMR_DIR}/product-mini/platforms/linux
  162. rm -fr build && mkdir build && cd build
  163. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LIBC_UVWASI=1
  164. make -j
  165. if [[ $? != 0 ]]; then
  166. echo "Failed to build iwasm with libc-uvwasi enabled!"
  167. exit 1;
  168. fi
  169. # build iwasm with fast jit lazy mode enabled
  170. cd ${WAMR_DIR}/product-mini/platforms/linux
  171. rm -rf build && mkdir build && cd build
  172. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1
  173. make -j
  174. if [[ $? != 0 ]]; then
  175. echo "Failed to build iwasm with fast jit lazy mode enabled!"
  176. exit 1;
  177. fi
  178. # build iwasm with fast jit eager mode enabled
  179. cd ${WAMR_DIR}/product-mini/platforms/linux
  180. rm -rf build && mkdir build && cd build
  181. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1
  182. make -j
  183. if [[ $? != 0 ]]; then
  184. echo "Failed to build iwasm with fast jit eager mode enabled!"
  185. exit 1;
  186. fi
  187. # TODO: use pre-built llvm binary to build llvm-jit and multi-tier-jit
  188. : '
  189. # build iwasm with llvm jit lazy mode enabled
  190. cd ${WAMR_DIR}/product-mini/platforms/linux
  191. rm -rf build && mkdir build && cd build
  192. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_JIT=1
  193. make -j
  194. if [[ $? != 0 ]]; then
  195. echo "Failed to build llvm jit lazy mode enabled!"
  196. exit 1;
  197. fi
  198. # build iwasm with llvm jit eager mode enabled
  199. cd ${WAMR_DIR}/product-mini/platforms/linux
  200. rm -rf build && mkdir build && cd build
  201. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0
  202. make -j
  203. if [[ $? != 0 ]]; then
  204. echo "Failed to build llvm jit eager mode enabled!"
  205. exit 1;
  206. fi
  207. # build iwasm with multi-tier jit enabled
  208. cd ${WAMR_DIR}/product-mini/platforms/linux
  209. rm -rf build && mkdir build && cd build
  210. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
  211. -DWAMR_BUILD_FAST_JIT_DUMP=1
  212. make -j
  213. if [[ $? != 0 ]]; then
  214. echo "Failed to build iwasm with multi-tier jit enabled!"
  215. exit 1;
  216. fi
  217. '
  218. # build iwasm with wasm mini-loader enabled
  219. cd ${WAMR_DIR}/product-mini/platforms/linux
  220. rm -rf build && mkdir build && cd build
  221. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MINI_LOADER=1
  222. make -j
  223. if [[ $? != 0 ]]; then
  224. echo "Failed to build with wasm mini-loader enabled!"
  225. exit 1;
  226. fi
  227. # build iwasm with source debugging enabled
  228. cd ${WAMR_DIR}/product-mini/platforms/linux
  229. rm -rf build && mkdir build && cd build
  230. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_DEBUG_INTERP=1 -DWAMR_BUILD_DEBUG_AOT=1
  231. make -j
  232. if [[ $? != 0 ]]; then
  233. echo "Failed to build iwasm with source debugging enabled!"
  234. exit 1;
  235. fi
  236. # build iwasm with AOT static PGO enabled
  237. cd ${WAMR_DIR}/product-mini/platforms/linux
  238. rm -rf build && mkdir build && cd build
  239. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_STATIC_PGO=1
  240. make -j
  241. if [[ $? != 0 ]]; then
  242. echo "Failed to build iwasm with AOT static PGO enabled!"
  243. exit 1;
  244. fi
  245. # build iwasm with configurable bounds checks enabled
  246. cd ${WAMR_DIR}/product-mini/platforms/linux
  247. rm -rf build && mkdir build && cd build
  248. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_CONFIGURABLE_BOUNDS_CHECKS=1
  249. make -j
  250. if [[ $? != 0 ]]; then
  251. echo "Failed to build iwasm with configurable bounds checks enabled!"
  252. exit 1;
  253. fi
  254. # build iwasm with linux perf support enabled
  255. cd ${WAMR_DIR}/product-mini/platforms/linux/
  256. rm -rf build && mkdir build && cd build
  257. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LINUX_PERF=1
  258. make -j
  259. if [[ $? != 0 ]]; then
  260. echo "Failed to build iwasm with linux perf support enabled!"
  261. exit 1;
  262. fi
  263. # build iwasm with shared heap enabled
  264. cd ${WAMR_DIR}/product-mini/platforms/linux
  265. rm -rf build && mkdir build && cd build
  266. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_SHARED_HEAP=1
  267. make -j
  268. if [[ $? != 0 ]]; then
  269. echo "Failed to build iwasm with shared heap enabled!"
  270. exit 1;
  271. fi
  272. # build iwasm with dynamic aot debug enabled
  273. cd ${WAMR_DIR}/product-mini/platforms/linux
  274. rm -rf build && mkdir build && cd build
  275. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_DYNAMIC_AOT_DEBUG=1
  276. make -j
  277. if [[ $? != 0 ]]; then
  278. echo "Failed to build iwasm dynamic aot debug enabled!"
  279. exit 1;
  280. fi