Merge pull request #70 from floreslorca/master
cross compiling for windows fix, and detailed build instructions
This commit is contained in:
commit
62a56fce41
54
README.md
54
README.md
|
@ -35,7 +35,16 @@ Install:
|
|||
```
|
||||
|
||||
### Windows
|
||||
Get dependencies:
|
||||
There are two proven ways to build BTCP for Windows:
|
||||
|
||||
* On Linux using [Mingw-w64](https://mingw-w64.org/doku.php) cross compiler tool chain. Ubuntu 16.04 Xenial is proven to work and the instructions is for such release.
|
||||
* On Windows 10 (64-bit version) using [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/commandline/wsl/about) and Mingw-w64 cross compiler tool chain.
|
||||
|
||||
With Windows 10, Microsoft released a feature called WSL. It basically allows you to run a bash shell directly on Windows in an ubuntu environment. WSL can be installed with other Linux variants, but as mentioned before, the distro proven to work is Ubuntu.
|
||||
Follow this [link](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide) for installing WSL first
|
||||
|
||||
### Building for Windows 64-Bit
|
||||
1. Get the usual dependencies:
|
||||
```{r, engine='bash'}
|
||||
sudo apt-get install \
|
||||
build-essential pkg-config libc6-dev m4 g++-multilib \
|
||||
|
@ -43,12 +52,45 @@ sudo apt-get install \
|
|||
zlib1g-dev wget bsdmainutils automake mingw-w64
|
||||
```
|
||||
|
||||
Install (Cross-Compiled, building on Windows is not supported yet):
|
||||
2. Set the default ming32 gcc/g++ compiler option to posix, fix problem with packages in Xenial
|
||||
|
||||
```{r, engine='bash'}
|
||||
# Build
|
||||
sudo update-alternatives --config x86_64-w64-mingw32-gcc
|
||||
sudo update-alternatives --config x86_64-w64-mingw32-g++
|
||||
```
|
||||
|
||||
3. Install Rust
|
||||
```{r, engine='bash'}
|
||||
curl https://sh.rustup.rs -sSf | sh
|
||||
source ~/.cargo/env
|
||||
rustup install stable-x86_64-unknown-linux-gnu
|
||||
rustup install stable-x86_64-pc-windows-gnu
|
||||
rustup target add x86_64-pc-windows-gnu
|
||||
vi ~/.cargo/config
|
||||
```
|
||||
and add:
|
||||
```
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
linker = "/usr/bin/x86_64-w64-mingw32-gcc"
|
||||
```
|
||||
|
||||
Note that in WSL, the BTCPrivate source code must be somewhere in the default mount file system. i.e /usr/src/BTCPrivate, and not on /mnt/d/. What this means is that you cannot build directly on the windows system
|
||||
|
||||
4. Build for Windows
|
||||
|
||||
```{r, engine='bash'}
|
||||
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
|
||||
./btcputil/build-win.sh -j$(nproc)
|
||||
```
|
||||
The exe will save to `src` which you can then move to a windows machine
|
||||
|
||||
5. Installation
|
||||
|
||||
After building in WSL, you can make a copy of the compiled executables to a directory on your Windows file system. This is done the following way
|
||||
|
||||
```{r, engine='bash'}
|
||||
make install DESTDIR=/mnt/c/btcp/BTCPrivate
|
||||
```
|
||||
This will install the executables to `c:\btcp\BTCPrivate
|
||||
|
||||
### Mac
|
||||
Get dependencies:
|
||||
|
@ -72,6 +114,10 @@ Install:
|
|||
./src/btcpd
|
||||
```
|
||||
|
||||
### Additional notes
|
||||
|
||||
If you plan to build for windows and linux at the same time, be sure to delete all the built files for whatever you build first. An easy way to do this is by taking the binaries out of the repo, delete all files except the .git folder and then do a git hard reset.
|
||||
|
||||
About
|
||||
--------------
|
||||
|
||||
|
|
|
@ -6,14 +6,21 @@ $(package)_download_file=$($(package)_git_commit).tar.gz
|
|||
$(package)_sha256_hash=a5760a90d4a1045c8944204f29fa2a3cf2f800afee400f88bf89bbfe2cce1279
|
||||
$(package)_git_commit=91348647a86201a9482ad4ad68398152dc3d635e
|
||||
$(package)_dependencies=rust
|
||||
ifeq ($(host_os),mingw32)
|
||||
rust_build=cargo build --release --lib --target="x86_64-pc-windows-gnu"
|
||||
rust_target=target/x86_64-pc-windows-gnu/release/rustzcash.lib $($(package)_staging_dir)$(host_prefix)/lib/librustzcash.a
|
||||
else
|
||||
rust_build=cargo build --release
|
||||
rust_target=target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/
|
||||
endif
|
||||
|
||||
define $(package)_build_cmds
|
||||
cargo build --release
|
||||
$(rust_build)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
|
||||
cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||
cp $(rust_target) && \
|
||||
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
||||
endef
|
||||
endef
|
|
@ -5,7 +5,9 @@ $(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.t
|
|||
$(package)_sha256_hash_linux=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
|
||||
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
|
||||
$(package)_sha256_hash_darwin=2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926
|
||||
$(package)_file_name_mingw32=rust-$($(package)_version)-x86_64-pc-windows-gnu.tar.gz
|
||||
$(package)_sha256_hash_mingw32=523cd248363afdc4e2c0e1f219607897b6925294a33154d7e67224addfd15eb0
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
endef
|
||||
endef
|
Loading…
Reference in New Issue