Posts tonen met het label Cryptocurrency. Alle posts tonen
Posts tonen met het label Cryptocurrency. Alle posts tonen

maandag 24 september 2018

How To Compile Altcoin For Windows on Linux Using mxe and mingw


We are going to make altcoin qt for windows on ubuntu. We have clone peercoin and made a funcoin by replacing some parameter, I am assuming you have developed your coin.

First install required dependencies
sudo apt-get install autoconf automake autopoint bash bison bzip2 p7zip-full cmake flex gettext git g++ gperf intltool libffi-dev libtool libltdl-dev libssl-dev libxml-parser-perl make openssl patch perl pkg-config python ruby scons sed unzip wget xz-utils

sudo apt-get install g++-multilib libc6-dev-i386


move to any folder, here I am going in mnt folder and taking the fresh mxe clone.

cd /mnt
git clone https://github.com/mxe/mxe.git


Now compile boost

make MXE_TARGETS="i686-w64-mingw32.static" boost

Compile qt

make MXE_TARGETS="i686-w64-mingw32.static" qt


mxe does not support barkeley db and miniupnpc, so we have to compile these explicitly

compiling the barkeley db:

cd /mnt
wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
tar zxvf db-4.8.30.tar.gz
cd /mnt/db-4.8.30
touch compile-db.sh
chmod ugo+x compile-db.sh

now edit the compile-db.sh script file and put the below content and save
#!/bin/bash
MXE_PATH=/mnt/mxe
sed -i "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
mkdir build_mxe
cd build_mxe

CC=$MXE_PATH/usr/bin/i686-w64-mingw32.static-gcc \
CXX=$MXE_PATH/usr/bin/i686-w64-mingw32.static-g++ \
../dist/configure \
 --disable-replication \
 --enable-mingw \
 --enable-cxx \
 --host x86 \
 --prefix=$MXE_PATH/usr/i686-w64-mingw32.static

make

make install

for running the file command 

./compile-db.sh

 compiling miniupnpc

cd /mnt
wget http://miniupnp.free.fr/files/miniupnpc-1.6.20120509.tar.gz
tar zxvf miniupnpc-1.6.20120509.tar.gz
cd /mnt/miniupnpc-1.6.20120509
touch com-min.sh
chmod ugo+x com-min.sh

now edit the com-min.sh script file and put the below content and save

#!/bin/bash
MXE_PATH=/mnt/mxe

CC=$MXE_PATH/usr/bin/i686-w64-mingw32.static-gcc \
AR=$MXE_PATH/usr/bin/i686-w64-mingw32.static-ar \
CFLAGS="-DSTATICLIB -I$MXE_PATH/usr/i686-w64-mingw32.static/include" \
LDFLAGS="-L$MXE_PATH/usr/i686-w64-mingw32.static/lib" \
make libminiupnpc.a

mkdir $MXE_PATH/usr/i686-w64-mingw32.static/include/miniupnpc
cp *.h $MXE_PATH/usr/i686-w64-mingw32.static/include/miniupnpc
cp libminiupnpc.a $MXE_PATH/usr/i686-w64-mingw32.static/lib


for running the file command 

./com-min.sh

now add mxe bin to env PATH:

export PATH=/mnt/mxe/usr/bin:$PATH

now paste funcoin or take clone from github

cd /mnt
// paste your altcoin code
cd /mnt/funcoin
touch compile-coin.sh
chmod ugo+x compile-coin.sh

now edit compile-coin.sh file and paste the below content

#!/bin/bash
MXE_INCLUDE_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/include
MXE_LIB_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/lib

i686-w64-mingw32.static-qmake-qt4 \
 BOOST_LIB_SUFFIX=-mt \
 BOOST_THREAD_LIB_SUFFIX=_win32-mt \
 BOOST_INCLUDE_PATH=$MXE_INCLUDE_PATH/boost \
 BOOST_LIB_PATH=$MXE_LIB_PATH \
 OPENSSL_INCLUDE_PATH=$MXE_INCLUDE_PATH/openssl \
 OPENSSL_LIB_PATH=$MXE_LIB_PATH \
 BDB_INCLUDE_PATH=$MXE_INCLUDE_PATH \
 BDB_LIB_PATH=$MXE_LIB_PATH \
 MINIUPNPC_INCLUDE_PATH=$MXE_INCLUDE_PATH \
 MINIUPNPC_LIB_PATH=$MXE_LIB_PATH \
 QMAKE_LRELEASE=/mnt/mxe/usr/i686-w64-mingw32.static/qt/bin/lrelease funcoin-qt.pro

make -f Makefile.Release

now run the file by command ./compile-coin.sh
You will get the .exe file in release folder.


When error:
compilation terminated.
Makefile.Release:12634: recipe for target 'build/txdb-leveldb.o' failed
make: *** [build/txdb-leveldb.o] Error 1

Run this
TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a CC=~/mxe/usr/bin/i686-w64-mingw32.static-gcc CXX=~/mxe/usr/bin/i686-w64-mingw32.static-g++




dinsdag 12 december 2017

Install berkeley 4.8 db libs on Ubuntu 16.04

  1. sudo add-apt-repository ppa:bitcoin/bitcoin
  2. sudo apt-get update
  3. sudo apt-get install libdb4.8-dev libdb4.8++-dev
or

  1. wget http://download.oracle.com/berkeley-db/db-4.8.30.zip
  2. unzip db-4.8.30.zip
  3. cd db-4.8.30
  4. cd build_unix/
  5. ../dist/configure --prefix=/usr/local --enable-cxx
  6. make
  7. make install
or

  1. BITCOIN_ROOT=$(pwd)
  2. # Pick some path to install BDB to, here we create a directory within the bitcoin directory
  3. BDB_PREFIX="${BITCOIN_ROOT}/db4"
  4. mkdir -p $BDB_PREFIX
  5. # Fetch the source and verify that it is not tampered with
  6. wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
  7. echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
  8. # -> db-4.8.30.NC.tar.gz: OK
  9. tar -xzvf db-4.8.30.NC.tar.gz
  10. # Build the library and install to our prefix
  11. cd db-4.8.30.NC/build_unix/
  12. # Note: Do a static build so that it can be embedded into the executable, instead of having to find a .so at runtime
  13. ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
  14. make install
  15. # Configure Bitcoin Core to use our own-built instance of BDB
  16. cd $BITCOIN_ROOT
  17. ./autogen.sh
  18. ./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" # (other args...)