-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply patches for 3.6 to fix detection of available functions when cross-compiling. Use the PKG_CONFIG_LIBDIR to point pkg-config to the correct directory containing Conan's generated pkg-config files. Without this, the pcre2 from the system will be picked up before the one provided by Conan. When cross-compiling, this causes system include directories to poison the build.
- Loading branch information
1 parent
1c888e8
commit 8376f94
Showing
5 changed files
with
153 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,21 @@ patches: | |
base_path: libselinux-3.6 | ||
patch_description: "Fix a missing #include <stdint.h>" | ||
patch_type: "portability" | ||
- patch_file: patches/0004-libsepol-src-Makefile-fix-reallocarray-detection.patch | ||
patch_description: "libsepol/src/Makefile: fix reallocarray detection" | ||
patch_source: "https://lore.kernel.org/selinux/[email protected]/" | ||
patch_type: "portability" | ||
base_path: libsepol-3.6 | ||
- patch_file: patches/0005-libsepoll-src-Makefile-Fix-reallocarray-detection-wh.patch | ||
patch_description: "libsepoll/src/Makefile: Fix reallocarray detection when cross-compiling" | ||
patch_source: "https://lore.kernel.org/selinux/[email protected]/T/#u" | ||
patch_type: "portability" | ||
base_path: libsepol-3.6 | ||
- patch_file: patches/0006-libselinux-src-Makefile-fix-reallocarray-strlcpy-det.patch | ||
patch_description: "libselinux/src/Makefile: fix reallocarray strlcpy detection" | ||
patch_source: "https://lore.kernel.org/selinux/[email protected]/T/#u" | ||
patch_type: "portability" | ||
base_path: libselinux-3.6 | ||
"3.0": | ||
- patch_file: patches/0001-fix-fno-common-3.0.patch | ||
base_path: libsepol-3.0 | ||
Check warning on line 60 in recipes/libselinux/all/conandata.yml GitHub Actions / Lint changed files (YAML files)conandata.yml schema warning
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
recipes/libselinux/all/patches/0004-libsepol-src-Makefile-fix-reallocarray-detection.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
From a520f972bce9ec267f4e76b729bc3b7c1bdf13e6 Mon Sep 17 00:00:00 2001 | ||
From: Fabrice Fontaine <[email protected]> | ||
Date: Mon, 8 Jan 2024 22:03:14 +0100 | ||
Subject: [PATCH 1/3] libsepol/src/Makefile: fix reallocarray detection | ||
|
||
Pass LDFLAGS when checking for reallocarray to avoid the following | ||
static build failure with musl raised since version 3.4 and | ||
https://github.com/SELinuxProject/selinux/commit/f0a5f6e33084bd83d409bb7c932256139f471e71 | ||
because -static is not passed when checking for reallocarray: | ||
|
||
/home/autobuild/autobuild/instance-9/output-1/host/bin/armeb-buildroot-linux-musleabi-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O0 -g0 -static -I. -I../include -D_GNU_SOURCE -I../cil/include -fPIC -c -o assertion.o assertion.c | ||
In file included from assertion.c:28: | ||
private.h:88:21: error: static declaration of 'reallocarray' follows non-static declaration | ||
88 | static inline void* reallocarray(void *ptr, size_t nmemb, size_t size) { | ||
| ^~~~~~~~~~~~ | ||
In file included from ../include/sepol/policydb/mls_types.h:35, | ||
from ../include/sepol/policydb/context.h:23, | ||
from ../include/sepol/policydb/policydb.h:62, | ||
from assertion.c:24: | ||
/home/autobuild/autobuild/instance-9/output-1/host/armeb-buildroot-linux-musleabi/sysroot/usr/include/stdlib.h:150:7: note: previous declaration of 'reallocarray' with type 'void *(void *, size_t, size_t)' {aka 'void *(void *, unsigned int, unsigned int)'} | ||
150 | void *reallocarray (void *, size_t, size_t); | ||
| ^~~~~~~~~~~~ | ||
|
||
Fixes: | ||
- http://autobuild.buildroot.org/results/0170032548a38e2c991d62dc5823808458ad03b3 | ||
|
||
Signed-off-by: Fabrice Fontaine <[email protected]> | ||
Acked-by: James Carter <[email protected]> | ||
--- | ||
src/Makefile | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/Makefile b/src/Makefile | ||
index d80a941f..16b9bd5e 100644 | ||
--- a/src/Makefile | ||
+++ b/src/Makefile | ||
@@ -31,7 +31,7 @@ endif | ||
|
||
# check for reallocarray(3) availability | ||
H := \# | ||
-ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include <stdlib.h>\nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
+ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include <stdlib.h>\nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
override CFLAGS += -DHAVE_REALLOCARRAY | ||
endif | ||
|
||
-- | ||
2.44.0 | ||
|
47 changes: 47 additions & 0 deletions
47
...es/libselinux/all/patches/0005-libsepoll-src-Makefile-Fix-reallocarray-detection-wh.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From fa7341eddfc06a4f021e52014223ae29ad05abcc Mon Sep 17 00:00:00 2001 | ||
From: Jordan Williams <[email protected]> | ||
Date: Fri, 1 Mar 2024 10:49:34 -0600 | ||
Subject: [PATCH 2/3] libsepoll/src/Makefile: Fix reallocarray detection when | ||
cross-compiling | ||
|
||
From: Winfried Dobbe @ 2024-02-29 16:44 UTC (permalink / raw) | ||
https://lore.kernel.org/selinux/[email protected]/T/#u | ||
|
||
In addition to commit 3e3661f602fe7d7dc972bf695fd178370bbd7e54, CFLAGS | ||
are also needed for the reallocarray detection when cross-compiling | ||
libsepoll. | ||
|
||
For example when cross-compiling for Arm Cortex-A9 the compiler finds | ||
stdlib.h (after the addition of LDFLAGS in above mentioned 3e3661f). | ||
But then tries to include soft-float stubs because gcc options | ||
-mfpu=neon -mfloat-abi=hard are missing. See output of detection: | ||
|
||
In file included from /home/wdobbe/.conan2/p/b/swpt_fb08c05e04578/p/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h:40, | ||
from /home/wdobbe/.conan2/p/b/swpt_fb08c05e04578/p/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/features.h:474, | ||
from /home/wdobbe/.conan2/p/b/swpt_fb08c05e04578/p/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/bits/libc-header-start.h:33, | ||
from /home/wdobbe/.conan2/p/b/swpt_fb08c05e04578/p/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/stdlib.h:25, | ||
from <stdin>:2: | ||
/home/wdobbe/.conan2/p/b/swpt_fb08c05e04578/p/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/gnu/stubs-32.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory | ||
7 | # include <gnu/stubs-soft.h> | ||
| ^~~~~~~~~~~~~~~~~~ | ||
compilation terminated. | ||
--- | ||
src/Makefile | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/Makefile b/src/Makefile | ||
index 16b9bd5e..fd6329d4 100644 | ||
--- a/src/Makefile | ||
+++ b/src/Makefile | ||
@@ -31,7 +31,7 @@ endif | ||
|
||
# check for reallocarray(3) availability | ||
H := \# | ||
-ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include <stdlib.h>\nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
+ifeq (yes,$(shell printf '${H}define _GNU_SOURCE\n${H}include <stdlib.h>\nint main(void){void*p=reallocarray(NULL, 1, sizeof(char));return 0;}' | $(CC) $(CFLAGS) $(LDFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
override CFLAGS += -DHAVE_REALLOCARRAY | ||
endif | ||
|
||
-- | ||
2.44.0 | ||
|
39 changes: 39 additions & 0 deletions
39
...es/libselinux/all/patches/0006-libselinux-src-Makefile-fix-reallocarray-strlcpy-det.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From cb10fa3676d5fe2facff9a8c7a6a89911de9efdf Mon Sep 17 00:00:00 2001 | ||
From: Jordan Williams <[email protected]> | ||
Date: Fri, 1 Mar 2024 10:50:00 -0600 | ||
Subject: [PATCH 3/3] libselinux/src/Makefile: fix reallocarray strlcpy | ||
detection | ||
|
||
Pass CFLAGS and LDFLAGS when checking for realocarray and strlcpy. | ||
This brings things inline with the fixes for libsepol/src/Makefile. | ||
This better supports cross-compiling scenarios. | ||
There, flags like -sysroot need to included when running these checks. | ||
|
||
Signed-off-by: Jordan Williams <[email protected]> | ||
--- | ||
src/Makefile | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/Makefile b/src/Makefile | ||
index d3b981fc..6277a195 100644 | ||
--- a/src/Makefile | ||
+++ b/src/Makefile | ||
@@ -104,13 +104,13 @@ override CFLAGS += -I../include -D_GNU_SOURCE $(DISABLE_FLAGS) $(PCRE_CFLAGS) | ||
|
||
# check for strlcpy(3) availability | ||
H := \# | ||
-ifeq (yes,$(shell printf '${H}include <string.h>\nint main(void){char*d,*s;strlcpy(d, s, 0);return 0;}' | $(CC) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
+ifeq (yes,$(shell printf '${H}include <string.h>\nint main(void){char*d,*s;strlcpy(d, s, 0);return 0;}' | $(CC) $(CFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
override CFLAGS += -DHAVE_STRLCPY | ||
endif | ||
|
||
# check for reallocarray(3) availability | ||
H := \# | ||
-ifeq (yes,$(shell printf '${H}include <stdlib.h>\nint main(void){reallocarray(NULL, 0, 0);return 0;}' | $(CC) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
+ifeq (yes,$(shell printf '${H}include <stdlib.h>\nint main(void){reallocarray(NULL, 0, 0);return 0;}' | $(CC) $(CFLAGS) -x c -o /dev/null - >/dev/null 2>&1 && echo yes)) | ||
override CFLAGS += -DHAVE_REALLOCARRAY | ||
endif | ||
|
||
-- | ||
2.44.0 | ||
|