unitusdev/unitus

How to fix problems on building unitus(0.14.2) windows version.

Closed this issue · 1 comments

Unitus source.(0.14.2)
https://github.com/unitusdev/unitus/tree/master

Referenced bitcoin source.(0.16)
https://github.com/bitcoin/bitcoin/tree/master

Build platform and environment.
Host:Windows8 Pro 64bit, VMware12, ubuntu 16.04 64bit.
Build target platform - x86_64-w64-mingw32

I tried to build a Windows version as described in the guide.(https://github.com/unitusdev/unitus/blob/master/doc/build-windows.md)
However, I could not complete the build smoothly due to some problems.
Problems

  • I could not build depends first.
  • Set posix compile options
    (lockedpool.h:195:18: error: ‘mutex’ in namespace ‘std’ does not name a type mutable std::mutex mutex;)
  • mman library problem
  • unitus library build error

steps to fix

1. build depends
There is no Makefile in the dependss folder of unitus.
There are also no files to automatically create Makefiles.
Therefore, the make command can not be executed.
(make: *** No targets specified and no makefile found. Stop.)
Check out Makefile in bitcoin's depnds folder. I think this file is created manually and uses the files in the depends folder.
Copy the Makefile from bitcoin/tree/master/depends to unitus.
You can start building the depends.
However, there is some problems in the build of zeromq and qt.

  • zeromq
    Overwrite depends/packages/zeromq.mk from bitcoin to unitus.
    There is only a slight difference in version.
    (bitcoin : 4.2.2, unitus:4.1.5)
    Next, copy the depends /patches/zeromq folder from bitcoin to unitus.
  • qt
    copy the depends /patches/qy folder from bitcoin to unitus.
    The mac-qmake.conf file is the same in both places.
  • Set posix compile options
    bitcoin/blob/master/doc/build-windows.md points out the posix compiler option setting.
    sudo update-alternatives --config x86_64-w64-mingw32-g++
    However, it is not pointed out in unitus.
    If you do not proceed with this configuration, ie if it is set to windows instead of posix, you will see the following error when building unitus:
    lockedpool.h:195:18: error: ‘mutex’ in namespace ‘std’ does not name a type mutable std::mutex mutex;
    Set it to posix by executing the command below.
    sudo update-alternatives --config x86_64-w64-mingw32-g++

You can finish the depends build successfully.
Try building according to the windows version build guide of unitus.

2. mman library problem
When building unitus you will encounter the following error.
checking for main in -lmman... no configure: error: lib missing
Unitus's yecrypt uses mman, but there is no point in solving mman for building windows versions.
Download the mman source from the url below and build it.
(https://github.com/witwall/mman-win32)
You can build in various ways.
For example, you can build with vs 2015.
Rename the resulting mman.lib file to libmman.a.
Open the mman.h file with an editor and modify it as shown below.
original:

#if defined(MMAN_LIBRARY)
#define MMANSHARED_EXPORT __declspec(dllexport)
#else
#define MMANSHARED_EXPORT __declspec(dllimport)
#endif

to:

//#if defined(MMAN_LIBRARY)
//#define MMANSHARED_EXPORT __declspec(dllexport)
//#else
//#define MMANSHARED_EXPORT __declspec(dllimport)
//#endif

#define MMANSHARED_EXPORT

Copy mman.h to depends/x86_64-w64-mingw32/include/sys/ folder.(create sys folder)
Copy libmman.a to depends/x86_64-w64-mingw32/lib/ folder.
You can configure successfully.

3. build unitus library error
Unitus build output 4 binaries.

- unitus-cli unitus-tx (default=yes)
- libraries (default=yes)
- unitusd daemon (default=yes)
- bitcoin-qt GUI (default=auto, qt5 tried first)

Here is the error below when building libs.

primitives/.libs/libbitcoinconsensus_la-pureheader.o:pureheader.cpp:(.text+0x3bb): undefined reference to `SHA256'
collect2: error: ld returned 1 exit status

I think this is a problem with the ssl library link setup.
However, I only needed to build the qt gui binary and used configure with --with-libs = no.
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ --with-libs=no
4. Check unitus build result
After you run make to complete the build, you will find four exe files in the unitus folder.

unitus-cli.exe
unitusd.exe
unitus-qt.exe
unitus-tx.exe

good luck!

You'll find most if not all of these issues have been taken care of in the most recent commits.