codeql_buildscript.sh 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 hardware boundary check disabled
  93. cd ${WAMR_DIR}/product-mini/platforms/linux
  94. rm -rf build && mkdir build && cd build
  95. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_DISABLE_HW_BOUND_CHECK=1
  96. make -j
  97. if [[ $? != 0 ]]; then
  98. echo "Failed to build iwasm with hardware boundary check disabled!"
  99. exit 1;
  100. fi
  101. # build iwasm with quick AOT entry disabled
  102. cd ${WAMR_DIR}/product-mini/platforms/linux
  103. rm -rf build && mkdir build && cd build
  104. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_QUICK_AOT_ENTRY=0
  105. make -j
  106. if [[ $? != 0 ]]; then
  107. echo "Failed to build iwasm with quick AOT entry disabled!"
  108. exit 1;
  109. fi
  110. # build iwasm with wakeup of blocking operations 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_WAKEUP_BLOCKING_OP=1
  114. make -j
  115. if [[ $? != 0 ]]; then
  116. echo "Failed to build iwasm with wakeup of blocking operations disabled!"
  117. exit 1;
  118. fi
  119. # build iwasm with module instance context 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_MODULE_INST_CONTEXT=0 \
  123. -DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_LIBC_WASI=0
  124. make -j
  125. if [[ $? != 0 ]]; then
  126. echo "Failed to build iwasm with module instance context disabled!"
  127. exit 1;
  128. fi
  129. # build iwasm with libc-uvwasi enabled
  130. cd ${WAMR_DIR}/product-mini/platforms/linux
  131. rm -fr build && mkdir build && cd build
  132. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LIBC_UVWASI=1
  133. make -j
  134. if [[ $? != 0 ]]; then
  135. echo "Failed to build iwasm with libc-uvwasi enabled!"
  136. exit 1;
  137. fi
  138. # build iwasm with fast jit lazy mode enabled
  139. cd ${WAMR_DIR}/product-mini/platforms/linux
  140. rm -rf build && mkdir build && cd build
  141. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1
  142. make -j
  143. if [[ $? != 0 ]]; then
  144. echo "Failed to build iwasm with fast jit lazy mode enabled!"
  145. exit 1;
  146. fi
  147. # build iwasm with fast jit eager mode enabled
  148. cd ${WAMR_DIR}/product-mini/platforms/linux
  149. rm -rf build && mkdir build && cd build
  150. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1
  151. make -j
  152. if [[ $? != 0 ]]; then
  153. echo "Failed to build iwasm with fast jit eager mode enabled!"
  154. exit 1;
  155. fi
  156. # TODO: use pre-built llvm binary to build llvm-jit and multi-tier-jit
  157. : '
  158. # build iwasm with llvm jit lazy mode enabled
  159. cd ${WAMR_DIR}/product-mini/platforms/linux
  160. rm -rf build && mkdir build && cd build
  161. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_JIT=1
  162. make -j
  163. if [[ $? != 0 ]]; then
  164. echo "Failed to build llvm jit lazy mode enabled!"
  165. exit 1;
  166. fi
  167. # build iwasm with llvm jit eager mode enabled
  168. cd ${WAMR_DIR}/product-mini/platforms/linux
  169. rm -rf build && mkdir build && cd build
  170. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0
  171. make -j
  172. if [[ $? != 0 ]]; then
  173. echo "Failed to build llvm jit eager mode enabled!"
  174. exit 1;
  175. fi
  176. # build iwasm with multi-tier jit 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_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
  180. -DWAMR_BUILD_FAST_JIT_DUMP=1
  181. make -j
  182. if [[ $? != 0 ]]; then
  183. echo "Failed to build iwasm with multi-tier jit enabled!"
  184. exit 1;
  185. fi
  186. '
  187. # build iwasm with wasm mini-loader enabled
  188. cd ${WAMR_DIR}/product-mini/platforms/linux
  189. rm -rf build && mkdir build && cd build
  190. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MINI_LOADER=1
  191. make -j
  192. if [[ $? != 0 ]]; then
  193. echo "Failed to build with wasm mini-loader enabled!"
  194. exit 1;
  195. fi
  196. # build iwasm with source debugging enabled
  197. cd ${WAMR_DIR}/product-mini/platforms/linux
  198. rm -rf build && mkdir build && cd build
  199. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_DEBUG_INTERP=1 -DWAMR_BUILD_DEBUG_AOT=1
  200. make -j
  201. if [[ $? != 0 ]]; then
  202. echo "Failed to build iwasm with source debugging enabled!"
  203. exit 1;
  204. fi
  205. # build iwasm with AOT static PGO 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_STATIC_PGO=1
  209. make -j
  210. if [[ $? != 0 ]]; then
  211. echo "Failed to build iwasm with AOT static PGO enabled!"
  212. exit 1;
  213. fi
  214. # build iwasm with configurable bounds checks enabled
  215. cd ${WAMR_DIR}/product-mini/platforms/linux
  216. rm -rf build && mkdir build && cd build
  217. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_CONFIGUABLE_BOUNDS_CHECKS=1
  218. make -j
  219. if [[ $? != 0 ]]; then
  220. echo "Failed to build iwasm with configurable bounds checks enabled!"
  221. exit 1;
  222. fi
  223. # build iwasm with linux perf support 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_LINUX_PERF=1
  227. make -j
  228. if [[ $? != 0 ]]; then
  229. echo "Failed to build iwasm with linux perf support enabled!"
  230. exit 1;
  231. fi