codeql_buildscript.sh 7.5 KB

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