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 mingw build #283

Closed
wants to merge 4 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
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,56 @@ jobs:
- name: Run extended tests
run: bash tools/test_extended.sh

run_tests_mingw_linux_64:
needs: check_format
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install build dependencies (Linux)
run: sudo apt install nasm mingw-w64
- name: Build
shell: bash
run: |
make -j $(nproc) -f Makefile.unx programs/igzip tests arch=mingw host_cpu=x86_64
# wine does not seem available, hence cannot run tests.

run_tests_mingw_linux_32:
needs: check_format
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install build dependencies (Linux)
run: sudo apt install nasm mingw-w64
- name: Build
shell: bash
run: |
make -j $(nproc) -f Makefile.unx programs/igzip tests arch=mingw host_cpu=base_aliases CC=i686-w64-mingw32-gcc

run_tests_mingw_windows_64:
needs: check_format
runs-on: windows-latest
steps:
- uses: actions/[email protected]
- name: Install nasm
uses: ilammy/[email protected]
- name: Build
shell: bash
run: |
make -j $(nproc) -f Makefile.unx programs/igzip tests SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add "|| exit /b 1" at the end of these command lines? The same way it is done in the current ci.yml on the windows build (run_tests_windows)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @cielavenir, did you try adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablodelara with shell: bash, intermediate error will halt the entire script

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for looking into this, @cielavenir, Much appreciated!

- name: Run tests
shell: bash
run: |
# autoconf is missing, hence simulates test_checks.sh
make -j $(nproc) -f Makefile.unx check D=TEST_SEED=0 SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
- name: Run extended tests
shell: bash
run: |
# simulates test_extended.sh
make -j $(nproc) -f Makefile.unx perf D=TEST_SEED=0 SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
make -j $(nproc) -f Makefile.unx test D=TEST_SEED=0 SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar

# seems like i686-w64-mingw32-gcc is not available on windows runner.

run_tests_windows:
needs: check_format
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion include/unaligned.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#define isal_bswap16(x) bswap_16(x)
#define isal_bswap32(x) bswap_32(x)
#define isal_bswap64(x) bswap_64(x)
#elif defined _WIN64
#elif defined _WIN32
#define isal_bswap16(x) _byteswap_ushort(x)
#define isal_bswap32(x) _byteswap_ulong(x)
#define isal_bswap64(x) _byteswap_uint64(x)
Expand Down
11 changes: 8 additions & 3 deletions make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,16 @@ ARFLAGS_win64 = -out:$@
ASFLAGS_mingw = -f win64
ARFLAGS_mingw = cr $@

ifneq ($(arch),mingw)
LDFLAGS_so = -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,$(soname)

ifeq ($(shell uname),Linux)
ifeq ($(host_cpu),x86_64)
CFLAGS_ += -fcf-protection=full
ASFLAGS_ += -DINTEL_CET_ENABLED
LDFLAGS += -Wl,-z,ibt -Wl,-z,shstk -Wl,-z,cet-report=error
endif
endif
endif

ifeq ($(arch),mingw)
CC=x86_64-w64-mingw32-gcc
Expand Down Expand Up @@ -200,8 +201,12 @@ ASFLAGS += -DAS_FEATURE_LEVEL=$(as_feature_level) $(D_HAVE_AS_KNOWS_AVX512_y)


# Check for pthreads
have_threads ?= $(shell printf "int main(void){return 0;}\n" | $(CC) -x c - -o /dev/null -lpthread && echo y )
THREAD_LD_$(have_threads) := -lpthread
ifeq ($(arch),mingw)
have_threads ?= y
else
have_threads ?= $(shell printf "int main(void){return 0;}\n" | $(CC) -x c - -o /dev/null -pthread && echo y )
endif
THREAD_LD_$(have_threads) := -pthread
THREAD_CFLAGS_$(have_threads) := -DHAVE_THREADS

progs: $(bin_PROGRAMS)
Expand Down
Loading