codeql_buildscript.sh 8.2 KB

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