Add third_party/libevent/compat to includes
libevent uses TAILQ from sys/queue.h, which is not part of posix and is
not implemented in musl libc. libevent includes an implementation in
third_party/libevent/compat/sys/queue.h, add the directory to the
include paths.
Test: m USE_HOST_MUSL=true out/soong/.intermediates/external/cronet/cronet_aml_base_base__testing/linux_musl_x86_64_static/cronet_aml_base_base__testing.a
Change-Id: Ie7f9a4fc2d3de4a8613ffb018aba7d8654de2c89
diff --git a/Android.bp b/Android.bp
index 0b96004..1cb240d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -3391,7 +3391,7 @@
cc_genrule {
name: "cronet_aml_base_build_date",
cmd: "$(location build/write_build_date_header.py) $(out) " +
- "1677005917",
+ "1681382591",
out: [
"base/generated_build_date.h",
],
@@ -3407,7 +3407,7 @@
cc_genrule {
name: "cronet_aml_base_build_date__testing",
cmd: "$(location build/write_build_date_header.py) $(out) " +
- "1677005917",
+ "1681382591",
host_supported: true,
out: [
"base/generated_build_date.h",
@@ -41154,6 +41154,7 @@
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
"third_party/libevent/android/",
+ "third_party/libevent/compat/",
],
cpp_std: "c++20",
ldflags: [
@@ -41238,6 +41239,7 @@
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "third_party/libevent/compat/",
],
cpp_std: "c++20",
ldflags: [
diff --git a/android/tools/gn2bp/Android.bp.swp b/android/tools/gn2bp/Android.bp.swp
index 0b96004..1cb240d 100644
--- a/android/tools/gn2bp/Android.bp.swp
+++ b/android/tools/gn2bp/Android.bp.swp
@@ -3391,7 +3391,7 @@
cc_genrule {
name: "cronet_aml_base_build_date",
cmd: "$(location build/write_build_date_header.py) $(out) " +
- "1677005917",
+ "1681382591",
out: [
"base/generated_build_date.h",
],
@@ -3407,7 +3407,7 @@
cc_genrule {
name: "cronet_aml_base_build_date__testing",
cmd: "$(location build/write_build_date_header.py) $(out) " +
- "1677005917",
+ "1681382591",
host_supported: true,
out: [
"base/generated_build_date.h",
@@ -41154,6 +41154,7 @@
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
"third_party/libevent/android/",
+ "third_party/libevent/compat/",
],
cpp_std: "c++20",
ldflags: [
@@ -41238,6 +41239,7 @@
"buildtools/third_party/libc++/",
"buildtools/third_party/libc++/trunk/include",
"buildtools/third_party/libc++abi/trunk/include",
+ "third_party/libevent/compat/",
],
cpp_std: "c++20",
ldflags: [
diff --git a/android/tools/gn2bp/desc_arm.json b/android/tools/gn2bp/desc_arm.json
index 3537934..466b48d 100644
--- a/android/tools/gn2bp/desc_arm.json
+++ b/android/tools/gn2bp/desc_arm.json
Binary files differ
diff --git a/android/tools/gn2bp/desc_arm64.json b/android/tools/gn2bp/desc_arm64.json
index b3f99e5..4ef0963 100644
--- a/android/tools/gn2bp/desc_arm64.json
+++ b/android/tools/gn2bp/desc_arm64.json
Binary files differ
diff --git a/android/tools/gn2bp/desc_x64.json b/android/tools/gn2bp/desc_x64.json
index 45fbe0c..e401183 100644
--- a/android/tools/gn2bp/desc_x64.json
+++ b/android/tools/gn2bp/desc_x64.json
Binary files differ
diff --git a/android/tools/gn2bp/desc_x86.json b/android/tools/gn2bp/desc_x86.json
index 18498c5..e8678bc 100644
--- a/android/tools/gn2bp/desc_x86.json
+++ b/android/tools/gn2bp/desc_x86.json
Binary files differ
diff --git a/patches/0025-Add-third_party-libevent-compat-to-includes.patch b/patches/0025-Add-third_party-libevent-compat-to-includes.patch
new file mode 100644
index 0000000..0ee703c
--- /dev/null
+++ b/patches/0025-Add-third_party-libevent-compat-to-includes.patch
@@ -0,0 +1,71 @@
+From f5c7b8fa10ed6519f789b817eab40f959da8ce45 Mon Sep 17 00:00:00 2001
+From: Mohannad Farrag <aymanm@google.com>
+Date: Wed, 5 Apr 2023 12:43:32 +0000
+Subject: [PATCH] Add third_party/libevent/compat to includes
+
+libevent uses TAILQ from sys/queue.h, which is not part of posix.
+libevent includes an implementation in third_party/libevent/compat/sys/queue.h,
+add the directory to the include paths.
+
+Currently, sys/queue.h is being included from Chromium's libc which is not requred by the posix standard.
+Also looking at the makefile, It can be seen that `compat` was unconditionally added to the includes but this
+was not correctly reflected in the BUILD.gn
+
+Test: build
+Change-Id: I9f166e01e1757991a12cbbbb3bb1e47cd078c5be
+---
+ third_party/libevent/BUILD.gn | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/third_party/libevent/BUILD.gn b/third_party/libevent/BUILD.gn
+index f5cb1c5fe46b3..61e94cc0cd03f 100644
+--- a/third_party/libevent/BUILD.gn
++++ b/third_party/libevent/BUILD.gn
+@@ -2,6 +2,7 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
++import("//build/config/cronet/config.gni")
+ import("//build/config/nacl/config.gni")
+
+ static_library("libevent") {
+@@ -35,28 +36,32 @@ static_library("libevent") {
+ ]
+
+ defines = [ "HAVE_CONFIG_H" ]
+-
++ if (is_cronet_build) {
++ include_dirs = [ "compat" ]
++ } else {
++ include_dirs = []
++ }
+ if (is_apple) {
+ sources += [
+ "kqueue.c",
+ "mac/config.h",
+ "mac/event-config.h",
+ ]
+- include_dirs = [ "mac" ]
++ include_dirs += [ "mac" ]
+ } else if (is_linux || is_chromeos) {
+ sources += [
+ "epoll.c",
+ "linux/config.h",
+ "linux/event-config.h",
+ ]
+- include_dirs = [ "linux" ]
++ include_dirs += [ "linux" ]
+ } else if (is_android) {
+ sources += [
+ "android/config.h",
+ "android/event-config.h",
+ "epoll.c",
+ ]
+- include_dirs = [ "android" ]
++ include_dirs += [ "android" ]
+ }
+
+ if (!is_debug) {
+--
+2.40.0.577.gac1e443424-goog
+
diff --git a/third_party/libevent/BUILD.gn b/third_party/libevent/BUILD.gn
index f5cb1c5..61e94cc 100644
--- a/third_party/libevent/BUILD.gn
+++ b/third_party/libevent/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/cronet/config.gni")
import("//build/config/nacl/config.gni")
static_library("libevent") {
@@ -35,28 +36,32 @@
]
defines = [ "HAVE_CONFIG_H" ]
-
+ if (is_cronet_build) {
+ include_dirs = [ "compat" ]
+ } else {
+ include_dirs = []
+ }
if (is_apple) {
sources += [
"kqueue.c",
"mac/config.h",
"mac/event-config.h",
]
- include_dirs = [ "mac" ]
+ include_dirs += [ "mac" ]
} else if (is_linux || is_chromeos) {
sources += [
"epoll.c",
"linux/config.h",
"linux/event-config.h",
]
- include_dirs = [ "linux" ]
+ include_dirs += [ "linux" ]
} else if (is_android) {
sources += [
"android/config.h",
"android/event-config.h",
"epoll.c",
]
- include_dirs = [ "android" ]
+ include_dirs += [ "android" ]
}
if (!is_debug) {