-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Description
We are observing a build error when attempting to build the recent OpenSSL 1.1.1l release version as static library using the following C/C++ compiler flags using gcc10 (and gcc9) on a linux system:
-std=c11 -D_POSIX_C_SOURCE=200809L
-std=c++17 -D_POSIX_C_SOURCE=200809L
The error manifests as:
[INFO] In file included from /opt/bruker/toolchain/linux-x86_64-gcc10/x86_64-linux-gnu/sysroot/usr/include/netdb.h:27,
[INFO] from /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/include/internal/sockets.h:67,
[INFO] from /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bio_local.h:11,
[INFO] from /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:13:
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c: In function 'dgram_get_mtu_overhead':
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:373:20: error: 'const struct in6_addr' has no member named 's6_addr32'
[INFO] 373 | && IN6_IS_ADDR_V4MAPPED(&tmp_addr))
[INFO] | ^~~~~~~~~~~~~~~~~~~~
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:373:20: error: 'const struct in6_addr' has no member named 's6_addr32'
[INFO] 373 | && IN6_IS_ADDR_V4MAPPED(&tmp_addr))
[INFO] | ^~~~~~~~~~~~~~~~~~~~
[INFO] [ 17%] Building C object crypto/CMakeFiles/crypto.dir/blake2/blake2s.c.o
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:373:20: error: 'const struct in6_addr' has no member named 's6_addr32'
[INFO] 373 | && IN6_IS_ADDR_V4MAPPED(&tmp_addr))
[INFO] | ^~~~~~~~~~~~~~~~~~~~
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c: In function 'dgram_ctrl':
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:544:24: error: 'const struct in6_addr' has no member named 's6_addr32'
[INFO] 544 | && IN6_IS_ADDR_V4MAPPED(&tmp_addr))
[INFO] | ^~~~~~~~~~~~~~~~~~~~
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:544:24: error: 'const struct in6_addr' has no member named 's6_addr32'
[INFO] 544 | && IN6_IS_ADDR_V4MAPPED(&tmp_addr))
[INFO] | ^~~~~~~~~~~~~~~~~~~~
[INFO] /home/jenkins/workspace/dmb1/com.github.openssl-linux-x86_64-gcc10/src/crypto/bio/bss_dgram.c:544:24: error: 'const struct in6_addr' has no member named 's6_addr32'
[INFO] 544 | && IN6_IS_ADDR_V4MAPPED(&tmp_addr))
[INFO] | ^~~~~~~~~~~~~~~~~~~~
This seems to be a problem that has been observed by others at different occasions, see in this Ubuntu bug report or this stackoverflow article.
Arguably this is a gray zone between a bug report and a feature request and I'm OK if it is considered as the latter. Nonetheless, the fix is very simple and similar to the one reported by a previous issue (#13049), namely by just applying the following simple patch to file bss_dgram.c:
Index: src/crypto/bio/bss_dgram.c
===================================================================
--- src/crypto/bio/bss_dgram.c (revision 121)
+++ src/crypto/bio/bss_dgram.c (revision 122)
@@ -7,6 +7,10 @@
* https://www.openssl.org/source/license.html
*/
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
#include <stdio.h>
#include <errno.h>
I'm suggesting this fix, because it also reflects existing approaches in other OpenSSL source files (deltat.c, rand_unix.c, or dso_dlfcn.c, just to name a few) and allows OpenSSL to be build on a wider range of systems and reasonable compiler settings.
A PULL request is in preparation.