Skip to content

Commit

Permalink
build: add Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
torkelrogstad committed Jan 23, 2024
1 parent 7e9708d commit 6d6c7f7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,31 @@ system instead, without success. If someone more skilled at the
build system than the previous author strolls along, please
take a look.

### Cross-compiling from Linux to Windows

Building binaries for Windows must happen through cross-compiling
from a Linux machine. This requires a rather specific set of
packages on the host machine, so the easiest way is to do this
through a Docker container. We use the `electriccoinco/zcashd-build-ubuntu-jammy`
image, provided by the upstream Zcash devs.

```bash
# from the root of this repo
$ docker run -ti -v $PWD:/zside --workdir /zside electriccoinco/zcashd-build-ubuntu-jammy bash

$ HOST=x86_64-w64-mingw32 make -C depends V=1 -j8
$ export CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site
$ ./autogen.sh
$ ./configure --disable-tests --disable-bench --disable-hardening --enable-online-rust
$ make -C src cargo-build-lib
$ BRIDGE_LOCATION=$(dirname $(./contrib/devtools/find-libcxxbridge.sh))
$ export LDFLAGS="-L$BRIDGE_LOCATION -lcxxbridge1"
$ ./configure --disable-tests --disable-bench --disable-hardening --enable-online-rust
$ make -j8

# final result is in ./src/zsided.exe
```

### Nix - currently not working

To install all dependencies and build zcash-sidechain on ubuntu (22.04) run:
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ case $host in

CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN"
LEVELDB_TARGET_FLAGS="-DOS_WINDOWS"

dnl Windows seems to require libssp even if hardening is disabled.
LDFLAGS="$LDFLAGS -lssp"

dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against.
dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override
Expand Down

0 comments on commit 6d6c7f7

Please sign in to comment.