Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a legacy project, that needs to be extended to send messages into a RabbitMQ instance. Net::AMQP::RabbitMQ seems to be the only up-to-date module for doing this, but I am unable to build this, and, not being a C guy, I don't understand the errors. This is running Perl 5.26.2 on CentOS 7. When I use cpanm to try to install it, the last bits of the build log are:
OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -DVERSION=\"2.40014\" -DXS_VE +RSION=\"2.40014\" -fPIC "-I/home/perlbrew/perl5/perlbrew/perls/perl-5 +.26.2/lib/5.26.2/x86_64-linux/CORE" -DHAVE_S OCKET -DHAVE_POLL -DAMQ_PLATFORM='"Perl_linux_v5.26.2"' -DNAR_HAVE_OPE +NSSL amqp_mem.c cc -c -I. -Irabbitmq-include -Irabbitmq-c/include -Irabbitmq-include/ +unix -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/u +sr/local/include -D_LARGEFILE_SOURCE -D_FILE_ OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -DVERSION=\"2.40014\" -DXS_VE +RSION=\"2.40014\" -fPIC "-I/home/perlbrew/perl5/perlbrew/perls/perl-5 +.26.2/lib/5.26.2/x86_64-linux/CORE" -DHAVE_S OCKET -DHAVE_POLL -DAMQ_PLATFORM='"Perl_linux_v5.26.2"' -DNAR_HAVE_OPE +NSSL amqp_openssl.c amqp_openssl.c: In function ‘amqp_ssl_socket_open’: amqp_openssl.c:182:3: warning: passing argument 1 of ‘BIO_new’ discard +s ‘const’ qualifier from pointer target type [enabled by default] bio = BIO_new(amqp_openssl_bio()); ^ In file included from rabbitmq-include/amqp_openssl_bio.h:10:0, from amqp_openssl.c:15: /usr/include/openssl/bio.h:659:6: note: expected ‘struct BIO_METHOD *’ + but argument is of type ‘BIO_METHOD_PTR’ BIO *BIO_new(BIO_METHOD *type); ^ amqp_openssl.c: In function ‘amqp_ssl_socket_new’: amqp_openssl.c:339:3: warning: passing argument 1 of ‘SSL_CTX_new’ mak +es pointer from integer without a cast [enabled by default] self->ctx = SSL_CTX_new(TLS_client_method()); ^ In file included from amqp_openssl.c:31:0: /usr/include/openssl/ssl.h:2087:10: note: expected ‘const struct SSL_M +ETHOD *’ but argument is of type ‘int’ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); ^ amqp_openssl.c: In function ‘get_tls_version’: amqp_openssl.c:547:22: error: ‘TLS1_3_VERSION’ undeclared (first use i +n this function) *tls_version = TLS1_3_VERSION; ^ amqp_openssl.c:547:22: note: each undeclared identifier is reported on +ly once for each function it appears in make: *** [amqp_openssl.o] Error 1 -> FAIL Installing Net::AMQP::RabbitMQ failed. See /root/.cpanm/work/1 +751032905.481/build.log for details. Retry with --force to force inst +all it.
It still fails when I try to force install it. Any suggestions here? This is far outside my comfort zone. If there's another module I could be using, I'm happy to give that a try; we don't need to use any advanced RabbitMQ features, just send messages into it.

Replies are listed 'Best First'.
Re: Can't build Net::AMQP::RabbitMQ
by ysth (Canon) on Jun 27, 2025 at 17:16 UTC
    From https://stackoverflow.com/q/63508872 it sounds possible to install a newer openssl (with TLS 1.3 support) without disturbing the rest of the system, and (not sure exactly how) get your module build to use it.

    Or, since AIUI Centos 7 is dead, seems like even if this is a legacy system, they'd want to upgrade it for security.

    Or look for a centos 7 rpm for the perl module.

    Or try building an older version of the module.
Re: Can't build Net::AMQP::RabbitMQ
by Fletch (Bishop) on Jun 27, 2025 at 17:59 UTC

    An option to (possibly) sidestep the build issue you might try using Net::STOMP if your rabbit is configured to speak it. That should be perl using your perl's possibly already built SSL modules rather than trying to build the support in to the XS module. See (or have your broker admin see) https://www.rabbitmq.com/docs/stomp for the configuration details.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: Can't build Net::AMQP::RabbitMQ
by Corion (Patriarch) on Jun 27, 2025 at 15:54 UTC

    The relevant error seems to be

    amqp_openssl.c:547:22: error: ‘TLS1_3_VERSION’ undeclared (first use i +n this function) *tls_version = TLS1_3_VERSION;

    So, what version is your libssl? Most likely you need to find a newer/older version of libssl to match whatever amqp expects, or patch amqp to work with the different version your CentOS provides.

    Also note that your Perl version is really old and unsupported by now.

      (OP here.)

      Thanks. This is our test box, which is unfortunately out of date. Our prod machine is, well, not out of date. I was able to install this module on the prod machine, but I do need it on test too.

      I'll talk to our sysadmin about possibilities. This'll end up breaking stuff, I'm sure.... Aargh.

        OP here again, just wanted to follow up.

        We ended up just building a new VM, running a recent Rocky Linux and Perl 5.38.2. No problem building Net::AMQP::RabbitMQ on this, and we're off and running. It did not end up breaking anything else.

        Thanks for the suggestions; I would have assumed this package wouldn't absolutely require a fully recent system, but I would have been wrong.

      ChatGPT says it requires OpenSSL 1.1.1:
      The macro TLS1_3_VERSION was added in OpenSSL version 1.1.1. Details:

      Macro Definition:

      #define TLS1_3_VERSION 0x0304

      Purpose: This macro identifies the version number used internally by OpenSSL to denote TLS 1.3 (which is 0x0304, following the convention for TLS versions where 0x0303 is TLS 1.2, and so on).

      OpenSSL 1.1.1 Release Date: September 11, 2018

      Support: TLS 1.3 support was first introduced in OpenSSL 1.1.1. Earlier versions such as 1.1.0 or 1.0.x do not define this macro or support TLS 1.3 at all.

        Did you confirm? This is useless unless confirmed. Don't post such misleading junk.