Commit Graph

109 Commits

Author SHA1 Message Date
Rusty Russell 5ae18ecb32 Revert accidental experimental libwally update from f56266c1c1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-11-17 11:21:58 -06:00
Rusty Russell f56266c1c1 plugins: undeprecate old form of hooks.
This effectively reverts ac93b780d5.

Christian points out that plugins need time before we deprecate
the old options (probably 6 months) as they need to work with
both old and new.

Changelog-Deprecated: **UNDO** plugins: hooks should now be specified using objects, not raw names.
Suggested-by: @cdecker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-11-17 14:42:58 +10:30
YOSHIDA Masanori b7ab8866b8 Makefile: fix typo and wrong path in external/Makefile to properly remove objects with "make clean"
Signed-off-by: YOSHIDA Masanori <masanori.yoshida@gmail.com>
Changelog-None
2020-10-27 10:42:48 +10:30
Rusty Russell c76cfe9c5c Makefile: fix typo which can cause build failures.
And add secp_recovery to headers, while we're at it.

```
./wire/wire.h:7:10: fatal error: secp256k1_recovery.h: No such file or directory
 #include <secp256k1_recovery.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:254: recipe for target 'connectd/test/run-initiator-success.o' failed
make: *** [connectd/test/run-initiator-success.o] Error 1
m
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-09-09 20:44:22 +09:30
Rusty Russell 2c9ad7ea29 external/Makefile: fix mkdir rule for libbacktrace.a
The $(TARGET_DIR) may not exist: use mkdir -p.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-08-31 21:33:26 -05:00
Rusty Russell 95a0249272 external/Makefile: fix build from fresh git clone.
```
make: *** No rule to make target 'external/gheap/gheap.h', needed by 'bitcoin/chainparams.o'.  Stop.
make: *** Waiting for unfinished jobs....
```

Just simplify the Makefile to make all the external headers we use
dependent on submodcheck.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-08-31 21:33:26 -05:00
Rusty Russell 5d9d21d64d external/gheap: new submodule.
It's actually entirely in the header file, so no linking needed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-08-28 10:56:50 +09:30
niftynei 24215f8c04 libwally: update to latest master, includes map sort 2020-08-18 11:08:44 +09:30
Jon Griffiths 95d3d65c62 wally: update to the latest wally version
Includes:
psbt: Use renamed functions for new wally version
psbt: Set the transaction directly to avoid script workarounds
psbt: Use low-S grinding when computing signatures
tx: Use wally_tx_clone from libwally now that its exported

Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
2020-08-07 10:28:01 +09:30
niftynei 389bd8393b submodules/libwally: use blessed-branch 2020-07-13 11:37:24 +09:30
Rusty Russell 57f6f74ee0 external/Makefile: fix spurious rebuilds.
Quote marks are not special to make: as it can't find
external/"x86_64-linux-gnu"/libwally-core-build/src/libwallycore.la
it always insists on rebuilding it (which rebuilds the world).

If we have spaces in TARGET_DIR, we're in trouble already.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Changelog-None
2020-06-29 15:48:09 +09:30
Wladimir J. van der Laan 32f9805a30 build: Make it possible to build without gcc
The external Makefile hardcodes gcc to get the machine spec.
This should use the configured C compiler instead.

This bug was introduced in 601464416b.
2020-06-29 09:08:39 +09:30
Niklas Claesson 601464416b travis: Actually build for arm
Before this we cached the whole `external` directory, but that lead to
stale files since the cache is checked out after the repository is
cloned.
2020-06-24 17:08:40 +02:00
niftynei 0f8157a02e libwally: update to latest commit on master, which contains psbt fixes
fixes for p2sh-p2wpkh sigs in libwally etc
2020-06-23 14:49:32 +02:00
niftynei 1d56a4eda1 libwally: update to latest commit 2020-06-11 13:13:13 +02:00
Rusty Russell 06ae03f487 external/libwally-core: update to latest version.
Includes an important PSBT fix (https://github.com/ElementsProject/libwally-core/pull/190)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-05-21 18:45:07 +09:30
Rusty Russell 88402bc234 Makefile: fix clean and distclean for external libs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-05-15 09:55:59 +09:30
Dr. Maxim Orlovsky fe85cf9a4f Removing duplicated wscript generation for channel txs 2020-04-08 13:59:18 +09:30
Vasil Dimov 53ecf098ab build: remove unrecognized option to libsodium
Silence a warning during libsodium's ./configure:

```
configure: WARNING: unrecognized options: --enable-tests
```

Changelog-None
2020-03-05 14:58:57 -06:00
Vasil Dimov 6e86022909 build: force libwally-core to compile in C99 mode
Without this gcc 4.8 defaults to an older standard and cannot compile
the code:

```
gcc-4.8 -DHAVE_CONFIG_H -I. -I../../libwally-core/src -I../../libwally-core -I../../libwally-core/src/ccan -DWALLY_CORE_BUILD=1 -Wall -Wextra -Wpedantic -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wformat -Wformat-security -Wformat-nonliteral -O0 -ggdb -DBUILD_ELEMENTS=1 -flax-vector-conversions -Wno-unused-function -Wno-long-long -Wno-overlength-strings -Wno-variadic-macros -fvisibility=hidden -g -O2 -MT libwallycore_la-elements.lo -MD -MP -MF .deps/libwallycore_la-elements.Tpo -c ../../libwally-core/src/elements.c -o libwallycore_la-elements.o
../../libwally-core/src/elements.c: In function ‘wally_asset_pak_whitelistproof’:
../../libwally-core/src/elements.c:629:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (size_t i = 0; i < num_keys; ++i) {
     ^
../../libwally-core/src/elements.c:629:5: note: use option -std=c99 or -std=gnu99 to compile your code
```

Changelog-None
2020-03-05 14:58:57 -06:00
Christian Decker 42d1d3b6d1 wally: Bump libwally to fix gcc 4.8 support 2020-03-04 13:29:39 +10:30
Christian Decker c49c869933 wally: Specify that we use python3 so we don't depend on python2
We specify `PYTHON_VERSION=3` to prevent libwally's ./configure from searchin
for python2, which some distros have started removing, and we were requiring
it only for the configuration step anyway.

Changelog-Changed: dependencies: We no longer depend on python2 which has reached end-of-life
2020-02-27 09:18:24 +10:30
Niklas Claesson f9b3b96a63 external: Reorganize to support cross-compilation
On CI it is nice to cache the external dependencies. However if we
always compile them in the same folder we cannot cache for multiple
different architectures. After this commit native compile targets will
still live in `external` but cross compiled versions will live in
`external/<arch>`.
2020-02-04 11:16:02 +10:30
Niklas Claesson b8ee4896ed libs: Update libwally-core to release 0.7.5 2020-02-04 11:16:02 +10:30
Ján Sáreník 170918ff8c Add cross-compilation options only when requested (#3275)
Requesting them is done by setting BUILD=<target_arch>

Otherwise autotools (used by external dependencies like
libsodium) is not happy with setting cross-compilation
variables and may possibly lead to unexpected results.
2019-11-20 16:54:50 +01:00
Rusty Russell 776674117b libwally: upgrade to v0.7.4.
On master I get a crash and the following from valgrind, which
seems like a libwally bug.  Upgrading made it go away.

==45076== Invalid read of size 1
==45076==    at 0x1191A1: topo_add_utxos (chaintopology.c:657)
==45076==    by 0x11935F: add_tip (chaintopology.c:681)
==45076==    by 0x1197E6: have_new_block (chaintopology.c:761)
==45076==    by 0x114BB0: process_rawblock (bitcoind.c:480)
==45076==    by 0x1140A0: bcli_finished (bitcoind.c:227)
==45076==    by 0x1A4CA2: destroy_conn (poll.c:244)
==45076==    by 0x1A4CC2: destroy_conn_close_fd (poll.c:250)
==45076==    by 0x1B28CD: notify (tal.c:235)
==45076==    by 0x1B2DBC: del_tree (tal.c:397)
==45076==    by 0x1B3148: tal_free (tal.c:481)
==45076==    by 0x1A34C1: io_close (io.c:450)
==45076==    by 0x1A53DD: io_loop (poll.c:449)
==45076==  Address 0x59fc658 is 4 bytes after a block of size 4 alloc'd
==45076==    at 0x483874F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==45076==    by 0x1BD3A5: tx_from_bytes (in /home/rusty/lightning-ltest/lightningd/lightningd)
==45076==    by 0x1715C3: pull_bitcoin_tx (tx.c:411)
==45076==    by 0x16B25A: bitcoin_block_from_hex (block.c:54)
==45076==    by 0x114B45: process_rawblock (bitcoind.c:473)
==45076==    by 0x1140A0: bcli_finished (bitcoind.c:227)
==45076==    by 0x1A4CA2: destroy_conn (poll.c:244)
==45076==    by 0x1A4CC2: destroy_conn_close_fd (poll.c:250)
==45076==    by 0x1B28CD: notify (tal.c:235)
==45076==    by 0x1B2DBC: del_tree (tal.c:397)
==45076==    by 0x1B3148: tal_free (tal.c:481)
==45076==    by 0x1A34C1: io_close (io.c:450)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-03 18:08:28 +02:00
Christian Decker eb5ef0fc08 external: Enable debugging and building elements in libwally-core
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-10-03 04:32:57 +00:00
GreenAddress fb07265663 remove libbase58, use base58 from libwally (#2594)
* remove libbase58, use base58 from libwally

This removes libbase58 and uses libwally instead.

It allocates and then frees some memory, we may want to
add a function in wally that doesn't or override
wally_operations to use tal.

Signed-off-by: Lawrence Nahum lawrence@greenaddress.it
2019-04-30 23:07:31 +02:00
Lawrence Nahum a9e71d76b5 update libwally to latest version 0.6.9
Also removes a workaround caused by bug in libwally (!95) which has
been fixed.

Signed-off-by: Lawrence Nahum <lawrence@greenaddress.it>
2019-04-23 15:18:57 +02:00
Rusty Russell e0ec9ac521 libwally: update to 0.6.8.
This fixes block parsing on testnet; specifically, non-standard tx versions.

We hit a type bug in libwally (wallt_get_secp_context()) which I had to
work around for the moment, and the updated libsecp adds an optional hash
function arg to the ECDH function.

Fixes: #2563
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-13 18:55:15 +02:00
Rusty Russell d413fc7e9b configure: use system libbase58 if available.
Also one less headache for reproducible builds.  But unlike
libsodium, this only seems common in Ubuntu.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-08 01:10:17 +00:00
Rusty Russell 21fd8f7eaa configure: use system libsodium if available and modern.
Also one less headache for reproducible builds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-08 01:10:17 +00:00
Rusty Russell 7b59e26dd7 jsmn: upgrade so JSMN_OBJECT's size parameter is usable.
jsmn would accept invalid JSON objects.  This is bad because it would
set ->size incorrectly: we expect to have at least size * 2 tokens (in
pairs).  We want to rely on ->size, but this would create an exploitable
buffer overflow!

Fortunately, this is fixed upstream, so we add a test and upgrade to v1.0.0.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-01-17 16:22:32 +01:00
Jon Griffiths d3bfc9f260 libwally: Update to latest master
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
2018-11-21 01:18:24 +00:00
Christian Decker d0de7b49b2 libwally: Update to latest master to fix some compilation issues
Signed-off-by: Christian Decker <@cdecker>
2018-10-15 00:39:33 +00:00
Jan Sarenik e5809cf268 external/libwally-core: Update to master after release_0.6.1
The extra patch after release_0.6.1 fixes another set of
FORTIFY warnings.

See https://github.com/ElementsProject/libwally-core/pull/36
2018-06-14 14:26:25 +02:00
Jan Sarenik eab2a62894 external/libsodium: Update to 1.0.16
Fixes lots of extra warnings (#1540)
2018-06-09 06:42:02 +00:00
Rusty Russell 109b429311 libbacktrace: pull latest version, which has config.guess fix applied.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-08 17:56:01 +02:00
Rusty Russell 76dd1577bd external: fix submodule handling for parallel builds, submodule URL changes.
If we change an upstream URL, all submodules break.  Users would need
to run 'git submodule sync'.  Note that the libbacktrace fix was merged
upstream so this is no longer necessary, but it's good for future changes.

Also, stress-testing reveals that git submodule fails locking
'.git/config' when run in paralell.  It also segfaults and other
problems.

This is my final attempt to fix submodules; I've wasted far too many
days on obscure problems it creates: I've already lost one copy of my
repo to apparently unfixable submodule preoblems.  The next "fix" will
be to simply import the source code so it works properly.

Reported-by: @jsarenik
Fixes: #1543
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-08 17:56:01 +02:00
Jan Sarenik b28d71a9a5 external/Makefile: Change variable HOST to MAKE_HOST
Proposed fix for issue #1231 - FreeBSD (tcsh) build problem due
to HOST environment variable.

The variable is used for cross-compilation. The process may be
improved even further in the future. So far this hot fix.
2018-05-23 23:08:17 +00:00
Rusty Russell a85ead7058 invoice: allow numeric labels again.
Fixes: #1291
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-30 00:01:10 +02:00
conanoc c4700a13a7 Add guard for BACKTRACE_SUPPORTED 2018-03-26 00:30:39 +00:00
Igor Cota fc3e6782dd Only make clean external submodules if Makefile present, fixes #1130 2018-02-28 10:02:07 +00:00
Jan Sarenik 54b8562936 Fix libtool error
This is how the error before the fix looked like on Arch Linux with
GNU libtool 2.4.6.40-6ca5-dirty:

    $ make installcheck
    ...
    make[4]: Entering directory '/home/jasan/lightning/external/libwally-core/src/secp256k1'
     /usr/bin/mkdir -p 'testinstall/home/jasan/lightning/external/libwally-core/..'
     /bin/sh ./libtool   --mode=install /usr/bin/install -c   libsecp256k1.la 'testinstall/home/jasan/lightning/external/libwally-core/..'
    Usage: /home/jasan/lightning/external/libwally-core/src/secp256k1/libtool [OPTION]... [MODE-ARG]...
    Try 'libtool --help' for more information.
    libtool:   error: 'testinstall/home/jasan/lightning/external/libwally-core/..' must be an absolute directory name
    make[4]: *** [Makefile:910: install-libLTLIBRARIES] Error 1
    make[4]: Leaving directory '/home/jasan/lightning/external/libwally-core/src/secp256k1'
    make[3]: *** [Makefile:1253: install-exec-recursive] Error 1
    make[3]: Leaving directory '/home/jasan/lightning/external/libwally-core/src'
    make[2]: *** [Makefile:429: install-exec-recursive] Error 1
    make[2]: Leaving directory '/home/jasan/lightning/external/libwally-core'
    make[1]: *** [external/Makefile:41: external/libwallycore.a] Error 2
    rm external/libwally-core/src/secp256k1/libsecp256k1.la
    make[1]: Leaving directory '/home/jasan/lightning'
    make: *** [Makefile:430: installcheck] Error 2

Then there was linking error which needed to be fixed by correcting
the idea of installing external libraries to a particular directory.
2018-02-28 01:53:33 +00:00
Igor Cota a048a54f83 Add specific external libs to the makefile clean recipe. To avoid failed linking of cross compiled binaries left out after an incomplete make clean 2018-02-28 01:51:17 +00:00
Igor Cota f7097c76bd Pass the HOST and BUILD environment vars to the external submodules configurators. Needed to cross-compile 2018-02-16 17:50:38 +01:00
Rusty Russell 4d58b12255 external/jsmn: update module to see if bug is fixed
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-05 04:08:16 +00:00
Rusty Russell 7db88f0b8a external: make submodule hacks more general, and common.
We can't rely on the existence or not of a header, as Carl's
delete-and-make-submodule change showed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-29 06:21:07 +00:00
Carl Dong e624046c74 external/Makefile: Initialize/update libwally-core submodule. 2018-01-29 06:21:07 +00:00
Carl Dong a6e2e46b54 Submodulize and update libwally-core for LTO removal. 2018-01-29 06:21:07 +00:00
Rusty Russell 635b7d5799 Revert changes to external files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-29 16:50:17 +10:30
rvandermeer 4c0f7dbd04 Spelling corrections (#824)
* Small spelling fixes, and clarity for 'iff'

[ Squashed commit --RR ]
2018-01-29 04:46:54 +00:00
Rusty Russell c22d2c8dae Makefile: rebuild all objects if Makefile changes.
This doesn't cover external libs in general (which *could* be effected by
CFLAGS), but at least all our own objects are rebuilt.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-22 18:58:23 +01:00
Rusty Russell af7e6158af Makefile: clean needs to do more, distclean should remove everything.
I checked this with git status --ignored after a full build and 'make distclean'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-24 13:29:03 +01:00
Rusty Russell a02ca46b03 secp256k1_ecdsa_recoverable_signature: add support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-01 01:09:23 +00:00
Rusty Russell dba27188b7 external/libbacktrace: new external library for backtrace support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-12 23:00:53 +02:00
Rusty Russell bbed5e3411 Rename subdaemons, move them into top level.
We leave the *build* results in lightningd/ for ease of in-place testing though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00
Rusty Russell 739b163f8b Makefiles: simplify dependencies.
Gather all binaries and objects and make the depend on external
requirements and common headers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00
Rusty Russell f42f34b82d external: new subdirectory for all external libraries and submodules.
You will want to 'make distclean' after this.

I also removed libsecp; we use the one in in libwally anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-29 17:54:14 +02:00