zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1

Home Page:https://www.zeromq.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Latest libsodium has deprecated functions, causing it not to compile

BHare1985 opened this issue · comments

Issue description

Latest libsodium has deprecated functions, causing zmq unable to compile because warnings are treated as errors

Environment

g++ (Debian 13.2.0-13) 13.2.0
autoconf (GNU Autoconf) 2.71
automake (GNU automake) 1.16.5
libtoolize (GNU libtool) 2.4.7

  • libzmq version (commit hash if unreleased): 2a75ef0
  • OS: Debian Trixie (testing)
  • libsodium version: 07ccd8d8ae2d27ee2ffca340d9252e34d9a3ad20

Minimal test code / Steps to reproduce the issue

git clone git://github.com/jedisct1/libsodium.git
cd libsodium
./autogen.sh -s
./configure 
make check
sudo make install
sudo ldconfig
cd ..

git clone git://github.com/zeromq/libzmq.git
cd libzmq
./autogen.sh
./configure --with=libsodium
make check

Note: libsodium's master branch requires ./autogen.sh to be ran with -s to confirm you want a dev enviroment, otherwise it just won't work. This example is how a majority of zeromq's projects suggest compiling, e.g malamute, filemq

What's the actual result? (include assertion message & call stack if applicable)

Making check in doc
make[1]: Entering directory '/root/projects/libzmq/doc'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/root/projects/libzmq/doc'
make[1]: Entering directory '/root/projects/libzmq'
  CXX      src/libzmq_la-curve_client.lo
In file included from src/curve_client.hpp:10,
                 from src/curve_client.cpp:11:
src/curve_client_tools.hpp: In static member function ‘static int zmq::curve_client_tools_t::produce_hello(void*, const uint8_t*, uint64_t, const uint8_t*, const uint8_t*)’:
src/curve_client_tools.hpp:45:22: error: ‘int crypto_box(unsigned char*, const unsigned char*, long long unsigned int, const unsigned char*, const unsigned char*, const unsigned char*)’ is deprecated [-Werror=deprecated-declarations]
   45 |           crypto_box (hello_box, &hello_plaintext[0], hello_plaintext.size (),
      |           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   46 |                       hello_nonce, server_key_, cn_secret_);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/sodium.h:17,
                 from src/curve_mechanism_base.hpp:9,
                 from src/curve_client.hpp:8:
/usr/local/include/sodium/crypto_box.h:151:5: note: declared here
  151 | int crypto_box(unsigned char *c, const unsigned char *m,
      |     ^~~~~~~~~~
src/curve_client_tools.hpp: In static member function ‘static int zmq::curve_client_tools_t::process_welcome(const uint8_t*, size_t, const uint8_t*, const uint8_t*, uint8_t*, uint8_t*, uint8_t*)’:
src/curve_client_tools.hpp:92:34: error: ‘int crypto_box_open(unsigned char*, const unsigned char*, long long unsigned int, const unsigned char*, const unsigned char*, const unsigned char*)’ is deprecated [-Werror=deprecated-declarations]
   92 |         int rc = crypto_box_open (&welcome_plaintext[0], welcome_box,
      |                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   93 |                                   sizeof welcome_box, welcome_nonce,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   94 |                                   server_key_, cn_secret_);
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sodium/crypto_box.h:157:5: note: declared here
  157 | int crypto_box_open(unsigned char *m, const unsigned char *c,
      |     ^~~~~~~~~~~~~~~
src/curve_client_tools.hpp: In static member function ‘static int zmq::curve_client_tools_t::produce_initiate(void*, size_t, uint64_t, const uint8_t*, const uint8_t*, const uint8_t*, const uint8_t*, const uint8_t*, const uint8_t*, const uint8_t*, const uint8_t*, size_t)’:
src/curve_client_tools.hpp:140:22: error: ‘int crypto_box(unsigned char*, const unsigned char*, long long unsigned int, const unsigned char*, const unsigned char*, const unsigned char*)’ is deprecated [-Werror=deprecated-declarations]
  140 |           crypto_box (vouch_box, &vouch_plaintext[0], vouch_plaintext.size (),
      |           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  141 |                       vouch_nonce, cn_server_, secret_key_);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sodium/crypto_box.h:151:5: note: declared here
  151 | int crypto_box(unsigned char *c, const unsigned char *m,
      |     ^~~~~~~~~~
src/curve_client_tools.hpp:177:25: error: ‘int crypto_box(unsigned char*, const unsigned char*, long long unsigned int, const unsigned char*, const unsigned char*, const unsigned char*)’ is deprecated [-Werror=deprecated-declarations]
  177 |         rc = crypto_box (&initiate_box[0], &initiate_plaintext[0],
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  178 |                          crypto_box_ZEROBYTES + 128 + metadata_length_,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  179 |                          initiate_nonce, cn_server_, cn_secret_);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sodium/crypto_box.h:151:5: note: declared here
  151 | int crypto_box(unsigned char *c, const unsigned char *m,
      |     ^~~~~~~~~~
src/curve_client.cpp: In member function ‘int zmq::curve_client_t::process_ready(const uint8_t*, size_t)’:
src/curve_client.cpp:206:38: error: ‘int crypto_box_open_afternm(unsigned char*, const unsigned char*, long long unsigned int, const unsigned char*, const unsigned char*)’ is deprecated [-Werror=deprecated-declarations]
  206 |     int rc = crypto_box_open_afternm (&ready_plaintext[0], &ready_box[0], clen,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  207 |                                       ready_nonce, get_precom_buffer ());
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sodium/crypto_box.h:168:5: note: declared here
  168 | int crypto_box_open_afternm(unsigned char *m, const unsigned char *c,
      |     ^~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:5517: src/libzmq_la-curve_client.lo] Error 1
make[1]: Leaving directory '/root/projects/libzmq'
make: *** [Makefile:8437: check-recursive] Error 1

What's the expected result?

To compile without issue, or to detect when libsodium is a new version and disable deprecation warnings.

I have confirmed that if you setup the minimal libsodium build it will work and make check still passes. I am not sure if modifying zmq to handle both old and new libsodium is worthwhile so I will keep this PR open, but for those stumbling across the same issue the following libsodium configure command should work:

./configure --enable-minimal