Skip to content

Issue compiling on OpenBSD 6.7 #768

@fanquake

Description

@fanquake

Since the secp256k1 subtree update in bitcoin/bitcoin#19228, it hasn't been possible to cleanly compile Bitcoin Core on OpenBSD. Building fails with (excerpt from just building libsecp, cc is Clang 8.0.1):

./autogen.sh
./configure CC=cc MAKE=gmake
gmake -j6 V=1
...
gmake
gcc -I. -I./src -Wall -Wextra -Wno-unused-function -g -c src/gen_context.c -o gen_context.o
In file included from src/gen_context.c:16:
src/util.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'uint128_t'
gmake: *** [Makefile:1689: gen_context.o] Error 1

libsecp does some native compiler detection in configure, and then uses that compiler specifically for the ecmult precomputation. i.e:

secp256k1/configure.ac

Lines 186 to 188 in 3f4a5a1

if test x"$use_ecmult_static_precomputation" != x"no"; then
# Temporarily switch to an environment for the native compiler
save_cross_compiling=$cross_compiling

and then:

secp256k1/Makefile.am

Lines 129 to 130 in 3f4a5a1

gen_%.o: src/gen_%.c src/libsecp256k1-config.h
$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@

The problem is that this ends up picking up and using OpenBSDs GCC 4.2.1, which barfs when it gets to util.h:

SECP256K1_GNUC_EXT typedef unsigned __int128 uint128_t;

I realise there might not be much that can be done here, given that it's the AX_PROG_CC_FOR_BUILD macro that is returning gcc to use. However thought I'd open an issue here for any thoughts, before we update our docs. I've suggested that affected users can just pass CC_FOR_BUILD=cc to configure when building. Issue here: bitcoin/bitcoin#19559.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions