Commit graph

12243 commits

Author SHA1 Message Date
Jason Rhinelander
bbf201a7a6
Make debug_utilities available to build even without -DBUILD_DEBUG_UTILS (#1183)
This uses EXCLUDE_FROM_ALL when BUILD_DEBUG_UTILS is not on so that they
don't get built but they *can* be built with a `make cn_deserialize` (or
whatever target you want) from a build dir.

Also adds them to a couple drone builds to make sure they build.
2020-06-25 13:10:09 +10:00
Jason Rhinelander
1f6bb56764
Remove -Ofast, use cmake defaults for release/debug (#1180)
-Ofast turns on -ffast-math, which allows gcc to do IEEE-violating FP
math optimizations.  The consequence of this is that it means a Release
build and a Debug build produce *different* difficulty values.  (It may
also have contributed to difficulty value divergence).

Turn it off because we are not Gentoo.

There is actually little point of setting CMAKE_CXX_FLAGS_RELEASE at all
here: adding `-DNDEBUG` is already the default for a cmake release
build, and cmake similarly has a release build default optimization
level (which I think is `-O3` -- which is already what we're doing with
`-Ofast` on Linux, except that `-Ofast` turns on unsafe stuff on top of
`-O3`).

For Debug build, this removes -Og and lets cmake use its default (-O0),
which is usually better when developing: lack of optimization means
faster binaries, are easier to trace.  The downside is enormous binaries
(~250MB), but that seems at least manageable for a debug build.
2020-06-22 15:33:23 +10:00
Jason Rhinelander
300667e5f2
Add support for N=11 and N=12 quorum comms (#1178)
Previously we supported N=7 through N=10 and N=13 through N=20; with
pulse we need N=11 and N=12, so fill in the gaps so we now have a matrix
for everything from N=7 to N=20.

Connections are generated from utils/generate-quorum-matrix.py using
that same criteria as the existing connection matrices (that is, finding
a set of connections to ensure that every node is connected to every
other node twice with direct or two-hop connections).  The missing added
connection details are as follows:

┌────┬───────────────────────────────┬─────────────┬────────────────────┐
│ i  │ Connections (1 = out, x = in) │ ≤2 paths    │ Connectivity:      │
├────┼───────────────────────────────┼─────────────┼────────────────────┤
│ 0  │ -100xx1x001                   │ -3433343332 │ 6 (= 3 out + 3 in) │
│ 1  │ x-10x0011x0                   │ 3-333344322 │ 6 (= 3 out + 3 in) │
│ 2  │ 0x-11x01000                   │ 43-33232322 │ 5 (= 3 out + 2 in) │
│ 3  │ 00x-110010x                   │ 333-2322223 │ 5 (= 3 out + 2 in) │
│ 4  │ 11xx-010000                   │ 3332-424222 │ 5 (= 3 out + 2 in) │
│ 5  │ 101x0-100xx                   │ 33234-33323 │ 6 (= 3 out + 3 in) │
│ 6  │ x000xx-1010                   │ 443223-2222 │ 5 (= 2 out + 3 in) │
│ 7  │ 1xx000x-100                   │ 3422432-232 │ 5 (= 2 out + 3 in) │
│ 8  │ 0x0x000x-11                   │ 33322322-22 │ 5 (= 2 out + 3 in) │
│ 9  │ 010001x0x-0                   │ 322222232-2 │ 4 (= 2 out + 2 in) │
│ 10 │ x0010100x0-                   │ 2223232222- │ 4 (= 2 out + 2 in) │
└────┴───────────────────────────────┴─────────────┴────────────────────┘

┌────┬───────────────────────────────┬──────────────┬────────────────────┐
│ i  │ Connections (1 = out, x = in) │ ≤2 paths     │ Connectivity:      │
├────┼───────────────────────────────┼──────────────┼────────────────────┤
│ 0  │ -10xx0x00010                  │ -23332332222 │ 5 (= 2 out + 3 in) │
│ 1  │ x-110x001000                  │ 2-3422232222 │ 5 (= 3 out + 2 in) │
│ 2  │ 0x-10100001x                  │ 33-222233222 │ 5 (= 3 out + 2 in) │
│ 3  │ 1xx-1001x000                  │ 342-23323233 │ 6 (= 3 out + 3 in) │
│ 4  │ 100x-010010x                  │ 3222-2323332 │ 5 (= 3 out + 2 in) │
│ 5  │ 01x00-110x00                  │ 22232-323232 │ 5 (= 3 out + 2 in) │
│ 6  │ 1000xx-101x0                  │ 322333-32333 │ 6 (= 3 out + 3 in) │
│ 7  │ 000x0xx-1010                  │ 3332223-2322 │ 5 (= 2 out + 3 in) │
│ 8  │ 0x01000x-101                  │ 22333322-222 │ 5 (= 3 out + 2 in) │
│ 9  │ 0000x1x0x-01                  │ 222232332-23 │ 5 (= 2 out + 3 in) │
│ 10 │ x0x0001x00-1                  │ 2223333222-2 │ 5 (= 2 out + 3 in) │
│ 11 │ 00101000xxx-                  │ 22232232232- │ 5 (= 2 out + 3 in) │
└────┴───────────────────────────────┴──────────────┴────────────────────┘
2020-06-22 11:10:52 +10:00
Doyle
25c3d370bc
Remove extra blob hash not needed in Loki (#1176)
Monero need it because they have some blocks in the chain that have
faulty hashes and needed to be recognised and overriden in the function.
2020-06-18 12:39:20 +10:00
Doyle
063ffc24ff
Merge pull request #1174 from jagerman/old-build-systems
Remove old build systems
2020-06-16 13:08:14 +10:00
Jason Rhinelander
6f49fe0c91 Remove travis-ci script
Replaced by drone.
2020-06-16 00:04:37 -03:00
Jason Rhinelander
7964a27b57 Remove contrib/depends
We've never seriously used it, versions in it tend to bitrot, and it's
redundant with the new cmake-based static builds which are easier to
maintain.
2020-06-16 00:02:14 -03:00
Doyle
998960e047
Merge pull request #1173 from jagerman/static-builds
Overhaul static build mechanism
2020-06-16 10:53:39 +10:00
Jason Rhinelander
30553e44e0 Lower parallel jobs to 6 2020-06-15 14:51:41 -03:00
Jason Rhinelander
d2d73e7b22 Drone: Add tags/submodules as separate step
This makes it a little clearer what failed when something fails.

Ideally we'd also be able to distinguish between build and test, but
currently that's not practical to do with drone: between each stage of
the build the docker image gets removed and replaced with the next
stage's image, which means we'd have to build up a new docker image with
dependencies before running the tests.

(Being able to have multiple stages in one docker image is a drone
upstream wishlist item).
2020-06-15 12:49:34 -03:00
Jason Rhinelander
1a7bf3e53e Add local static source mirror
I've uploaded the various deps to https://builds.lokinet.dev/deps so as
not to hit the upstream mirrors so much (also reduces the reliance on
github, which is sometimes flakey).

This is prefixed onto the existing URLs so that if it isn't found we
fall back to the upstream URL.
2020-06-15 12:49:34 -03:00
Jason Rhinelander
5da3d2f7ef Drone: add static builds for mac/linux/windows
Adds static drone builds for linux (built on bionic), mac, and Windows
(built with mingw32).

The builds get uploaded to https://builds.lokinet.dev

The linux and mac builds use LTO (which takes longer, but significantly
reduces binary size).  The mingw32 build can probably also get there,
but currently fails with LTO when unbound tries linking against openssl
(it probably just needs a small patch to add magic -lwsock2 dep in the
right place in unbound).

The Mac binaries are built using a 10.13 deployment target.  (I'm not
100% sure that this is sufficient -- it's possible we might have to also
push the magic mac deployment flag to the built dependencies).
2020-06-15 12:49:34 -03:00
Jason Rhinelander
415027c6cd create_archive target: add targets to archive the bin/ build dir
From a cmake build dir (`make` used for simple example; can also be
something else, such as ninja):

    make create_tarxz
    make create_zip

creater a loki-<OS>[-arch]-x.y.z[-dev]-<GITHASH>.tar.xz or .zip.

    make create_archive

decides what to do based on the build type: creates a .zip for a windows
build, a tar.xz for anything else.  (We have been distributing the macOS
binaries as a .zip but that seems unnecessary: I tested on our dev mac
and a .tar.xz offers exactly the same UX as a .zip, but is noticeably
smaller).

From the top-level makefile there is also a new `make
release-full-static-archive` that does a full static build (include all
deps) and builds the archive.
2020-06-15 12:49:33 -03:00
Jason Rhinelander
70b9fed4fd Static builds: make usable binaries from cmake
This adds a static dependency script for libraries like boost, unbound,
etc. to cmake, invokable with:

    cmake .. -DBUILD_STATIC_DEPS=ON

which downloads and builds static versions of all our required
dependencies (boost, unbound, openssl, ncurses, etc.).  It also implies
-DSTATIC=ON to build other vendored deps (like miniupnpc, lokimq) as
static as well.

Unlike the contrib/depends system, this is easier to maintain (one
script using nicer cmake with functions instead of raw Makefile
spaghetti code), and isn't concerned with reproducible builds -- this
doesn't rebuild the compiler, for instance.  It also works with the
existing build system so that it is simply another way to invoke the
cmake build scripts but doesn't require any external tooling.

This works on Linux, Mac, and Windows.

Some random comments on this commit (for preserving history):

- Don't use target_link_libraries on imported targets.  Newer cmake is
fine with it, but Bionic's cmake doesn't like it but seems okay with
setting the properties directly.

- This rebuilds libzmq and libsodium, even though there is some
provision already within loki-core to do so: however, the existing
embedded libzmq fails with the static deps because it uses libzmq's
cmake build script, which relies on pkg-config to find libsodium which
ends up finding the system one (or not finding any), rather than the one
we build with DownloadLibSodium.  Since both libsodium and libzmq are
faily simple builds it seemed easiest to just add them to the cmake
static build rather than trying to shoehorn the current code into the
static build script.

- Half of the protobuf build system ignores CC/CXX just because Google,
and there's no documentation anywhere except for a random closed bug
report about needing to set these other variables (CC_FOR_BUILD,
CXX_FOR_BUILD) instead, but you need to.  Thanks Google.

- The boost build is set to output very little because even the minimum
-d1 output level spams ~15k lines of output just for the headers it
installs.
2020-06-15 12:49:33 -03:00
Jason Rhinelander
da400f6d66 Rewrite translation file generation using cmake
This makes three big changes to how translation files are generated:

- use Qt5 cmake built-in commands to do the translations rather than
calling lrelease directly.  lrelease is often not in the path, while Qt5
cmake knows how to find and invoke it.

- Slam the resulting files into a C++ file using a cmake script rather
than needing to compile a .c file to generate C++ file.  This is
simpler, but more importantly avoids the mess needed when cross
compiling of having to import a cmake script from an external native
build.

- In the actual generated files, use an unordered_map rather than a
massive list of static variable pointers.
2020-06-15 12:49:33 -03:00
Jason Rhinelander
1c1a7e6f84 Remove cruft 2020-06-15 12:49:33 -03:00
Jason Rhinelander
5e8202bb2c Fix unit tests ODR violation
The same struct `lazy_init` was being used in two different files linked
into the same binary, causing test failures depending on which one got
kept in the final binary.  (Enabling LTO builds noticed the violation,
warned about it, and caused the spent_outputs.not_found test to fail).
2020-06-15 12:49:33 -03:00
Jason Rhinelander
79a3f10085 Fix NULL being passed as bool
Clang (rightly) warns about this.
2020-06-15 12:49:33 -03:00
Jason Rhinelander
85eea97a7a Address missing override warnings 2020-06-14 23:55:48 -03:00
Jason Rhinelander
e3bca6cbc3 Silence maybe-uninitialized warnings 2020-06-14 23:55:48 -03:00
Jason Rhinelander
731f4e3b4e Fix conflicting jh_hash/skein_hash definitions
The mismatch in the extern declaration spews warnings under LTO (quite
rightly).  It's kind of surprising that the mismatched declaration and
implementation even worked.
2020-06-14 23:55:48 -03:00
Jason Rhinelander
45a2de9f51 ERROR_INTERNAL_ERROR is an unholy macro on mingw
I have no idea where it comes from, but the compilation fails as a
result.  This is why macros are EVIL.
2020-06-14 23:43:35 -03:00
Jason Rhinelander
2c89428f7c Windows build fixes 2020-06-14 23:43:35 -03:00
Jason Rhinelander
3b110879b6 Temp fix for boost compatibility
To be reverted with C++17 changes.
2020-06-14 23:43:35 -03:00
Jason Rhinelander
7aa0b883ed Clean up dependency information
- libzmq required version was much older than we actually require

- libnorm and libpgm are transitive dependencies of libzmq3, it makes no
sense to list them here (rather the libzmq3-dev package should depend on
them if they are needed).

- gtest is now always build from the submodule copy

- the readline dev package was wrong for debian/ubuntu.
2020-06-14 23:43:35 -03:00
Jason Rhinelander
98d1cab7ed Fix invalid cmake build type release -> Release
Lower-case "release" is not a valid cmake build type (it's "Release"),
so fix it.
2020-06-14 23:43:35 -03:00
Jason Rhinelander
1026ff680b Set up LTO properly
CMake 3.9+ has generic LTO enabling code, switch to it.

Update required cmake version to 3.10 (3.9 is probably sufficient, but
3.10 is bionic's version that we're actually testing).
2020-06-14 23:16:04 -03:00
Jason Rhinelander
630f346dba Set C++14 compilation mode properly
CMake has standard interfaces for this; hacking it into CXX_FLAGS is
just gross.
2020-06-14 22:18:50 -03:00
Jason Rhinelander
ac29b79cd9 Do not try to feature test static_assert
static_assert is required both by C++11 and C11; if we don't have a
standard compliant compiler then compilation should fail, not be hacked
like this.

The C++ version of this definition is particularly preposterous; the C
version is probably just covering up that the C code forget to include
the `<assert.h>` header where the `static_assert` macro is defined.
2020-06-14 22:18:22 -03:00
Jason Rhinelander
8cff7c1664 Enable ccache by default
It can still be explicitly disabled with

    -DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_C_COMPILER_LAUNCHER=

if someone doesn't want it for some reason.
2020-06-14 22:10:38 -03:00
Jason Rhinelander
d1f398cc2b Switch miniupnp from monero to upstream
The monero version is just an improperly forked mirror of upstream that
tends to lag behind.  Switch to upstream miniupnp instead.
2020-06-14 22:10:38 -03:00
Jason Rhinelander
701732cfae Don't depend unnecessarily on PkgConfig 2020-06-14 22:10:36 -03:00
Jason Rhinelander
f4e9ea7d40 Remove unbound submodule
There's really no reason to submodule it - we work with pretty much any
libunbound version, and it's a very commonly available library
(comparable to sqlite3 or boost, which we don't submodule).

This removes the submodule and switches it to a hard dependency.
2020-06-11 15:02:21 -03:00
Jason Rhinelander
fdf65677eb
Merge pull request #1171 from Doy-lee/RemoveOldVoteBlobFixes
SN: Remove old vote blob serialisation fixes
2020-06-10 21:25:39 -03:00
Doyle
c93dbf7ce6 SN: Remove old vote blob serialisation fixes
Votes are ephemeral and the backwards compat fixes are only needed at
the time of the hard fork.
2020-06-11 10:16:55 +10:00
Doyle
ab44bc86c6
Merge pull request #1170 from jagerman/upstream+drone
Drone CI builds + various small fixes
2020-06-10 13:29:51 +10:00
Jason Rhinelander
2dc9323fcb Disable DNSSEC, is_hdd tests in CI
The DNSSEC tests fail on me quite often; the is_hdd tests *always* fails
inside a container.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
9c46de849c Build less stuff on ARM ci
Turn off the tests, and copy the -j1/-j2 split from the travis config.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
901baec2a9 Disable functional tests
They don't work, and it doesn't look like they ever have: the Python
code tries invoking monerod/monero-wallet-rpc binaries.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
e9043fe789 Make tests use Python 3 consistently
Python2 reached end of life and is being active removed from Linux
distributions; drop support for it in the test code, too.

- Stop using deprecated FindPythonInterp when we have cmake 3.12 (which
has a much better FindPython).
- Fix tests that might invoke Python 2, and remove Python2-isms
2020-06-09 23:06:54 -03:00
Jason Rhinelander
1131703206 Fix test broken by Monero donation address change
From Monero PR 6637
2020-06-09 23:06:54 -03:00
Jason Rhinelander
a9171c687f Remove -Wundef from compilation flags
This triggers a pile of false positives from gtest and mapbox variant.
In the case of gtest, these were being hidden by including gtest as a
system include, which was simply disgusting.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
60c56b39a6 Avoid value truncation warning
STAKING_PORTIONS doesn't fit in a double, and so clang is warning about
the precision loss.  Be explicit about double cast to avoid this
warning.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
5954cb8234 Update and submodule gtest
The gtest version bundled inside tests/ is ancient (7 years old) and
doesn't build properly for some compilers.

Replace it with a current gtest submodule in external/.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
d33f9bf73b Disable -Werror for now
Many of the warnings being generated (which *are* legitimate problems)
are better addressed in the C++17 PR.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
365a1e0141 Fix backwards C++17 logic for static constants
Not having these cause some debug builds to fail; also corrects one of
the types.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
6a3c3e3de4 Update lokimq to master
Fixes a build issue (wrong/missing compiler) with the embedded libzmq
shared library.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
7636155ffc Temporary clang variable template workaround
Temporary in that this will go away (in favour of become `inline`
variables) in the C++17 PR.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
9255d1080a Don't use external project for no reason
Using an external project to build a subdirectory is gross, and moreover
it breaks if you are trying to use a custom compiler and uses the wrong
one (or just fails if a `c++` binary doesn't exist).

Since the builds appear to run just fine without this, just include it
via add_subdirectory instead.
2020-06-09 23:06:54 -03:00
Jason Rhinelander
0fa6a42d21 Fix warning in Debug build 2020-06-09 23:06:54 -03:00