Since the secp256k1 subtree update in #19228 (8c97780db8c9dd33efed134385573ba97e9cd165), it hasn’t been possible to compile on OpenBSD. Building fails with (cc is Clang 8.0.1):
0./autogen.sh
1./configure --disable-wallet --with-gui=no CC=cc CXX=c++ MAKE=gmake
2gmake -j6 V=1
3...
4gmake[3]: Entering directory '/home/vagrant/bitcoin/src/secp256k1'
5gcc -I. -I./src -Wall -Wextra -Wno-unused-function -g -O2 -c src/gen_context.c -o gen_context.o
6In file included from src/gen_context.c:16:
7src/util.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'uint128_t'
8gmake[3]: *** [Makefile:1689: gen_context.o] Error 1
9gmake[3]: Leaving directory '/home/vagrant/bitcoin/src/secp256k1'
The issue is that libsecp does some native compiler detection in configure, and then uses that compiler specifically for the ecmult precomputation. See here, (the call settings CC_FOR_BUILD
is earlier):
https://github.com/bitcoin/bitcoin/blob/476436b2dec254bb988f8c7a6cbec1d7bb7cecfd/src/secp256k1/configure.ac#L186-L188
and then here where it’s used:
https://github.com/bitcoin/bitcoin/blob/476436b2dec254bb988f8c7a6cbec1d7bb7cecfd/src/secp256k1/Makefile.am#L129-L130
The problem is that this ends up picking up and using OpenBSDs ancient GCC 4.2.1, which barfs when it gets to util.h: https://github.com/bitcoin/bitcoin/blob/476436b2dec254bb988f8c7a6cbec1d7bb7cecfd/src/secp256k1/src/util.h#L179
If anyone does happen to run into this issue, the immediate workaround is to just pass CC_FOR_BUILD
to configure, i.e: ./configure --disable-wallet --with-gui=no CC=cc CXX=c++ MAKE=gmake CC_FOR_BUILD=cc
.
However before we update any docs etc, I’m going to take the issue upstream.