babelouest / rhonabwy

Javascript Object Signing and Encryption (JOSE) library - JWK, JWKS, JWS, JWE and JWT
https://babelouest.github.io/rhonabwy/
GNU Lesser General Public License v2.1
45 stars 21 forks source link

Build failed on FreeBSD-14 which use clang15 as cc #29

Open wenheping opened 1 year ago

wenheping commented 1 year ago

the failed build log:

===> Building for rhonabwy-1.1.11 [ 25% 1/4] /usr/bin/cc -Drhonabwy_EXPORTS -I/usr/local/include -I/usr/ports/security/rhonabwy/work/rhonabwy-1.1.11/include -I/usr/ports/security/rhonabwy/work/.build -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wall -Werror -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -std=gnu99 -fPIC -Wextra -Wconversion -MD -MT CMakeFiles/rhonabwy.dir/src/jwe.c.o -MF CMakeFiles/rhonabwy.dir/src/jwe.c.o.d -o CMakeFiles/rhonabwy.dir/src/jwe.c.o -c /usr/ports/security/rhonabwy/work/rhonabwy-1.1.11/src/jwe.c FAILED: CMakeFiles/rhonabwy.dir/src/jwe.c.o /usr/bin/cc -Drhonabwy_EXPORTS -I/usr/local/include -I/usr/ports/security/rhonabwy/work/rhonabwy-1.1.11/include -I/usr/ports/security/rhonabwy/work/.build -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wall -Werror -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -std=gnu99 -fPIC -Wextra -Wconversion -MD -MT CMakeFiles/rhonabwy.dir/src/jwe.c.o -MF CMakeFiles/rhonabwy.dir/src/jwe.c.o.d -o CMakeFiles/rhonabwy.dir/src/jwe.c.o -c /usr/ports/security/rhonabwy/work/rhonabwy-1.1.11/src/jwe.c In file included from /usr/ports/security/rhonabwy/work/rhonabwy-1.1.11/src/jwe.c:47: In file included from /usr/local/include/nettle/bignum.h:50: /usr/local/include/gmp.h:1875:30: error: operand of ? changes signedness: 'const int' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion] return __GMP_ABS (__gmp_z->_mp_size);


/usr/local/include/gmp.h:446:37: note: expanded from macro '__GMP_ABS'
#define __GMP_ABS(x)   ((x) >= 0 ? (x) : -(x))
                                    ^
/usr/local/include/gmp.h:1875:10: error: operand of ? changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
  return __GMP_ABS (__gmp_z->_mp_size);
  ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:446:42: note: expanded from macro '__GMP_ABS'
#define __GMP_ABS(x)   ((x) >= 0 ? (x) : -(x))
                                         ^~~~
2 errors generated.
ninja: build stopped: subcommand failed.

Any suggestion ?
babelouest commented 1 year ago

It seems that clang has issues with the -Wextra -Wconversion flag, but I don't know if rhonabwy can do something about that.

As a workaround, you can try to disable the extra warnings in the cmake script here: https://github.com/babelouest/rhonabwy/blob/master/CMakeLists.txt#L170