Skip to content

Commit 9adc694

Browse files
authored
Enable CI build for gcc 4.8 on linux (#2106)
In #1928 we added support for GCC 4.8 but we don't continuously test if it's working. This PR added a GitHub actions job to test compilation on GCC 4.8 for interpreters and Fast JIT (LLVM JIT/AOT might be added in the future). The compilation is done using ubuntu 14.04 image as that's the simplest way to get GCC 4.8 compiler. The job only compiles the code but does not run any tests.
1 parent e7b988e commit 9adc694

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,84 @@ jobs:
115115
cmake --build . --config Release --parallel 4
116116
working-directory: wamr-compiler
117117

118+
build_iwasm_linux_gcc4_8:
119+
runs-on: ubuntu-latest
120+
container:
121+
image: ubuntu:14.04
122+
strategy:
123+
matrix:
124+
make_options_run_mode: [
125+
# Running mode
126+
$CLASSIC_INTERP_BUILD_OPTIONS,
127+
$FAST_INTERP_BUILD_OPTIONS,
128+
$FAST_JIT_BUILD_OPTIONS
129+
]
130+
make_options_feature: [
131+
# Features
132+
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
133+
"-DWAMR_BUILD_DEBUG_AOT=1",
134+
"-DWAMR_BUILD_DEBUG_INTERP=1",
135+
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
136+
"-DWAMR_BUILD_LIB_PTHREAD=1",
137+
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
138+
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
139+
"-DWAMR_BUILD_MINI_LOADER=1",
140+
"-DWAMR_BUILD_MEMORY_PROFILING=1",
141+
"-DWAMR_BUILD_MULTI_MODULE=1",
142+
"-DWAMR_BUILD_PERF_PROFILING=1",
143+
"-DWAMR_BUILD_REF_TYPES=1",
144+
"-DWAMR_BUILD_SIMD=1",
145+
"-DWAMR_BUILD_TAIL_CALL=1",
146+
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
147+
]
148+
exclude:
149+
# uncompatiable feature and platform
150+
# uncompatiable mode and feature
151+
# MULTI_MODULE only on INTERP mode
152+
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
153+
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
154+
# SIMD only on JIT/AOT mode
155+
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
156+
make_options_feature: "-DWAMR_BUILD_SIMD=1"
157+
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
158+
make_options_feature: "-DWAMR_BUILD_SIMD=1"
159+
# DEBUG_INTERP only on CLASSIC INTERP mode
160+
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
161+
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
162+
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
163+
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
164+
# DEBUG_AOT only on JIT/AOT mode
165+
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
166+
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
167+
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
168+
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
169+
# TODO: DEBUG_AOT on JIT
170+
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
171+
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
172+
# MINI_LOADER only on INTERP mode
173+
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
174+
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
175+
steps:
176+
- name: checkout
177+
uses: actions/checkout@v3
178+
179+
- name: Install dependencies
180+
run: apt update && apt install -y make g++-4.8 gcc-4.8 wget git
181+
182+
- name: Install cmake
183+
run: |
184+
wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
185+
tar xzf cmake.tar.gz
186+
cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
187+
cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
188+
189+
- name: Build iwasm
190+
run: |
191+
mkdir build && cd build
192+
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
193+
cmake --build . --config Release --parallel 4
194+
working-directory: product-mini/platforms/linux
195+
118196
build_iwasm:
119197
needs:
120198
[build_llvm_libraries_on_ubuntu_2004, build_llvm_libraries_on_ubuntu_2204]

core/shared/platform/include/platform_api_extension.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ os_thread_exit(void *retval);
116116
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016 */
117117
#if __GNUC_PREREQ(4, 9)
118118
#define BH_HAS_STD_ATOMIC
119+
#elif __GNUC_PREREQ(4, 7)
120+
#define os_memory_order_acquire __ATOMIC_ACQUIRE
121+
#define os_memory_order_release __ATOMIC_RELEASE
122+
#define os_memory_order_seq_cst __ATOMIC_SEQ_CST
123+
#define os_atomic_thread_fence __atomic_thread_fence
119124
#endif /* end of __GNUC_PREREQ(4, 9) */
120125
#endif /* end of defined(__GNUC_PREREQ) */
121126

product-mini/platforms/linux/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
1616
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
1717

1818
set (CMAKE_C_STANDARD 99)
19+
set (CMAKE_CXX_STANDARD 14)
1920

2021
# Set WAMR_BUILD_TARGET, currently values supported:
2122
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",

0 commit comments

Comments
 (0)