Skip to content

Commit

Permalink
add build flag to fix deadlock
Browse files Browse the repository at this point in the history
add build flag to fix deadlock; set EXEEXT=.html when building wasm target

add wasm build test into .workflow/build.yaml
  • Loading branch information
Yuhengwe1 committed Feb 20, 2023
1 parent 24a19f8 commit d5438b1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 41 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI

on: workflow_dispatch
# push:
# pull_request:
push:
pull_request:

jobs:
build:
Expand Down Expand Up @@ -138,3 +138,25 @@ jobs:
with:
name: artifacts
path: ./out/artifacts

wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.16
- uses: actions/setup-node@v3
with:
node-version: 16
- run: node -v
- run: emcc -v
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386
- run: make gmp-bootstrap
- run: make gtest-bootstrap
- run: bash ./build/mktargets.sh
- run: ( cd test/encoder_binary_comparison ; ./run_PrepareAllTestData.sh 64 wasm )
- run: ./run_Test.sh BinaryCompareWasm BA_MW_D.264
- run: ./run_Test.sh BinaryCompareWasm Adobe_PDF_sample_a_1024x768_50Frms.264
- run: ./run_Test.sh BinaryCompareWasm Zhling_1280x720.264
27 changes: 0 additions & 27 deletions .github/workflows/wasm-test.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ endif

test: codec_unittest$(EXEEXT)
ifeq ($(BUILD_UT_EXE), Yes)
ifneq (wasm,$(OS))
./codec_unittest
endif
endif

else
test:
Expand Down
9 changes: 0 additions & 9 deletions build/mktargets.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,7 @@ def find_sources():
if args.binary is not None:
f.write("%s$(EXEEXT): $(%s_OBJS) $(%s_DEPS)\n"%(args.binary, PREFIX, PREFIX))
f.write("\t$(QUIET_CXX)$(CXX) $(CXX_LINK_O) $(%s_OBJS) $(%s_LDFLAGS) $(LDFLAGS)\n\n"%(PREFIX, PREFIX))
# for wasm build
f.write("%s.html: $(%s_OBJS) $(%s_DEPS)\n"%(args.binary, PREFIX, PREFIX))
f.write("\t$(QUIET_CXX)$(CXX) $(CXX_LINK_O) $(%s_OBJS) $(%s_LDFLAGS) $(LDFLAGS)\n\n"%(PREFIX, PREFIX))

f.write("ifeq ($(OS), wasm)\n")
f.write("binaries: %s.html\n"%args.binary)
f.write("BINARIES += %s.html\n"%args.binary)
f.write("else\n")
f.write("binaries: %s$(EXEEXT)\n"%args.binary)
f.write("BINARIES += %s$(EXEEXT)\n"%args.binary)
f.write("endif")

f.close()
7 changes: 4 additions & 3 deletions build/platform-wasm.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
include $(SRC_PATH)build/arch.mk
EXEEXT = .html
SHAREDLIBSUFFIX = so
SHAREDLIBSUFFIXFULLVER=$(SHAREDLIBSUFFIX).$(FULL_VERSION)
SHAREDLIBSUFFIXMAJORVER=$(SHAREDLIBSUFFIX).$(SHAREDLIB_MAJORVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER)
CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP
# fix undifined symbol: __stack_chk_guard bug
# flags needed to build wasm
CFLAGS += -U_FORTIFY_SOURCE -pthread -DWASMSIMD -msimd128 -sINITIAL_MEMORY=104857600
CXXFLAGS += -U_FORTIFY_SOURCE -pthread -DWASMSIMD -msimd128 -sINITIAL_MEMORY=104857600
LDFLAGS += -U_FORTIFY_SOURCE -pthread -msimd128 -sINITIAL_MEMORY=104857600
CFLAGS += -U_FORTIFY_SOURCE -pthread -DWASMSIMD -msimd128 -sINITIAL_MEMORY=134217728 -sALLOW_MEMORY_GROWTH -sPROXY_TO_PTHREAD -sEXIT_RUNTIME
CXXFLAGS += -U_FORTIFY_SOURCE -pthread -DWASMSIMD -msimd128 -sINITIAL_MEMORY=134217728 -sALLOW_MEMORY_GROWTH -sPROXY_TO_PTHREAD -sEXIT_RUNTIME
LDFLAGS += -U_FORTIFY_SOURCE -pthread -msimd128 -sINITIAL_MEMORY=134217728 -sALLOW_MEMORY_GROWTH -sPROXY_TO_PTHREAD -sEXIT_RUNTIME
ifeq ($(EMFS), nodefs)
CFLAGS += -DNODEFS
CXXFLAGS += -DNODEFS
Expand Down

0 comments on commit d5438b1

Please sign in to comment.