status-im / nimbus-eth2

Nim implementation of the Ethereum Beacon Chain
https://nimbus.guide
Other
501 stars 210 forks source link

build error: incompatible pointer type #6320

Open julienmartinlevrai opened 1 month ago

julienmartinlevrai commented 1 month ago

Description When building from source, the command make -j4 nimbus_beacon_node fails with a compilation error in dependency nim-stint:

error: passing argument 4 of ‘_subborrow_u64’ from incompatible pointer type

To Reproduce Just follow the normal steps to build from source:

$ git clone https://github.com/status-im/nimbus-eth2
$ cd nimbus-eth2/
$ make -j4 nimbus_beacon_node

Tested with v24.5.1, v24.5.0 and v24.4.0, all yield the same results. Using up-to-date Arch Linux on a 2021 Intel NUC.

Results

$ make -j4 nimbus_beacon_node
Git submodules not found. Running 'git -c lfs.fetchexclude=/public-keys/all.txt,/custom_config_data/genesis.ssz submodule update --init --recursive'.
[omitting the rest of this git operation]

Building: install/usr/lib/libbacktrace.a
Building: Nim compiler
Building: install/usr/lib/libbacktracenim.a
Building: build/generate_makefile
Build completed successfully: build/generate_makefile
Building: build/nimbus_beacon_node
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/transports/tcptransport.nim(50, 57) template/generic instantiation of `async` from here
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/transports/tcptransport.nim(103, 10) template/generic instantiation of `setResult` from here
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/transports/tcptransport.nim(65, 20) template/generic instantiation of `async` from here
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/transports/tcptransport.nim(89, 25) template/generic instantiation of `error` from here
/root/bin/test/nimbus-eth2/vendor/nim-chronos/chronos/internal/raisesfutures.nim(241, 12) Warning: No exceptions possible with this operation, `error` always returns nil [User]
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/transports/tcptransport.nim(163, 36) template/generic instantiation of `async` from here
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/transports/tcptransport.nim(169, 17) template/generic instantiation of `checkFutures` from here
/root/bin/test/nimbus-eth2/vendor/nim-libp2p/libp2p/errors.nim(30, 24) template/generic instantiation of `readError` from here
/root/bin/test/nimbus-eth2/vendor/nim-chronos/chronos/internal/raisesfutures.nim(247, 12) Warning: No exceptions possible with this operation, `readError` always raises [User]
/root/bin/test/nimbus-eth2/beacon_chain/nimbus_beacon_node.nim(1935, 3) Warning: use exitprocs.addExitProc; addQuitProc is deprecated [Deprecated]
/root/bin/test/nimbus-eth2/beacon_chain/nimbus_beacon_node.nim(2152, 7) Warning: Please use MetricsHttpServerRef API; startMetricsHttpServer is deprecated [Deprecated]
/root/bin/test/nimbus-eth2/vendor/nim-stint/stint/private/primitives/addcarry_subborrow.nim: In function ‘_ZN18addcarry_subborrow4subBE3varI5uInt8E3varI6uInt64E6uInt646uInt645uInt8’:
/root/bin/test/nimbus-eth2/vendor/nim-stint/stint/private/primitives/addcarry_subborrow.nim:171:38: error: passing argument 4 of ‘_subborrow_u64’ from incompatible pointer type [-Wincompatible-pointer-types]
  171 |       bOut = subborrow_u64(bIn, a, b, diff)
      |                                      ^~~~
      |                                      |
      |                                      NU64 * {aka long unsigned int *}
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/x86gprintrin.h:39,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/x86intrin.h:27,
                 from /root/bin/test/nimbus-eth2/nimcache/release/nimbus_beacon_node/@m..@svendor@snimbus-build-system@svendor@sNim@slib@ssystem.nim.c:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/adxintrin.h:59:61: note: expected ‘long long unsigned int *’ but argument is of type ‘NU64 *’ {aka ‘long unsigned int *’}
   59 |                 unsigned long long __Y, unsigned long long *__P)
      |                                         ~~~~~~~~~~~~~~~~~~~~^~~
make[1]: *** [nimcache/release/nimbus_beacon_node/nimbus_beacon_node.makefile:998: /root/bin/test/nimbus-eth2/nimcache/release/nimbus_beacon_node/@m..@svendor@snimbus-build-system@svendor@sNim@slib@ssystem.nim.c.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:447: nimbus_beacon_node] Error 2

Full, unmodified output: https://pastebin.com/SsqbBnn5

Additional context v24.4.0 compiled well on my machine a few weeks ago when it was released. When I tried to compile v24.5.1 a few days ago, this compilation error happened, and after trying multiple things, I realized it was now happening on v24.4.0 as well. This might suggest the issue is on my side. However, this is a dedicated hardware for running a full node and not much else.

tersec commented 1 month ago

Yes, it's a gcc 14 incompatibility. https://github.com/status-im/nim-stint/pull/153 resolves the nim-stint issue in isolation, but it's not the only part of this. We're working on resolving this.

tersec commented 4 days ago

The remaining issue here is the KZG library. The fix for that did not make it into the upcoming release (v24.6), so overall this still won't work, but the problem won't be nim-stint anymore.

Keeping issue open because it'll still be an incompatible pointer type error though.