Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in compiling always_success #24

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Clang

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: 'Exporting llvm PATH'
run: echo "`pwd`/llvm-16/bin" >> $GITHUB_PATH
- name: Install clang-16
run: make -f Makefile.clang install-clang-16-for-ubuntu
- name: Update submodules
run: git submodule update --init
- name: Build contract
run: make -f Makefile.clang all
- name: Run omni_lock tests
run: cd tests/omni_lock_rust && cargo test
17 changes: 11 additions & 6 deletions Makefile.clang
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
CC := clang-16
LD := ld.lld-16
OBJCOPY := llvm-objcopy-16
CC := clang
LD := ld.lld
OBJCOPY := llvm-objcopy
CFLAGS := \
--target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs \
-fPIC -O3 -fno-builtin-printf -fno-builtin-memcmp -nostdinc -nostdlib -fvisibility=hidden -fdata-sections -ffunction-sections \
-fPIC -O2 -fno-builtin-printf -fno-builtin-memcmp -nostdinc -nostdlib -fvisibility=hidden -fdata-sections -ffunction-sections \
-I deps/secp256k1/src -I deps/secp256k1 -I deps/ckb-c-std-lib -I deps/ckb-c-std-lib/libc -I deps/ckb-c-std-lib/molecule -I c -I build \
-Wall -Wno-nonnull -Wno-unused-function -g
-Wall -Wno-nonnull -Wno-unused-function -g -Wl,--gc-sections
LDFLAGS := -nostdlib -static --gc-sections
SECP256K1_SRC_20210801 := deps/secp256k1-20210801/src/ecmult_static_pre_context.h

Expand All @@ -28,7 +28,7 @@ CLANG_FORMAT_DOCKER := kason223/clang-format@sha256:3cce35b0400a7d420ec8504558a0
all: build/omni_lock build/always_success

build/always_success: c/always_success.c
$(CC) $(OMNI_LOCK_CFLAGS) $(LDFLAGS) -o $@ $<
$(CC) $(OMNI_LOCK_CFLAGS) -o $@ $<
$(OBJCOPY) --only-keep-debug $@ [email protected]
$(OBJCOPY) --strip-debug --strip-all $@

Expand Down Expand Up @@ -110,6 +110,11 @@ install-tools:
cargo install --force --version "${MOLC_VERSION}" "${MOLC}"; \
fi

install-clang-16-for-ubuntu:
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.4/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz
tar -xvf clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz
mv clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04 llvm-16

dist: clean all

.PHONY: all all-via-docker dist clean package-clean package publish
Loading