Skip to content
Snippets Groups Projects
Commit c5cdb3b9 authored by Andrei Gherzan's avatar Andrei Gherzan :penguin: Committed by Bernhard Rosenkränzer
Browse files

networkmanager: Fix builds with musl


On musl, build would fail with:

| In file included from
../NetworkManager-1.22.10/shared/systemd/src/basic/env-util.c:11:
|
../NetworkManager-1.22.10/shared/systemd/src/basic/alloc-util.h:100:35:
error: static declaration of 'reallocarray' follows non-static
declaration
|   100 | _alloc_(2, 3) static inline void *reallocarray(void *p, size_t
need, size_t size) {
|       |                                   ^~~~~~~~~~~~
| In file included from
../NetworkManager-1.22.10/shared/nm-default.h:184,
|                  from
../NetworkManager-1.22.10/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h:9,
|                  from
../NetworkManager-1.22.10/shared/systemd/src/basic/env-util.c:3:
|
[...]/build-linux/tmp/work/aarch64-poky-linux-musl/networkmanager/1.22.10-r0/recipe-sysroot/usr/include/stdlib.h:148:7:
note: previous declaration of 'reallocarray' with type 'void *(void *,
size_t,  size_t)' {aka 'void *(void *, long unsigned
 int,  long unsigned int)'}
|   148 | void *reallocarray (void *, size_t, size_t);
|       |       ^~~~~~~~~~~~

This is because musl does't provide reallocarray as part of malloc.h but
only as part of stdlib.h. Configure script was modified to check for its
definition in stdlib.h as well (backported patch).

Signed-off-by: Andrei Gherzan's avatarAndrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com> [adapt filename in .bbappend to match the actual patch filename]
parent ad08c662
No related branches found
No related tags found
No related merge requests found
From c992f460c74bee491f831a21326f51c907376ebf Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Thu, 10 Dec 2020 08:10:40 -0300
Subject: [PATCH] build: check for reallocarray in stdlib.h
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Upstream-status: Backport
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index f86cda69ac0..8fd65d13713 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,7 @@ AC_CHECK_DECLS([
reallocarray],
[], [], [[
#include <malloc.h>
+#include <stdlib.h>
]])
AC_CHECK_DECLS([
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
SRC_URI_append = " file://fix-reallocarray-check.patch"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment