Litecoin cross compilation guide on Ubuntu for windows

Hi Litecoin friends!

Im looking for a tut on how to cross compile the latest Litecoin on Ubuntu for windows. Most of the tut availible on the net are heavy out dated.

2 Likes

This is what i did so far without luck :expressionless:

Just reinstalled my Ubuntu 20.4 server to try it again with a clean setup up

sudo apt-get update 
apt-get upgrade -y 
apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev -y 

sudo apt-get install libdb4.8-dev libdb4.8++-dev libminiupnpc-dev libzmq3-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev g++-mingw-w64-i686 mingw-w64-i686-dev g++-mingw-w64-x86-64 mingw-w64-x86-64-dev curl -y 
update-alternatives --config x86_64-w64-mingw32-g++ 

 sudo apt-get install -y libxkbcommon-dev
 sudo apt install xcb
 sudo apt-get install libpcre3 libpcre3-dev
 sudo apt-get install libpng-dev
 sudo apt-get install -y libjpeg-dev

 wget https://github.com/litecoin-project/litecoin/archive/refs/tags/v0.18.1.tar.gz 
 tar -xvzf v0.18.1.tar.gz 
 cd litecoin/depends 
 make download 
 make 

 cd .. 
 ./autogen.sh 
 ./configure --enable-glibc-back-compat --prefix=`pwd`/depends/x86_64-pc-linux-gnu LDFLAGS="-static-libstdc++" 
 make clean 
 make 
 make install 

 cd depends 
 make HOST=x86_64-w64-mingw32 -j4 

 cd .. 
 ./configure --prefix=`pwd`/depends/x86_64-w64-mingw32 
 make clean 
 make 
 make install 
 
 cd depends 
 make HOST=i686-w64-mingw32 -j4 
 cd .. 

 ./configure --prefix=`pwd`/depends/i686-w64-mingw32 
 make clean 
 make 
 make install

Ill post the errors i get later…

ps this is still outdated

Change https://download.qt.io/official_releases/qt/5.9/$($(package)_version)/submodules to https://download.qt.io/archive/qt/5.9/$($(package)_version)/submodules

Simply use a desktop Linux and the qt installer from the official website?

meh i like pushing my self to do it the hard way :laughing: :sweat_smile: so i can learn more

had this problem

util/time.cpp:85:5: error: ‘gmtime_r’ was not declared in this scope; did you mean ‘gmtime_s’?

fixed it with

But now im stuck with

/usr/bin/i686-w64-mingw32-ld: libbitcoin_wallet.a(libbitcoin_wallet_a-rpcdump.o)                                                                                                                                                             :rpcdump.cpp:(.text+0xb337): undefined reference to `FormatISO8601DateTime[abi:c                                                                                                                                                             xx11](long long)'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_wallet.a(libbitcoin_wallet_a-rpcdump.o)                                                                                                                                                             :rpcdump.cpp:(.text+0xb607): undefined reference to `FormatISO8601DateTime[abi:c                                                                                                                                                             xx11](long long)'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_wallet.a(libbitcoin_wallet_a-rpcdump.o)                                                                                                                                                             :rpcdump.cpp:(.text+0xc652): undefined reference to `FormatISO8601DateTime[abi:c                                                                                                                                                             xx11](long long)'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_common.a(libbitcoin_common_a-netbase.o)                                                                                                                                                             :netbase.cpp:(.text+0x8b): undefined reference to `GetTimeMillis()'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_common.a(libbitcoin_common_a-netbase.o)                                                                                                                                                             :netbase.cpp:(.text+0xed): undefined reference to `GetTimeMillis()'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-logging.o):log                                                                                                                                                             ging.cpp:(.text+0xfa3): undefined reference to `GetTimeMicros()'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-logging.o):log                                                                                                                                                             ging.cpp:(.text+0xfe1): undefined reference to `FormatISO8601DateTime[abi:cxx11]                                                                                                                                                             (long long)'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-logging.o):log                                                                                                                                                             ging.cpp:(.text+0x13a2): undefined reference to `GetMockTime()'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-logging.o):log                                                                                                                                                             ging.cpp:(.text+0x13c2): undefined reference to `FormatISO8601DateTime[abi:cxx11                                                                                                                                                             ](long long)'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-random.o):rand                                                                                                                                                             om.cpp:(.text+0x1151): undefined reference to `GetTime()'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-random.o):rand                                                                                                                                                             om.cpp:(.text+0x1189): undefined reference to `GetTime()'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-random.o):rand                                                                                                                                                             om.cpp:(.text+0x141a): undefined reference to `MilliSleep(long long)'
/usr/bin/i686-w64-mingw32-ld: libbitcoin_util.a(libbitcoin_util_a-system.o):syst                                                                                                                                                             em.cpp:(.text.startup+0x59): undefined reference to `GetTime()'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:5590: litecoind.exe] Error 1
make[2]: Leaving directory '/home/ubuntu/litecoin/src'
make[1]: *** [Makefile:13083: all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/litecoin/src'
make: *** [Makefile:776: all-recursive] Error 1

Okay, install it on desktop and uninstall desktop after, nobody will find out :shushing_face:
I’ll tell it nobody :sweat_smile:

Also I don’t understands why u try to compile windows stuff on Linux :dizzy_face:

By the way I don’t understand compiling windows stuff in anyway :sweat_smile:

already done that :sweat_smile:

Managed to build everything, even the latest release :sunglasses:

I am having an issue with this as well but it seems to be with the ./configure step. It compiles fine but even with the ./configure --prefix=pwd/depends/x86_64-w64-mingw32 and other steps, the configure output always comes out with target os: Linux. This of course causes it to only compile the linux binaries.

Sorry for late reply .Yes its building for linux and windows. Ill be updating my paste with some dependencies that i forgot to add like MiniUPnPc :neutral_face: :man_facepalming:

Everything some compile without any problems

Hello, thanks for sharing, it helps me a lot.

There is an error using Make install

can not install sites that hosted the files are down.

/litecoin/depends/packages/qt.mk Line 3

download.qt. io/official_releases/qt/5.9/

Replace for

download.qt. io/archive/qt/5.9/

And

litecoin/depends/Makefile Line 11

Page down bitcoincore.c*m/depends-sources.