openssl: Build fails on AIX 7.1 with undefined reference to sendmmsg.

Hello OpenSSL, I’ve been trying to build OpenSSL version 3.2.1 on AIX 7.1 with GCC 11.3.0. The build fails with undefined references to sendmmsg which is used in crypto/bio/bss_dgram.c. The reason for this is that the sendmmsg functionality was only added in AIX 7.2. See here: https://www.ibm.com/docs/en/aix/7.2?topic=s-sendmmsg-subroutine

Our application does not use the BIO_s_datagram() routines listed here: https://www.openssl.org/docs/man3.2/man3/BIO_new_dgram.html and so I’ve been able to work around this issue by configuring the build with the ‘no-dgram’ option.

The build fails on AIX with this configuration:

export OBJECT_MODE=64
export C_INCLUDE_PATH=${ZLIB_DIR}/include:$C_INCLUDE_PATH
export LIBRARY_PATH=${ZLIB_DIR}/lib:$LIBRARY_PATH

./config --prefix="${OPENSSL_DIR}" shared threads zlib-dynamic
if [ ! $? -eq 0 ]; then
	echo "Configuration for build failed"
	exit 2
fi

During compilation I see this warnings output from the compiler:

crypto/bio/bss_dgram.c: In function 'dgram_sendmmsg':
crypto/bio/bss_dgram.c:1376:11: warning: implicit declaration of function 'sendmmsg'; did you mean 'sendmsg'? [-Wimplicit-function-declaration]
 1376 |     ret = sendmmsg(b->num, mh, num_msg, sysflags);
      |           ^~~~~~~~
      |           sendmsg
crypto/bio/bss_dgram.c: In function 'dgram_recvmmsg':
crypto/bio/bss_dgram.c:1569:11: warning: implicit declaration of function 'recvmmsg'; did you mean 'recvmsg'? [-Wimplicit-function-declaration]
 1569 |     ret = recvmmsg(b->num, mh, num_msg, sysflags, NULL);
      |           ^~~~~~~~
      |           recvmsg

Then at a later point linking fails with undefined reference to sendmmsg.

Here’s the output of perl configdata.pm --dump configdata.pm.dump.txt

Hope this helps, Paul

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

Well, if you can build and test successfully with no-dgram no-legacy (excluding the test_symbol_presence and test_lhash as these failures do not seem to be a substantial issue) and you have all functionality that your application needs still in that OpenSSL build, then you should be fine.

Does this patch work?

diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index 1ab8c5fd70..ea2550859c 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -66,7 +66,7 @@
    #undef NO_RECVMSG
    #define NO_RECVMSG
 # endif
-# if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+# if (defined(__ANDROID_API__) && __ANDROID_API__ < 21) || defined(_AIX)
 #  undef NO_RECVMMSG
 #  define NO_RECVMMSG
 # endif

easiest in-field solution is to edit the bss_dgram.c file such that in this clause:

# if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#  if !(__GLIBC_PREREQ(2, 14))
#   undef NO_RECVMMSG
    /*
     * Some old glibc versions may have recvmmsg and MSG_WAITFORONE flag, but
     * not sendmmsg. We need both so force this to be disabled on these old
     * versions
     */
#   define NO_RECVMMSG
#  endif
# endif

You edit it so that the second line reads:

#  if !(__GLIBC_PREREQ(2, 14)) || defined(OPENSSL_SYS_AIX)

that will turn off recvmmsg and sendmmsg for AIX. Thats not the fully correct fix of course, since it will turn it off for all AIX releasese, not just those prior to 7.2. For that we will have to detect the specific AIX version