ElementsProject / lightning

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

Build error on OpenBSD -current #4044

Closed grubles closed 4 years ago

grubles commented 4 years ago

Issue and Steps to Reproduce

Compiling v0.9.0-1 fails due to the following error when using using OpenBSD clang version 10.0.1:

lightningd/plugin.c:1231:6: error: expected identifier or '('
        int stdin, stdout;
            ^
/usr/include/stdio.h:197:16: note: expanded from macro 'stdin'
#define stdin   (&__sF[0])
                 ^
lightningd/plugin.c:1231:6: error: expected ')'
/usr/include/stdio.h:197:16: note: expanded from macro 'stdin'
#define stdin   (&__sF[0])
                 ^
lightningd/plugin.c:1231:6: note: to match this '('
/usr/include/stdio.h:197:15: note: expanded from macro 'stdin'
#define stdin   (&__sF[0])
                ^
lightningd/plugin.c:1244:22: error: cannot take the address of an rvalue of type 'FILE *' (aka 'struct __sFILE *')
        p->pid = pipecmdarr(&stdin, &stdout, &pipecmd_preserve, cmd);
                            ^~~~~~
lightningd/plugin.c:1244:30: error: cannot take the address of an rvalue of type 'FILE *' (aka 'struct __sFILE *')
        p->pid = pipecmdarr(&stdin, &stdout, &pipecmd_preserve, cmd);
                                    ^~~~~~~
lightningd/plugin.c:1253:19: error: incompatible pointer to integer conversion passing 'FILE *' (aka 'struct __sFILE *') to parameter of type 'int'
      [-Werror,-Wint-conversion]
        p->stdout_conn = io_new_conn(p, stdout, plugin_stdout_conn_init, p);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ccan/ccan/io/io.h:59:22: note: expanded from macro 'io_new_conn'
        io_new_conn_((ctx), (fd),                                       \
                            ^~~~
ccan/ccan/io/io.h:65:52: note: passing argument to parameter 'fd' here
struct io_conn *io_new_conn_(const tal_t *ctx, int fd,
                                                   ^
lightningd/plugin.c:1254:18: error: incompatible pointer to integer conversion passing 'FILE *' (aka 'struct __sFILE *') to parameter of type 'int'
      [-Werror,-Wint-conversion]
        p->stdin_conn = io_new_conn(p, stdin, plugin_stdin_conn_init, p);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ccan/ccan/io/io.h:59:22: note: expanded from macro 'io_new_conn'
        io_new_conn_((ctx), (fd),                                       \
                            ^~~~
ccan/ccan/io/io.h:65:52: note: passing argument to parameter 'fd' here
struct io_conn *io_new_conn_(const tal_t *ctx, int fd,
                                                   ^
6 errors generated.
gmake: *** [Makefile:250: lightningd/plugin.o] Error 1
rm external/amd64-unknown-openbsd6.8/libwally-core-build/src/secp256k1/libsecp256k1.la
bsd$ 
rustyrussell commented 4 years ago

Wow, they made stdin a macro. Gah!

Will fix.

rustyrussell commented 4 years ago

Does that fix it?

grubles commented 4 years ago

Yes, plugin.c now compiles, but there is another error that seems unrelated.

cc common/amount.c
common/amount.c:306:15: error: implicit conversion from 'unsigned long long' to
      'double' changes value from 18446744073709551615 to 18446744073709551616
      [-Werror,-Wimplicit-int-float-conversion]
        if (scaled > UINT64_MAX)
                   ~ ^~~~~~~~~~
/usr/include/sys/stdint.h:123:21: note: expanded from macro 'UINT64_MAX'
#define UINT64_MAX              0xffffffffffffffffULL
                                ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake: *** [Makefile:254: common/amount.o] Error 1
bsd$ 
rustyrussell commented 4 years ago

This time for sure!

grubles commented 4 years ago
2020-09-13T15:37:35.361Z INFO    lightningd: Server started with public key 0358634b7326fb5a579b44bc8dca5c22587aca9340b0603eb2d25a720f3fe41a08, alias ODDGOPHER (color #035863) and lightningd v0.9.1rc2-2-g096976e-modded

Working!