ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.81k stars 887 forks source link

Build error on armhf #4719

Open cdecker opened 3 years ago

cdecker commented 3 years ago

Issue and Steps to Reproduce

While building the PPA for armhf the following error was thrown:

closingd/closingd.o closingd/closingd.c
closingd/closingd.c: In function ‘main’:
closingd/closingd.c:694:35: error: ‘receive_offer’ reading 128 bytes from a region of size 32 [-Werror=stringop-overread]
  694 |                                 = receive_offer(pps, chainparams,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  695 |                                                 &channel_id, funding_pubkey,
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  696 |                                                 funding_wscript,
      |                                                 ~~~~~~~~~~~~~~~~
  697 |                                                 scriptpubkey, &funding_txid,
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  698 |                                                 funding_txout, funding,
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~
  699 |                                                 out, opener,
      |                                                 ~~~~~~~~~~~~
  700 |                                                 our_dust_limit,
      |                                                 ~~~~~~~~~~~~~~~
  701 |                                                 min_fee_to_accept,
      |                                                 ~~~~~~~~~~~~~~~~~~
  702 |                                                 wrong_funding,
      |                                                 ~~~~~~~~~~~~~~
  703 |                                                 &closing_txid);
      |                                                 ~~~~~~~~~~~~~~
closingd/closingd.c:694:35: note: referencing argument 4 of type ‘const struct pubkey *’
closingd/closingd.c:211:1: note: in a call to function ‘receive_offer’
  211 | receive_offer(struct per_peer_state *pps,
      | ^~~~~~~~~~~~~
closingd/closingd.c:740:35: error: ‘receive_offer’ reading 128 bytes from a region of size 32 [-Werror=stringop-overread]
  740 |                                 = receive_offer(pps, chainparams, &channel_id,
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  741 |                                                 funding_pubkey,
      |                                                 ~~~~~~~~~~~~~~~
  742 |                                                 funding_wscript,
      |                                                 ~~~~~~~~~~~~~~~~
  743 |                                                 scriptpubkey, &funding_txid,
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  744 |                                                 funding_txout, funding,
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~
  745 |                                                 out, opener,
      |                                                 ~~~~~~~~~~~~
  746 |                                                 our_dust_limit,
      |                                                 ~~~~~~~~~~~~~~~
  747 |                                                 min_fee_to_accept,
      |                                                 ~~~~~~~~~~~~~~~~~~
  748 |                                                 wrong_funding,
      |                                                 ~~~~~~~~~~~~~~
  749 |                                                 &closing_txid);
      |                                                 ~~~~~~~~~~~~~~
closingd/closingd.c:740:35: note: referencing argument 4 of type ‘const struct pubkey *’
closingd/closingd.c:211:1: note: in a call to function ‘receive_offer’
  211 | receive_offer(struct per_peer_state *pps,
      | ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:277: closingd/closingd.o] Error 1

[full logs]

This is at https://github.com/ElementsProject/lightning/tree/v0.10.1

cdecker commented 3 years ago

Interestingly this is detected only on Ubuntu 21.10, which may have a new version of gcc (gcc-11-base armhf 11.2.0-1ubuntu2) so most likely this is just a new warning that was added.

mxrtos commented 2 years ago

I get the same thing in:

❯ $CC --version
arm-unknown-linux-gnueabi-gcc (crosstool-NG 1.24.0.538_a21748b) 11.2.0

Do you happen to know how to ignore this warning? Since it is being treated as an error, it halts my compilation. Thanks.

vincenzopalazzo commented 2 years ago

If you want just to try to compile it, you can remove all the flags at compile time with ./configure BASE_WARNFLAGS=""

mxrtos commented 2 years ago

Hi @vincenzopalazzo , thank you very much! Since I got:

❯ ./configure BASE_WARNFLAGS=""
Unknown option 'BASE_WARNFLAGS='
Usage: ./configure [--reconfigure] [setting=value] [options]
If --reconfigure is specified, config.vars will set defaults.
Default settings:
  CC (default arm-unknown-linux-gnueabi-gcc)
  CWARNFLAGS (default -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition -Werror -Wno-maybe-uninitialized)
  COPTFLAGS (default -Og)
  CDEBUGFLAGS (default -std=gnu11 -g -fstack-protector-strong)
  CONFIGURATOR_CC (default arm-unknown-linux-gnueabi-gcc)
    To override compile line for configurator itself

I used this instead:

./configure CWARNFLAGS=""

Thanks for opening my eyes to this flag.

vincenzopalazzo commented 2 years ago

@mxrtos sorry the suggestion contains a copy and paste typo, I hope you fix it :)