dash/doc/build-generic.md
UdjinM6 9718bb394b
build/ci: Fix --enable-glibc-back-compat and its usage (#4592)
* build: Fix `--enable-glibc-back-compat`

Compiling on Ubuntu 20.04 results in binaries that can't be run on older systems we still support (e.g. Ubuntu 16.04) and `contrib/devtools/symbol-check.py` complains about it.

Available versions for `log` for example:
$ objdump -T /lib/x86_64-linux-gnu/libm.so.6 | egrep -w 'log'
00000000000431b0 g    DF .text	0000000000000039  GLIBC_2.29  log
0000000000012360 g    DF .text	0000000000000066 (GLIBC_2.2.5) log

(i.e. the default one is 2.29)

This commit fixes the issue by picking the version we support instead of the default one.

Before:
$ objdump -T dashd | egrep -w 'log'
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.29  log

After:
$ objdump -T dashd | egrep -w 'log'
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 log

* ci: Add `make check-symbols` to the `build` step

* ci: Do not specify `--enable-glibc-back-compat` for non-release builds

* ci: Set correct LDFLAGS for the release build

* doc: Update docs to mention the need for `LDFLAGS=-static-libstdc++` when compiling for same host but different distro

* ci: Add `--with-sanitizers=undefined` back to `linux64` build
2021-11-30 14:13:18 +03:00

81 lines
3.1 KiB
Markdown

GENERIC BUILD NOTES
====================
Some notes on how to build Dash Core based on the [depends](../depends/README.md) build system.
Note on old build instructions
------------------------------
In the past, the build documentation contained instructions on how to build Dash with system-wide installed dependencies
like BerkeleyDB 4.8, boost and Qt. Building this way is considered deprecated and only building with the `depends` prefix
is supported today.
Required build tools and environment
------------------------------------
Building the dependencies and Dash Core requires some essential build tools to be installed before. Please see
[build-unix](build-unix.md), [build-osx](build-osx.md) and [build-windows](build-windows.md) for details.
Building dependencies
---------------------
Dash inherited the `depends` folder from Bitcoin, which contains all dependencies required to build Dash. These
dependencies must be built before Dash can actually be built. To do so, perform the following:
```bash
$ cd depends
$ make -j4 # Choose a good -j value, depending on the number of CPU cores available
$ cd ..
```
This will download and build all dependencies required to build Dash Core. Caching of build results will ensure that only
the packages are rebuilt which have changed since the last depends build.
It is required to re-run the above commands from time to time when dependencies have been updated or added. If this is
not done, build failures might occur when building Dash.
Please read the [depends](../depends/README.md) documentation for more details on supported hosts and configuration
options. If no host is specified (as in the above example) when calling `make`, the depends system will default to your
local host system.
Building Dash Core
---------------------
```bash
$ ./autogen.sh
$ ./configure --prefix=`pwd`/depends/<host>
$ make
$ make install # optional
```
Please replace `<host>` with your local system's `host-platform-triplet`. The following triplets are usually valid:
- `i686-pc-linux-gnu` for Linux32
- `x86_64-pc-linux-gnu` for Linux64
- `x86_64-w64-mingw32` for Win64
- `x86_64-apple-darwin19` for macOS
- `arm-linux-gnueabihf` for Linux ARM 32 bit
- `aarch64-linux-gnu` for Linux ARM 64 bit
If you want to cross-compile for another platform, choose the appropriate `<host>` and make sure to build the
dependencies with the same host before.
If you want to build for the same host but different distro, add `--enable-glibc-back-compat LDFLAGS=-static-libstdc++` when calling `./configure`.
ccache
------
`./configure` of Dash Core will autodetect the presence of ccache and enable use of it. To disable ccache, use
`./configure --prefix=<prefix> --disable-ccache`. When installed and enabled, [ccache](https://ccache.samba.org/) will
cache build results on source->object level.
The default maximum cache size is 5G, which might not be enough to cache multiple builds when switching Git branches
very often. It is advised to increase the maximum cache size:
```bash
$ ccache -M20G
```
Additional Configure Flags
--------------------------
A list of additional configure flags can be displayed with:
```bash
./configure --help
```