<p>I have been at this for ages now and I am unable to cross-compile Bitcoin-Core 0.19.1 on my Ubuntu 18.04 machine (not a VM). I follow these exact instructions:</p>

<pre><code>sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64
sudo update-alternatives --config x86_64-w64-mingw32-g++ #successfully changes to posix here
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make 
</code></pre>

<p>everything goes well till the <em>autogen</em> step. The configuration script executes normally but I always get the same output no matter what I do...</p>

<pre><code>Build Options:
  with endomorphism   = no
  with ecmult precomp = yes
  with jni            = no
  with benchmarks     = no
  with coverage       = no
  module ecdh         = no
  module recovery     = yes

  asm                 = x86_64
  bignum              = no
  field               = 64bit
  scalar              = 64bit

  CC                  = gcc
  CFLAGS              = -g -O2 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -O3
  CPPFLAGS            = 
  LDFLAGS             = 

Fixing libtool for -rpath problems.

Options used to compile and link:
  with wallet   = yes
  with gui / qt = yes
    with bip70  = no
    with qr     = yes
  with zmq      = yes
  with test     = yes
    with prop   = no
    with fuzz   = no
  with bench    = yes
  with upnp     = yes
  use asm       = yes
  sanitizers    = 
  debug enabled = no
  gprof enabled = no
  werror        = no

  target os     = linux
  build os      = 

  CC            = /usr/bin/ccache gcc
  CFLAGS        = -g -O2
  CPPFLAGS      =   -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
  CXX           = /usr/bin/ccache g++ -std=c++14
  CXXFLAGS      =   -fstack-reuse=none -Wstack-protector -fstack-protector-all  -Wall -Wextra -Wformat -Wvla -Wswitch -Wformat-security -Wredundant-decls  -Wno-unused-parameter -Wno-implicit-fallthrough   -g -O2
  LDFLAGS       = -pthread  -Wl,-z,relro -Wl,-z,now -pie  
  ARFLAGS       = cr
</code></pre>

<p>I have tried to uninstall and install the Ubuntu. Also tried to compile on a clean repository several times but the output always shows that the target OS is Linux. I run the <em>make</em> command after this but never get the exe. I am stuck and don't know what else to try. Any help would be appreciated.</p>

CC BY-SA 4.0
2020-04-17T19:11:07.680Z
I don't see anything wrong with the output you're seeing. It seems you're just not doing the "make" command at the end. After this output, just run make.
Pieter Wuille
CC BY-SA 4.0
2020-04-20T04:44:31.037Z
@PieterWuille Sorry if I wasn't clear enough.
I want to cross compile for Windows on my Ubuntu to get an .exe file to run on Windows.
Jdawg287
CC BY-SA 4.0
2020-04-20T04:45:51.997Z
Can you post the full output, for exactly what you typed in the shell and the produced output?
Pieter Wuille
CC BY-SA 4.0
2020-04-20T05:06:11.950Z
First I run the commands as mentioned at the top of my question till _./autogen.sh_ step then:
`$ mkdir build
$ cd build
$ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site sudo ./../configure --prefix=/`
Jdawg287
<ubuntu><windows><compiling>
Cannot cross-compile for Windows from Ubuntu 18.04
Jdawg287
# Cannot cross-compile for Windows from Ubuntu 18.04

(Asked by: username_0 on 2020-04-17)

I have been at this for ages now and I am unable to cross-compile Bitcoin-Core 0.19.1 on my Ubuntu 18.04 machine (not a VM). I follow these exact instructions:
sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64
sudo update-alternatives --config x86_64-w64-mingw32-g++ #successfully changes to posix here
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make 

everything goes well till the autogen step. The configuration script executes normally but I always get the same output no matter what I do...
Build Options:
  with endomorphism   = no
  with ecmult precomp = yes
  with jni            = no
  with benchmarks     = no
  with coverage       = no
  module ecdh         = no
  module recovery     = yes

  asm                 = x86_64
  bignum              = no
  field               = 64bit
  scalar              = 64bit

  CC                  = gcc
  CFLAGS              = -g -O2 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -O3
  CPPFLAGS            = 
  LDFLAGS             = 

Fixing libtool for -rpath problems.

Options used to compile and link:
  with wallet   = yes
  with gui / qt = yes
    with bip70  = no
    with qr     = yes
  with zmq      = yes
  with test     = yes
    with prop   = no
    with fuzz   = no
  with bench    = yes
  with upnp     = yes
  use asm       = yes
  sanitizers    = 
  debug enabled = no
  gprof enabled = no
  werror        = no

  target os     = linux
  build os      = 

  CC            = /usr/bin/ccache gcc
  CFLAGS        = -g -O2
  CPPFLAGS      =   -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS
  CXX           = /usr/bin/ccache g++ -std=c++14
  CXXFLAGS      =   -fstack-reuse=none -Wstack-protector -fstack-protector-all  -Wall -Wextra -Wformat -Wvla -Wswitch -Wformat-security -Wredundant-decls  -Wno-unused-parameter -Wno-implicit-fallthrough   -g -O2
  LDFLAGS       = -pthread  -Wl,-z,relro -Wl,-z,now -pie  
  ARFLAGS       = cr

I have tried to uninstall and install the Ubuntu. Also tried to compile on a clean repository several times but the output always shows that the target OS is Linux. I run the make command after this but never get the exe. I am stuck and don't know what else to try. Any help would be appreciated.

**Tags:** ubuntu, windows, compiling

> **Comments:**
> **username_1**: I don't see anything wrong with the output you're seeing. It seems you're just not doing the "make" command at the end. After this output, just run make.  
> **username_0**: @PieterWuille Sorry if I wasn't clear enough. I want to cross compile for Windows on my Ubuntu to get an .exe file to run on Windows.  
> **username_1**: Can you post the full output, for exactly what you typed in the shell and the produced output?  
> **username_0**: First I run the commands as mentioned at the top of my question till _./autogen.sh_ step then: `$ mkdir build $ cd build $ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site sudo ./../configure --prefix=/`  

---

## 0 answers

