build error with secp256k1 on OSX #20351

issue Yihen-Liu opened this issue on November 9, 2020
  1. Yihen-Liu commented at 3:48 AM on November 9, 2020: none

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

    <!-- Describe the issue -->

    I follow the build-osx.md to build the bitcoin step by step. However, the error occured.

    Expected behavior NO ERROR.

    <!--- What behavior did you expect? -->

    Actual behavior A lot of ERROR printed as follow:

    $ make
    Making all in src
    make[1]: Entering directory '/Users/geeker/workspace/clang/bitcoin/src'
    make[2]: Entering directory '/Users/geeker/workspace/clang/bitcoin/src'
    make[3]: Entering directory '/Users/geeker/workspace/clang/bitcoin'
    cd . && /bin/sh ./config.status src/config/bitcoin-config.h
    config.status: creating src/config/bitcoin-config.h
    make[3]: Leaving directory '/Users/geeker/workspace/clang/bitcoin'
    make[3]: Entering directory '/Users/geeker/workspace/clang/bitcoin'
    make[3]: Leaving directory '/Users/geeker/workspace/clang/bitcoin'
      CXX      bitcoind-bitcoind.o
      CXX      libbitcoin_server_a-addrdb.o
      CXX      libbitcoin_server_a-addrman.o
      CXX      libbitcoin_server_a-banman.o
      CXX      libbitcoin_server_a-blockencodings.o
      CXX      libbitcoin_server_a-blockfilter.o
      CXX      libbitcoin_server_a-chain.o
      CXX      consensus/libbitcoin_server_a-tx_verify.o
      CXX      libbitcoin_server_a-dbwrapper.o
      CXX      libbitcoin_server_a-flatfile.o
      CXX      libbitcoin_server_a-httprpc.o
      CXX      libbitcoin_server_a-httpserver.o
      CXX      index/libbitcoin_server_a-base.o
      CXX      index/libbitcoin_server_a-blockfilterindex.o
      CXX      index/libbitcoin_server_a-txindex.o
      CXX      libbitcoin_server_a-init.o
      CXX      interfaces/libbitcoin_server_a-chain.o
      CXX      interfaces/libbitcoin_server_a-node.o
      CXX      libbitcoin_server_a-miner.o
      CXX      libbitcoin_server_a-net.o
      CXX      libbitcoin_server_a-net_processing.o
      CXX      node/libbitcoin_server_a-coin.o
      CXX      node/libbitcoin_server_a-coinstats.o
      CXX      node/libbitcoin_server_a-context.o
      CXX      node/libbitcoin_server_a-psbt.o
      CXX      node/libbitcoin_server_a-transaction.o
      CXX      libbitcoin_server_a-noui.o
      CXX      policy/libbitcoin_server_a-fees.o
      CXX      policy/libbitcoin_server_a-rbf.o
      CXX      policy/libbitcoin_server_a-settings.o
      CXX      libbitcoin_server_a-pow.o
      CXX      libbitcoin_server_a-rest.o
      CXX      rpc/libbitcoin_server_a-blockchain.o
      CXX      rpc/libbitcoin_server_a-mining.o
      CXX      rpc/libbitcoin_server_a-misc.o
      CXX      rpc/libbitcoin_server_a-net.o
      CXX      rpc/libbitcoin_server_a-rawtransaction.o
      CXX      rpc/libbitcoin_server_a-server.o
      CXX      script/libbitcoin_server_a-sigcache.o
      CXX      libbitcoin_server_a-signet.o
      CXX      libbitcoin_server_a-timedata.o
      CXX      libbitcoin_server_a-torcontrol.o
      CXX      libbitcoin_server_a-txdb.o
      CXX      libbitcoin_server_a-txrequest.o
      CXX      libbitcoin_server_a-txmempool.o
      CXX      libbitcoin_server_a-validation.o
      CXX      libbitcoin_server_a-validationinterface.o
      CXX      libbitcoin_server_a-versionbits.o
      CXX      wallet/libbitcoin_server_a-init.o
      AR       libbitcoin_server.a
      CXX      interfaces/libbitcoin_wallet_a-wallet.o
      CXX      wallet/libbitcoin_wallet_a-bdb.o
      CXX      wallet/libbitcoin_wallet_a-coincontrol.o
      CXX      wallet/libbitcoin_wallet_a-crypter.o
      CXX      wallet/libbitcoin_wallet_a-db.o
      CXX      wallet/libbitcoin_wallet_a-feebumper.o
      CXX      wallet/libbitcoin_wallet_a-fees.o
      CXX      wallet/libbitcoin_wallet_a-load.o
      CXX      wallet/libbitcoin_wallet_a-rpcdump.o
      CXX      wallet/libbitcoin_wallet_a-rpcwallet.o
      CXX      wallet/libbitcoin_wallet_a-salvage.o
      CXX      wallet/libbitcoin_wallet_a-scriptpubkeyman.o
      CXX      wallet/libbitcoin_wallet_a-wallet.o
      CXX      wallet/libbitcoin_wallet_a-walletdb.o
      CXX      wallet/libbitcoin_wallet_a-walletutil.o
      CXX      wallet/libbitcoin_wallet_a-coinselection.o
      CXX      wallet/libbitcoin_wallet_a-sqlite.o
      AR       libbitcoin_wallet.a
      CXX      libbitcoin_common_a-base58.o
      CXX      libbitcoin_common_a-bloom.o
      CXX      libbitcoin_common_a-chainparams.o
      CXX      libbitcoin_common_a-coins.o
      CXX      libbitcoin_common_a-compressor.o
      CXX      libbitcoin_common_a-core_read.o
      CXX      libbitcoin_common_a-core_write.o
      CXX      libbitcoin_common_a-key.o
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:170:9: warning: 'SECP256K1_CONTEXT_VERIFY' macro redefined [-Wmacro-redefined]
    #define SECP256K1_CONTEXT_VERIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY)
            ^
    /usr/local/include/secp256k1.h:53:10: note: previous definition is here
    # define SECP256K1_CONTEXT_VERIFY (1 << 0)
             ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:171:9: warning: 'SECP256K1_CONTEXT_SIGN' macro redefined [-Wmacro-redefined]
    #define SECP256K1_CONTEXT_SIGN (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN)
            ^
    /usr/local/include/secp256k1.h:54:10: note: previous definition is here
    # define SECP256K1_CONTEXT_SIGN   (1 << 1)
             ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:204:34: error: conflicting types for 'secp256k1_context_create'
    SECP256K1_API secp256k1_context* secp256k1_context_create(
                                     ^
    /usr/local/include/secp256k1.h:62:22: note: previous declaration is here
    secp256k1_context_t* secp256k1_context_create(
                         ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:467:48: error: conflicting types for 'secp256k1_ecdsa_verify'
    SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(
                                                   ^
    /usr/local/include/secp256k1.h:93:34: note: previous declaration is here
    SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(
                                     ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:526:53: error: redeclaration of 'secp256k1_nonce_function_rfc6979' with a different type:
          'const secp256k1_nonce_function' (aka 'int (*const)(unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *,
          void *, unsigned int)') vs 'const secp256k1_nonce_function_t' (aka 'int (*const)(unsigned char *, const unsigned char *, const unsigned
          char *, unsigned int, const void *)')
    SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_rfc6979;
                                                        ^
    /usr/local/include/secp256k1.h:126:41: note: previous declaration is here
    extern const secp256k1_nonce_function_t secp256k1_nonce_function_rfc6979;
                                            ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:529:53: error: redeclaration of 'secp256k1_nonce_function_default' with a different type:
          'const secp256k1_nonce_function' (aka 'int (*const)(unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *,
          void *, unsigned int)') vs 'const secp256k1_nonce_function_t' (aka 'int (*const)(unsigned char *, const unsigned char *, const unsigned
          char *, unsigned int, const void *)')
    SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_default;
                                                        ^
    /usr/local/include/secp256k1.h:129:41: note: previous declaration is here
    extern const secp256k1_nonce_function_t secp256k1_nonce_function_default;
                                            ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:545:19: error: conflicting types for 'secp256k1_ecdsa_sign'
    SECP256K1_API int secp256k1_ecdsa_sign(
                      ^
    /usr/local/include/secp256k1.h:171:5: note: previous declaration is here
    int secp256k1_ecdsa_sign(
        ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:579:48: error: conflicting types for 'secp256k1_ec_pubkey_create'
    SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(
                                                   ^
    /usr/local/include/secp256k1.h:277:34: note: previous declaration is here
    SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(
                                     ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:662:48: error: conflicting types for 'secp256k1_ec_pubkey_tweak_add'
    SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(
                                                   ^
    /usr/local/include/secp256k1.h:329:34: note: previous declaration is here
    SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(
                                     ^
    In file included from key.cpp:13:
    In file included from ./secp256k1/include/secp256k1_recovery.h:4:
    ./secp256k1/include/secp256k1.h:707:48: error: conflicting types for 'secp256k1_ec_pubkey_tweak_mul'
    SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul(
                                                   ^
    /usr/local/include/secp256k1.h:346:34: note: previous declaration is here
    SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul(
                                     ^
    key.cpp:219:15: error: no matching function for call to 'secp256k1_ecdsa_sign'
        int ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, (!grind && te...
                  ^~~~~~~~~~~~~~~~~~~~
    ./secp256k1/include/secp256k1.h:545:19: note: candidate function not viable: no known conversion from 'const secp256k1_nonce_function_t' (aka
          'int (*const)(unsigned char *, const unsigned char *, const unsigned char *, unsigned int, const void *)') to 'secp256k1_nonce_function'
          (aka 'int (*)(unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *, void *, unsigned int)') for 5th
          argument
    SECP256K1_API int secp256k1_ecdsa_sign(
                      ^
    /usr/local/include/secp256k1.h:171:5: note: candidate function not viable: requires 7 arguments, but 6 were provided
    int secp256k1_ecdsa_sign(
        ^
    key.cpp:224:15: error: no matching function for call to 'secp256k1_ecdsa_sign'
            ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, extra_entropy);
                  ^~~~~~~~~~~~~~~~~~~~
    ./secp256k1/include/secp256k1.h:545:19: note: candidate function not viable: no known conversion from 'const secp256k1_nonce_function_t' (aka
          'int (*const)(unsigned char *, const unsigned char *, const unsigned char *, unsigned int, const void *)') to 'secp256k1_nonce_function'
          (aka 'int (*)(unsigned char *, const unsigned char *, const unsigned char *, const unsigned char *, void *, unsigned int)') for 5th
          argument
    SECP256K1_API int secp256k1_ecdsa_sign(
                      ^
    /usr/local/include/secp256k1.h:171:5: note: candidate function not viable: requires 7 arguments, but 6 were provided
    int secp256k1_ecdsa_sign(
        ^
    key.cpp:252:15: error: no matching function for call to 'secp256k1_ecdsa_sign_recoverable'
        int ret = secp256k1_ecdsa_sign_recoverable(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, nullptr);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ./secp256k1/include/secp256k1_recovery.h:81:19: note: candidate function not viable: no known conversion from
          'const secp256k1_nonce_function_t' (aka 'int (*const)(unsigned char *, const unsigned char *, const unsigned char *, unsigned int, const
          void *)') to 'secp256k1_nonce_function' (aka 'int (*)(unsigned char *, const unsigned char *, const unsigned char *, const unsigned char
          *, void *, unsigned int)') for 5th argument
    SECP256K1_API int secp256k1_ecdsa_sign_recoverable(
                      ^
    2 warnings and 11 errors generated.
    make[2]: *** [Makefile:11194: libbitcoin_common_a-key.o] Error 1
    make[2]: Leaving directory '/Users/geeker/workspace/clang/bitcoin/src'
    make[1]: *** [Makefile:19246: all-recursive] Error 1
    make[1]: Leaving directory '/Users/geeker/workspace/clang/bitcoin/src'
    make: *** [Makefile:801: all-recursive] Error 1
    

    <!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

    To reproduce

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    System information osx version: 10.15.7; clang/clang++ version: 12.0.0; bitcoin version: commit-id is 218fe60d91a9190aa0ee561479044df368214766

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

  2. Yihen-Liu added the label Bug on Nov 9, 2020
  3. Yihen-Liu renamed this:
    build error with secp256k1
    build error with secp256k1 on OSX
    on Nov 9, 2020
  4. MarcoFalke commented at 7:36 AM on November 9, 2020: member

    Does make distclean help?

  5. MarcoFalke closed this on Nov 9, 2020

  6. MarcoFalke reopened this on Nov 9, 2020

  7. fanquake deleted a comment on Nov 9, 2020
  8. Yihen-Liu commented at 10:20 AM on November 9, 2020: none

    @MarcoFalke Thanks for your information. I have tried, but it does not work. the same ERROR happen again.

  9. MarcoFalke added the label macOS on Nov 9, 2020
  10. hebasto commented at 8:51 PM on November 10, 2020: member

    @Yihen I'm wondering how the secp256k1.h header was placed into the /usr/local/include/ directory?

  11. Yihen-Liu commented at 2:23 AM on November 11, 2020: none

    @hebasto
    $ ll /usr/local/include/secp256k1.h -rw-r--r-- 1 geeker admin 25K Jan 18 2018 /usr/local/include/secp256k1.h

    secp256k1.h header was installed in 2018, however, I found that https://github.com/bitcoin-core/secp256k1 update frequently. Does I NEED to update it following the bitcoin-core/secp256k1?

  12. sipa commented at 2:24 AM on November 11, 2020: member

    It shouldn't be using your locally installed libsecp256k1 at all.

  13. Yihen-Liu commented at 2:32 AM on November 11, 2020: none

    @sipa So nice of you to remind me. Will you please to give me more information about how to handle it? If I install bitcoin-core/secp256k1 by its README.md, I worry about that bitcoin-core/secp256k1 will cover my locally installed.

  14. sipa commented at 2:40 AM on November 11, 2020: member

    I mean: the fact that it is using a locally installed version is a bug, and we should fix it. Bitcoin Core comes with its own bundled libsecp256k1, and it should only use that.

    I can't help you with specifics of fixing this, as I'm not familiar with macos. Either removing the local version or installing a sufficiently recent libsecp256k1 version locally would work of course, but that'd overwrite the version you currently have. Neither should be necessary.

  15. hebasto commented at 3:30 AM on November 11, 2020: member

    I mean: the fact that it is using a locally installed version is a bug, and we should fix it. Bitcoin Core comes with its own bundled libsecp256k1, and it should only use that. @Yihen If your locally installed version of libsecp256k1 is used for Bitcoin Core only, remove it, and try to build again.

  16. Yihen-Liu commented at 3:33 AM on November 11, 2020: none

    @hebasto ,Thanks for your suggestion that works. shell script as follow:

    #! /bin/bash mv /usr/local/include/secp256k1.h /usr/local/include/secp256k1.bak.h make distclean ./autogen.sh ./configure --without-gui rm compile_commands.json bear make mv /usr/local/include/secp256k1.bak.h /usr/local/include/secp256k1.h

  17. Yihen-Liu closed this on Nov 11, 2020

  18. hebasto commented at 7:37 AM on November 11, 2020: member

    I mean: the fact that it is using a locally installed version is a bug, and we should fix it. Bitcoin Core comes with its own bundled libsecp256k1, and it should only use that.

    ~Fixed in #20366.~

  19. hebasto commented at 9:25 AM on November 25, 2020: member

    Fixed in #20469.

  20. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me