status-im / nim-chronos

Chronos - An efficient library for asynchronous programming
https://status-im.github.io/nim-chronos/docs/chronos
Apache License 2.0
352 stars 51 forks source link

Can't compile on GCC 14 #527

Closed konradmb closed 2 weeks ago

konradmb commented 3 months ago

Description

GCC 14 introduces a couple of changes, among them - certain warnings are now errors. One of those changes I've stumbled upon now is -Wincompatible-pointer-types (https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types).

Compiling chronos is impossible now because of this error. I've added the resulting error message of running V=1 nimble test on chronos git source.

Workaround: --passC:-Wno-error=incompatible-pointer-types

Error message

build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c: In function ‘sslEngineSetX509__OOZOOZOOZOnimbleZpkgs50Zbearssl4548O50O5045d505156535452ab49e5057485655515753535449515456534853555351e52c5053ccdeZbearsslZabiZbearssl95ssl_u390’:
build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c:1872:42: error: assignment to ‘const br_x509_class **’ {aka ‘const struct br_x509_class_ **’} from incompatible pointer type ‘br_x509_class **’ {aka ‘struct br_x509_class_ **’} [-Wincompatible-pointer-types]
 1872 |         nimln_(616);    (*cc_p0).x509ctx = x509ctx_p1;
      |                                          ^
build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c: In function ‘newTLSClientAsyncStream__testasyncstream_u17122’:
build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c:4993:227: error: passing argument 2 of ‘sslEngineSetX509__OOZOOZOOZOnimbleZpkgs50Zbearssl4548O50O5045d505156535452ab49e5057485655515753535449515456534853555351e52c5053ccdeZbearsslZabiZbearssl95ssl_u390’ from incompatible pointer type [-Wincompatible-pointer-types]
 4993 |                 nimln_(514);            sslEngineSetX509__OOZOOZOOZOnimbleZpkgs50Zbearssl4548O50O5045d505156535452ab49e5057485655515753535449515456534853555351e52c5053ccdeZbearsslZabiZbearssl95ssl_u390((&(*res).ccontext.eng), &(*res).xwc.vtable);
      |                                                                                                                                                                                                                                   ^~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                                                                                   |
      |                                                                                                                                                                                                                                   const br_x509_class ** {aka const struct br_x509_class_ **}
build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c:1870:232: note: expected ‘br_x509_class **’ {aka ‘struct br_x509_class_ **’} but argument is of type ‘const br_x509_class **’ {aka ‘const struct br_x509_class_ **’}
 1870 | static N_INLINE(void, sslEngineSetX509__OOZOOZOOZOnimbleZpkgs50Zbearssl4548O50O5045d505156535452ab49e5057485655515753535449515456534853555351e52c5053ccdeZbearsslZabiZbearssl95ssl_u390)(br_ssl_engine_context* cc_p0, br_x509_class** x509ctx_p1) {
      |                                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~
build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c: In function ‘sslServerSetCache__OOZOOZOOZOnimbleZpkgs50Zbearssl4548O50O5045d505156535452ab49e5057485655515753535449515456534853555351e52c5053ccdeZbearsslZabiZbearssl95ssl_u1292’:
build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c:5704:47: error: assignment to ‘const br_ssl_session_cache_class **’ {aka ‘const struct br_ssl_session_cache_class_ **’} from incompatible pointer type ‘br_ssl_session_cache_class **’ {aka ‘struct br_ssl_session_cache_class_ **’} [-Wincompatible-pointer-types]
 5704 |         nimln_(1226);   (*cc_p0).cache_vtable = vtable_p1;
      |                                               ^
compilation terminated due to -fmax-errors=3.
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread -I/home/konrad/.nimble/pkgs2/bearssl-0.2.2-d238564ab1e29087395561368505753e4c25ccde/bearssl/abi -I/home/konrad/.nimble/pkgs2/bearssl-0.2.2-d238564ab1e29087395561368505753e4c25ccde/bearssl/abi/../csources/src/ -I/home/konrad/.nimble/pkgs2/bearssl-0.2.2-d238564ab1e29087395561368505753e4c25ccde/bearssl/abi/../csources/inc/ -I/home/konrad/.nimble/pkgs2/bearssl-0.2.2-d238564ab1e29087395561368505753e4c25ccde/bearssl/abi/../csources/tools/ -DBR_USE_UNIX_TIME=1 -DBR_USE_URANDOM=1 -DBR_LE_UNALIGNED=1 -DBR_64=1  -DBR_amd64=1 -DBR_INT128=1   -I'/home/konrad/.choosenim/toolchains/nim-#devel/lib' -I'/home/konrad/Kody-źródłowe/nim-chronos/tests' -o build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c.o build/nimcache/testall/@m..@schronos@sstreams@stlsstream.nim.c' failed with exit code: 1

Nim version

Nim Compiler Version 2.1.1 [Linux: amd64] Compiled at 2024-03-22 Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 33902d9dbb65fbfdfbd6e3b2a34c6e19eccb762f active boot switches: -d:release

cheatfate commented 2 weeks ago

This should be fixed at https://github.com/status-im/nim-chronos/commit/1b9d9253e89445d585d0fff39cc0d19254fdfd0d Please do not forget to update nim-bearssl.