Tongsuo
Tongsuo copied to clipboard
8.3.0 在 tengine 中编译报错 C90 不支持的写法
构建环境: docker centos:7.6.1810 gcc 4.8.5
gcc -Iinclude -m64 -Wa,--noexecstack -Wall -O3 -DDEBUG_UNUSED -DPEDANTIC -pedantic -Wno-long-long -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wswitch -Wsign-compare -Wshadow -Wformat -Wtype-limits -Wundef -Werror -Wmissing-prototypes -Wstrict-prototypes -DNDEBUG -MMD -MF test/igetest.d.tmp -MT test/igetest.o -c -o test/igetest.o test/igetest.c
test/ec_elgamal_internal_test.c: In function 'ec_elgamal_test':
test/ec_elgamal_internal_test.c:198:5: error: ISO C90 forbids mixed declarations and code [-Werror=pedantic]
int ret = 0;
^
test/ec_elgamal_internal_test.c:201:5: error: C++ style comments are not allowed in ISO C90 [-Werror]
//uint32_t p1 = 2000000021, p2 = 500, m = 800, r;
^
test/ec_elgamal_internal_test.c:201:5: error: (this will be reported only once per input file) [-Werror]
cc1: all warnings being treated as errors
make[3]: *** [test/ec_elgamal_internal_test.o] Error 1
make[3]: *** Waiting for unfinished jobs....
test/ec_elgamal_internal_test.c:201 这行注释忘记删除了,你把这行删除了试试。
为啥BabaSSL自己的CI不报错?
test/ec_elgamal_internal_test.c:201 这行注释忘记删除了,你把这行删除了试试。
不只是注释的问题,是C90不支持这些写法。
@xuyang2 可以换个编译选项?
可以发一下完整的tengine构建命令
可能是 centos7 软件源里的 gcc 4.8.5 版本太低,默认是 C90 的缘故。
换用 quay.io/pypa/manylinux2014_x86_64 镜像和新版本工具链构建成功了,
完整的 tengine 构建命令(configure参数) 见如下 tengine -V
输出:
[root@931f6d4ea894 tengine]# ./sbin/tengine -V
Tengine version: Tengine/2.3.3
nginx version: nginx/1.18.0
built by gcc 10.2.1 20210130 (Red Hat 10.2.1-11) (GCC)
built with OpenSSL 1.1.1h 22 Sep 2020
TLS SNI support enabled
configure arguments: --prefix=/opt/tengine --sbin-path=/opt/tengine/sbin/tengine --with-pcre=/ci/pcre-8.45 --with-pcre-opt='-DSUPPORT_UTF -DSUPPORT_UCP' --with-zlib=/ci/zlib-1.2.11 --add-module=modules/ngx_openssl_ntls --with-openssl=/ci/BabaSSL --with-openssl-opt='--strict-warnings enable-ntls' --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads
[root@931f6d4ea894 tengine]# ldd ./sbin/tengine
linux-vdso.so.1 => (0x00007ffcac29f000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd08f249000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd08f02d000)
libcrypt.so.2 => /usr/local/lib/libcrypt.so.2 (0x00007fd08f62b000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd08ec5f000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd08f44d000)
不过上游 openssl 现在貌似还是兼容到 C90
- https://www.openssl.org/policies/codingstyle.txt
- https://github.com/openssl/openssl/issues/9928