Skip to content

Commit 474a30b

Browse files
committed
fix: cross build with mingw32 w64 includes c++ and longfellow
1 parent 4c6ecb8 commit 474a30b

5 files changed

Lines changed: 30 additions & 44 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
- uses: hendrikmuhs/ccache-action@v1.2
124124
- name: install dependencies
125125
run : |
126-
sudo apt install -y jq gcc-mingw-w64
126+
sudo apt install -y jq gcc-mingw-w64 g++-mingw-w64
127127
- name: Build x86_64 windows .exe
128128
run: |
129129
make win-exe CCACHE=1
@@ -393,7 +393,7 @@ jobs:
393393
build/release-intro.md
394394
- name: Install build deps
395395
run: |
396-
sudo apt install -qy tree jq cmake make gcc musl-tools musl-dev gcc-mingw-w64 libreadline-dev ccache
396+
sudo apt install -qy tree jq cmake make gcc musl-tools musl-dev gcc-mingw-w64 g++-mingw-w64 libreadline-dev ccache
397397
- name: Build x86_64 with musl-system
398398
run: |
399399
make musl RELEASE=1 CCACHE=1

build/init.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ mlkem_cc ?= ${cc}
102102
# longfellow-zk settings
103103
longfellow_cxx ?= ${cxx}
104104
longfellow_cflags += -I ${pwd}/src -I. -I../zstd -fPIC -DLIBRARY -mpclmul
105+
105106
#-----------------
106107
# zstd settings
107108
zstd_cc ?= ${cc}

build/plugins.mk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@ zenroom_cc := ${cc}
99
ed25519_cc := ${cc}
1010
libtcc_cc := ${cc}
1111
lua_cc := ${cc}
12-
longfellow_cxx = ${cxx}
12+
longfellow_cxx := ${cxx}
13+
zstd_cc := ${cc}
14+
15+
ifdef RELEASE
16+
cflags += -O3 ${cflags_protection}
17+
else
18+
cflags += ${cflags_debug}
19+
endif
1320

1421
ifdef CCACHE
1522
milagro_cmake_flags += -DCMAKE_C_COMPILER_LAUNCHER=ccache
1623
quantum_proof_cc := ccache ${cc}
24+
mlkem_cc := ccache ${cc}
1725
zenroom_cc := ccache ${cc}
1826
ed25519_cc := ccache ${cc}
1927
libtcc_cc := ccache ${cc}
2028
lua_cc := ccache ${cc}
21-
longfellow_cxx = ccache ${cxx}
29+
zstd_cc := ccache ${cc}
30+
longfellow_cxx := ccache ${cxx}
2231
endif

build/win-dll.mk

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
## Initialize build defaults
22
include build/init.mk
33

4-
cc := $(shell which x86_64-w64-mingw32-gcc)
4+
COMPILER := $(shell which x86_64-w64-mingw32-gcc)
5+
COMPILER_CXX := $(shell which x86_64-w64-mingw32-g++)
6+
57
ar := $(shell which x86_64-w64-mingw32-ar)
68
ranlib := $(shell which x86_64-w64-mingw32-ranlib)
7-
ld := $(shell which x86_64-w64-mingw32-ld)
9+
ld := $(shell which x86_64-w64-mingw32-g++)
810
system := Windows
9-
cflags += -mthreads ${defines} -D'ARCH="WIN"' -DARCH_WIN -DLUA_USE_WINDOWS -DLIBRARY
11+
cflags += -fPIC -DLIBRARY -mthreads ${defines}
12+
cflags += -D'ARCH="WIN"' -DARCH_WIN -DLUA_USE_WINDOWS
1013
ldflags += -L/usr/x86_64-w64-mingw32/lib -shared
1114
ldadd += -l:libm.a -l:libpthread.a -lssp -Wl,--out-implib,libzenroom_dll.lib
1215

13-
## Specific compiler settings for all built dependencies
14-
ifdef RELEASE
15-
cflags += -O3 ${cflags_protection} -fPIC
16-
else
17-
cflags += ${cflags_debug} -fPIC
18-
endif
19-
ifdef CCACHE
20-
milagro_cmake_flags += -DCMAKE_C_COMPILER_LAUNCHER=ccache
21-
zenroom_cc := ccache ${cc}
22-
quantum_proof_cc := ccache ${cc}
23-
ed25519_cc := ccache ${cc}
24-
libcc_cc := ccache ${cc}
25-
lua_cc := ccache ${cc}
26-
endif
27-
16+
# activate CCACHE etc.
17+
include build/plugins.mk
2818

2919
all: ${BUILD_DEPS} stamp-exe-windres zenroom.dll
3020

@@ -33,12 +23,7 @@ stamp-exe-windres:
3323

3424
zenroom.dll: ${ZEN_SOURCES}
3525
$(info === Linking Windows zenroom.dll)
36-
${cc} ${cflags} ${ZEN_SOURCES} \
26+
${ld} ${cflags} ${ZEN_SOURCES} \
3727
-o $@ zenroom.res ${ldflags} ${ldadd}
3828

3929
include build/deps.mk
40-
41-
42-
# win-dll: ${BUILDS}
43-
# CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
44-
# make -C src win-dll

build/win-exe.mk

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22
include build/init.mk
33

44
COMPILER := $(shell which x86_64-w64-mingw32-gcc)
5+
COMPILER_CXX := $(shell which x86_64-w64-mingw32-g++)
6+
57
ar := $(shell which x86_64-w64-mingw32-ar)
68
ranlib := $(shell which x86_64-w64-mingw32-ranlib)
7-
ld := $(shell which x86_64-w64-mingw32-ld)
9+
ld := $(shell which x86_64-w64-mingw32-g++)
810
system := Windows
9-
cflags += -mthreads ${defines} -D'ARCH="WIN"' -DARCH_WIN -DLUA_USE_WINDOWS
11+
cflags += -fPIC -mthreads ${defines}
12+
cflags += -D'ARCH="WIN"' -DARCH_WIN -DLUA_USE_WINDOWS
1013
ldflags += -L/usr/x86_64-w64-mingw32/lib
1114
ldadd += -l:libm.a -l:libpthread.a -lssp
1215

13-
## Specific compiler settings for all built dependencies
14-
ifdef RELEASE
15-
cflags += -O3 ${cflags_protection} -fPIC
16-
else
17-
cflags += ${cflags_debug} -fPIC
18-
endif
19-
2016
# activate CCACHE etc.
2117
include build/plugins.mk
2218

@@ -28,17 +24,12 @@ stamp-exe-windres:
2824
cli_sources := src/cli-zenroom.o src/repl.o
2925
zenroom.exe: ${ZEN_SOURCES} ${cli_sources}
3026
$(info === Linking Windows zenroom.exe)
31-
${cc} ${cflags} ${ZEN_SOURCES} ${cli_sources} \
27+
${ld} ${cflags} ${ZEN_SOURCES} ${cli_sources} \
3228
-o $@ zenroom.res ${ldflags} ${ldadd}
3329

3430
zencode-exec.exe: ${ZEN_SOURCES} src/zencode-exec.o
3531
$(info === Linking Windows zencode-exec.exe)
36-
${cc} ${cflags} ${ZEN_SOURCES} src/zencode-exec.o \
32+
${ld} ${cflags} ${ZEN_SOURCES} src/zencode-exec.o \
3733
-o $@ zenroom.res ${ldflags} ${ldadd}
3834

3935
include build/deps.mk
40-
41-
42-
# win-dll: ${BUILDS}
43-
# CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
44-
# make -C src win-dll

0 commit comments

Comments
 (0)