From: James Carter <jwcart2@gmail.com>
To: Winfried Dobbe <winfried_mb2@xmsnet.nl>
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] libsepoll/src/Makefile: Fix reallocarray detection when cross-compiling
Date: Wed, 13 Mar 2024 18:50:42 -0400 [thread overview]
Message-ID: <CAP+JOzQMATOACnaC=WMT5PS+YdGaJtCFzWy2nPVwSmFmuZABzg@mail.gmail.com> (raw)
In-Reply-To: <20240229164439.20521-1-winfried_mb2@xmsnet.nl>
On Thu, Feb 29, 2024 at 11:45 AM Winfried Dobbe <winfried_mb2@xmsnet.nl> wrote:
>
> 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))
The default CFLAGS causes the compilation to fail even if reallocarray
exists on the system.
See if the patch I sent to the list works for you.
Thanks,
Jim
> override CFLAGS += -DHAVE_REALLOCARRAY
> endif
>
> --
> 2.35.3
>
>
prev parent reply other threads:[~2024-03-13 22:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 16:44 [PATCH] libsepoll/src/Makefile: Fix reallocarray detection when cross-compiling Winfried Dobbe
2024-03-13 22:50 ` James Carter [this message]
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='CAP+JOzQMATOACnaC=WMT5PS+YdGaJtCFzWy2nPVwSmFmuZABzg@mail.gmail.com' \
--to=jwcart2@gmail.com \
--cc=selinux@vger.kernel.org \
--cc=winfried_mb2@xmsnet.nl \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).