From 5465b61784ce67e9f7bdc544321afe22e7ef9c1b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 16 Nov 2016 13:34:56 +1030 Subject: [PATCH 1/2] json: fix 32-bit build. Assume we have strtoull everywhere (it's C99 and was common before). Fixes: #91 Signed-off-by: Rusty Russell --- daemon/json.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/json.c b/daemon/json.c index c32151103..60f12b438 100644 --- a/daemon/json.c +++ b/daemon/json.c @@ -45,9 +45,9 @@ bool json_tok_u64(const char *buffer, const jsmntok_t *tok, uint64_t *num) { char *end; - unsigned long l; + unsigned long long l; - l = strtoul(buffer + tok->start, &end, 0); + l = strtoull(buffer + tok->start, &end, 0); if (end != buffer + tok->end) return false; @@ -55,7 +55,7 @@ bool json_tok_u64(const char *buffer, const jsmntok_t *tok, *num = l; /* Check for overflow */ - if (l == ULONG_MAX && errno == ERANGE) + if (l == ULLONG_MAX && errno == ERANGE) return false; if (*num != l) From 88837c20ca1e99811dabdfd4fd7dead7be3a9fd9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 16 Nov 2016 13:59:20 +1030 Subject: [PATCH 2/2] Makefile: pass CC through to libsecp256k1 build. For CC="gcc -m32" in particular. Signed-off-by: Rusty Russell --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4a0fc8876..f74b6ab6d 100644 --- a/Makefile +++ b/Makefile @@ -247,7 +247,7 @@ ccan/ccan/cdump/tools/cdump-enumstr: ccan/ccan/cdump/tools/cdump-enumstr.o $(CDU libsecp256k1.a: secp256k1/libsecp256k1.la secp256k1/libsecp256k1.la: - cd secp256k1 && ./autogen.sh && ./configure --enable-static=yes --enable-shared=no --enable-tests=no --enable-experimental=yes --enable-module-ecdh=yes --libdir=`pwd`/.. + cd secp256k1 && ./autogen.sh && ./configure CC="$(CC)" --enable-static=yes --enable-shared=no --enable-tests=no --enable-experimental=yes --enable-module-ecdh=yes --libdir=`pwd`/.. $(MAKE) -C secp256k1 install-exec lightning.pb-c.c lightning.pb-c.h: lightning.proto