All of lore.kernel.org
 help / color / mirror / Atom feed
From: Winfried Dobbe <winfried_mb2@xmsnet.nl>
To: selinux@vger.kernel.org
Cc: Winfried Dobbe <winfried_mb2@xmsnet.nl>
Subject: [PATCH] libsepoll/src/Makefile: Fix reallocarray detection when cross-compiling
Date: Thu, 29 Feb 2024 17:44:39 +0100	[thread overview]
Message-ID: <20240229164439.20521-1-winfried_mb2@xmsnet.nl> (raw)

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.

Signed-off-by: Winfried Dobbe <winfried_mb2@xmsnet.nl>
---
 libsepol/src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libsepol/src/Makefile b/libsepol/src/Makefile
index 16b9bd5e..fd6329d4 100644
--- a/libsepol/src/Makefile
+++ b/libsepol/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.35.3


             reply	other threads:[~2024-02-29 16:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 16:44 Winfried Dobbe [this message]
2024-03-13 22:50 ` [PATCH] libsepoll/src/Makefile: Fix reallocarray detection when cross-compiling James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240229164439.20521-1-winfried_mb2@xmsnet.nl \
    --to=winfried_mb2@xmsnet.nl \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.