Disable sysctl when building libevents (#12658)

Make the libevents library built on CentOS portable to Ubuntu.

## Problem Summary(Required) :

When libevents is built on CentOS, it will detect sysctl libraries and try to make use of that.

Specifically, [`arc4random.c`](3ec3b469b8/arc4random.c (L186)) will use a different implementation when compiled with sysctl.

This causes a problem if we simply copy the `libevent.a` built on CentOS (the starrocks-dev-env docker is built by CentOS) to Ubuntu because Ubuntu does not have the sysctl libraries.

This will cause a linker error:

```
var/local/thirdparty/src/libevent-24236aed01798303745470e6c498bf606e88724a/./arc4random.c:192: undefined reference to `sysctl'
```

In this PR, we extend the libevent patch to disable sysctl when configuring the libevent library build. I have verified that the libevent library built on CentOS can now be ported to Ubuntu without linker error.
This commit is contained in:
Jiacheng Yang 2022-10-28 18:40:23 -07:00 committed by GitHub
parent bcd1f89384
commit fba45d8104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 0 deletions

View File

@ -69,3 +69,33 @@ index 4bf5b1f..0762cab 100644
};
#ifdef __cplusplus
diff --git a/configure.ac b/configure.ac
index e5088ac..7810b49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,11 +254,6 @@ AC_CHECK_HEADERS([ \
errno.h \
])
-AC_CHECK_HEADERS(sys/sysctl.h, [], [], [
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-])
if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h)
AC_EGREP_CPP(yes,
@@ -330,13 +325,6 @@ if test "x$ac_cv_header_sys_time_h" = "xyes"; then
)
fi
-if test "x$ac_cv_header_sys_sysctl_h" = "xyes"; then
- AC_CHECK_DECLS([CTL_KERN, KERN_RANDOM, RANDOM_UUID, KERN_ARND], [], [],
- [[#include <sys/types.h>
- #include <sys/sysctl.h>]]
- )
-fi
-
AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
AM_CONDITIONAL(BUILD_CYGWIN, test x$cygwin = xtrue)
AM_CONDITIONAL(BUILD_MIDIPIX, test x$midipix = xtrue)