openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4.01k stars 3.48k forks source link

nginx-util: fail to compile on GCC 13 #20961

Open EdiTurn opened 1 year ago

EdiTurn commented 1 year ago

When choose to use GCC 13 in make menuconfig, nginx-util fail to compile.

make[2]: Entering directory '/home/editurn/openwrt/openwrt/feeds/packages/net/nginx-util'
rm -f /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/.built
touch /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/.built_check
MAKEFLAGS="" /home/editurn/openwrt/openwrt/staging_dir/host/bin/ninja  -j1 -C /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6
ninja: Entering directory `/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6'
[1/4] Building CXX object CMakeFiles/nginx-ssl-util.dir/nginx-util.cpp.o
FAILED: CMakeFiles/nginx-ssl-util.dir/nginx-util.cpp.o
/home/editurn/openwrt/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/bin/x86_64-openwrt-linux-musl-g++ -DVERSION=1.6  -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6=nginx-util-1.6 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Wno-error=deprecated-declarations -DNDEBUG -std=gnu++17   -Os -Wall -Werror -Wextra -g3 -Wno-unused-parameter -Wmissing-declarations -Wshadow -MD -MT CMakeFiles/nginx-ssl-util.dir/nginx-util.cpp.o -MF CMakeFiles/nginx-ssl-util.dir/nginx-util.cpp.o.d -o CMakeFiles/nginx-ssl-util.dir/nginx-util.cpp.o -c /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-util.cpp
In file included from /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-ssl-util.hpp:12,
                 from /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-util.cpp:4:
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp: In function 'EVP_PKEY_ptr gen_eckey(int)':
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:94:29: warning: 'EC_KEY* EC_KEY_new()' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   94 |     auto* eckey = EC_KEY_new();
      |                   ~~~~~~~~~~^~
In file included from /home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/x509.h:33,
                 from /home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/pem.h:23,
                 from /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:8:
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/ec.h:968:31: note: declared here
  968 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void);
      |                               ^~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:97:30: warning: 'int EC_KEY_set_group(EC_KEY*, const EC_GROUP*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   97 |         if ((EC_KEY_set_group(eckey, group) == 0) || (EC_KEY_generate_key(eckey) == 0)) {
      |              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/ec.h:1042:27: note: declared here
 1042 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
      |                           ^~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:97:74: warning: 'int EC_KEY_generate_key(EC_KEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   97 |         if ((EC_KEY_set_group(eckey, group) == 0) || (EC_KEY_generate_key(eckey) == 0)) {
      |                                                       ~~~~~~~~~~~~~~~~~~~^~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/ec.h:1101:27: note: declared here
 1101 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_generate_key(EC_KEY *key);
      |                           ^~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:98:24: warning: 'void EC_KEY_free(EC_KEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   98 |             EC_KEY_free(eckey);
      |             ~~~~~~~~~~~^~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/ec.h:1003:28: note: declared here
 1003 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:117:20: warning: 'void EC_KEY_free(EC_KEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  117 |         EC_KEY_free(eckey);
      |         ~~~~~~~~~~~^~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/ec.h:1003:28: note: declared here
 1003 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp: In function 'EVP_PKEY_ptr gen_rsakey(int, long unsigned int)':
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:142:24: warning: 'RSA* RSA_new()' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  142 |     auto* rsa = RSA_new();
      |                 ~~~~~~~^~
In file included from /home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/x509.h:36:
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/rsa.h:201:28: note: declared here
  201 | OSSL_DEPRECATEDIN_3_0 RSA *RSA_new(void);
      |                            ^~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:146:33: warning: 'int RSA_generate_key_ex(RSA*, int, BIGNUM*, BN_GENCB*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  146 |             (RSA_generate_key_ex(rsa, keysize, bignum, nullptr) == 0))
      |              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/rsa.h:260:27: note: declared here
  260 | OSSL_DEPRECATEDIN_3_0 int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
      |                           ^~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:148:21: warning: 'void RSA_free(RSA*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  148 |             RSA_free(rsa);
      |             ~~~~~~~~^~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/rsa.h:293:28: note: declared here
  293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
      |                            ^~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:168:17: warning: 'void RSA_free(RSA*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  168 |         RSA_free(rsa);
      |         ~~~~~~~~^~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/rsa.h:293:28: note: declared here
  293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
      |                            ^~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp: In function 'void write_key(const EVP_PKEY_ptr&, const std::string&, bool)':
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:222:81: warning: 'const ec_key_st* EVP_PKEY_get0_EC_KEY(const EVP_PKEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  222 |             len = use_pem ? PEM_write_bio_ECPrivateKey(bio, EVP_PKEY_get0_EC_KEY(key), nullptr,
      |                                                             ~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/pem.h:22:
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/evp.h:1372:25: note: declared here
 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);
      |                         ^~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:222:55: warning: 'int PEM_write_bio_ECPrivateKey(BIO*, const EC_KEY*, const EVP_CIPHER*, const unsigned char*, int, int (*)(char*, int, int, void*), void*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  222 |             len = use_pem ? PEM_write_bio_ECPrivateKey(bio, EVP_PKEY_get0_EC_KEY(key), nullptr,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223 |                                                        nullptr, 0, nullptr, nullptr)
      |                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/pem.h:462:1: note: declared here
  462 | DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, ECPrivateKey, EC_KEY)
      | ^~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:224:75: warning: 'const ec_key_st* EVP_PKEY_get0_EC_KEY(const EVP_PKEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  224 |                           : i2d_ECPrivateKey_bio(bio, EVP_PKEY_get0_EC_KEY(key));
      |                                                       ~~~~~~~~~~~~~~~~~~~~^~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/evp.h:1372:25: note: declared here
 1372 | const struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);
      |                         ^~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:224:49: warning: 'int i2d_ECPrivateKey_bio(BIO*, const EC_KEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  224 |                           : i2d_ECPrivateKey_bio(bio, EVP_PKEY_get0_EC_KEY(key));
      |                             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/x509.h:637:27: note: declared here
  637 | OSSL_DEPRECATEDIN_3_0 int i2d_ECPrivateKey_bio(BIO *bp, const EC_KEY *eckey);
      |                           ^~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:227:79: warning: 'const rsa_st* EVP_PKEY_get0_RSA(const EVP_PKEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  227 |             len = use_pem ? PEM_write_bio_RSAPrivateKey(bio, EVP_PKEY_get0_RSA(key), nullptr,
      |                                                              ~~~~~~~~~~~~~~~~~^~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/evp.h:1346:22: note: declared here
 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
      |                      ^~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:227:56: warning: 'int PEM_write_bio_RSAPrivateKey(BIO*, const RSA*, const EVP_CIPHER*, const unsigned char*, int, int (*)(char*, int, int, void*), void*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  227 |             len = use_pem ? PEM_write_bio_RSAPrivateKey(bio, EVP_PKEY_get0_RSA(key), nullptr,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  228 |                                                         nullptr, 0, nullptr, nullptr)
      |                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/pem.h:447:1: note: declared here
  447 | DECLARE_PEM_rw_cb_attr(OSSL_DEPRECATEDIN_3_0, RSAPrivateKey, RSA)
      | ^~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:229:73: warning: 'const rsa_st* EVP_PKEY_get0_RSA(const EVP_PKEY*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  229 |                           : i2d_RSAPrivateKey_bio(bio, EVP_PKEY_get0_RSA(key));
      |                                                        ~~~~~~~~~~~~~~~~~^~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/evp.h:1346:22: note: declared here
 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
      |                      ^~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/px5g-openssl.hpp:229:50: warning: 'int i2d_RSAPrivateKey_bio(BIO*, const RSA*)' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  229 |                           : i2d_RSAPrivateKey_bio(bio, EVP_PKEY_get0_RSA(key));
      |                             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/editurn/openwrt/openwrt/staging_dir/target-x86_64_musl/usr/include/openssl/x509.h:617:27: note: declared here
  617 | OSSL_DEPRECATEDIN_3_0 int i2d_RSAPrivateKey_bio(BIO *bp, const RSA *rsa);
      |                           ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-util.hpp:19,
                 from /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-ssl-util.hpp:11:
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp: In instantiation of 'auto ubus::message::filter(Strings ...) [with Strings = {const char*}]':
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-ssl-util.hpp:108:63:   required from here
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp:162:55: error: moving a temporary object prevents copy elision [-Werror=pessimizing-move]
  162 |         return std::move(message{msg, std::move(both)});
      |                                                       ^
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp:162:55: note: remove 'std::move' call
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp: In instantiation of 'auto ubus::message::filter(Strings ...) [with Strings = {const char*, const char*, const char*}]':
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-util.cpp:27:53:   required from here
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp:162:55: error: moving a temporary object prevents copy elision [-Werror=pessimizing-move]
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp:162:55: note: remove 'std::move' call
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp: In instantiation of 'auto ubus::message::filter(Strings ...) [with Strings = {const char*, const char*, const char*, const char*}]':
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/nginx-util.cpp:50:31:   required from here
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp:162:55: error: moving a temporary object prevents copy elision [-Werror=pessimizing-move]
/home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/ubus-cxx.hpp:162:55: note: remove 'std::move' call
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
make[2]: *** [Makefile:134: /home/editurn/openwrt/openwrt/build_dir/target-x86_64_musl/nginx-util-1.6/.built] Error 1
make[2]: Leaving directory '/home/editurn/openwrt/openwrt/feeds/packages/net/nginx-util'
time: package/feeds/packages/nginx-util/compile#4.53#0.15#4.52
    ERROR: package/feeds/packages/nginx-util failed to build.
make[1]: *** [package/Makefile:116: package/feeds/packages/nginx-util/compile] Error 1
make[1]: Leaving directory '/home/editurn/openwrt/openwrt'
make: *** [/home/editurn/openwrt/openwrt/include/toplevel.mk:231:package/nginx-util/compile] 错误 2
WYC-2020 commented 1 year ago

image

neheb commented 1 year ago

ping @peter-stadler

peter-stadler commented 1 year ago

Thank you. I will be able to test it in two weeks only, but the change looks fine. After two weeks I will also look to fix the code. In the meantime I think it would be good to use the proposed change.