From: Vincent Fazio <vfazio@gmail.com>
To: buildroot@buildroot.org
Cc: Romain Naour <romain.naour@gmail.com>,
Giulio Benetti <giulio.benetti@benettiengineering.com>,
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Vincent Fazio <vfazio@gmail.com>
Subject: [Buildroot] [PATCH 2/3] toolchain/helper: perform reverse support checks
Date: Thu, 6 Jul 2023 12:18:33 -0500 [thread overview]
Message-ID: <20230706171834.1065129-2-vfazio@gmail.com> (raw)
In-Reply-To: <20230706171834.1065129-1-vfazio@gmail.com>
Previously, it was possible for external toolchains to be used that had
support for languages or libraries that Buildroot was not aware of.
If Buildroot is not made aware of this support, it will not know to copy
the requisite libraries into the filesystem.
This is problematic as packages may perform their own checks [0] to find
out what the toolchain supports and builds will link against libraries
from the toolchain but will be missing dependencies in the filesystem.
Now, the support helpers alert the user when a toolchain supports a
language or library that has not been set in the Buildroot configuration.
Also, while we're here, add `-ffree-form` to the Fortran check to
suppress a meaningless warning.
[0]: https://bugs.busybox.net/show_bug.cgi?id=15634
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
toolchain/helpers.mk | 51 ++++++++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 24c482923a..030ddfda70 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -343,11 +343,14 @@ check_arm_abi = \
#
check_cplusplus = \
__CROSS_CXX=$(strip $1) ; \
- $${__CROSS_CXX} -v > /dev/null 2>&1 ; \
- if test $$? -ne 0 ; then \
+ __HAS_CXX=`$${__CROSS_CXX} -v > /dev/null 2>&1 && echo y`; \
+ if [ "$${__HAS_CXX}" != "y" -a "$(BR2_INSTALL_LIBSTDCPP)" = y ] ; then \
echo "C++ support is selected but is not available in external toolchain" ; \
exit 1 ; \
- fi
+ elif [ "$${__HAS_CXX}" = "y" -a "$(BR2_INSTALL_LIBSTDCPP)" != y ] ; then \
+ echo "C++ support is not selected but is available in external toolchain" ; \
+ exit 1 ; \
+ fi \
#
#
@@ -358,14 +361,16 @@ check_cplusplus = \
check_dlang = \
__CROSS_GDC=$(strip $1) ; \
__o=$(BUILD_DIR)/.br-toolchain-test-dlang.tmp ; \
- printf 'import std.stdio;\nvoid main() { writeln("Hello World!"); }\n' | \
- $${__CROSS_GDC} -x d -o $${__o} - ; \
- if test $$? -ne 0 ; then \
- rm -f $${__o}* ; \
+ __HAS_DLANG=`printf 'import std.stdio;\nvoid main() { writeln("Hello World!"); }\n' | \
+ $${__CROSS_GDC} -x d -o $${__o} - >/dev/null 2>&1 && echo y`; \
+ rm -f $${__o}* ; \
+ if [ "$${__HAS_DLANG}" != "y" -a "$(BR2_TOOLCHAIN_HAS_DLANG)" = y ] ; then \
echo "D language support is selected but is not available in external toolchain" ; \
exit 1 ; \
- fi ; \
- rm -f $${__o}* \
+ elif [ "$${__HAS_DLANG}" = "y" -a "$(BR2_TOOLCHAIN_HAS_DLANG)" != y ] ; then \
+ echo "D language support is not selected but is available in external toolchain" ; \
+ exit 1 ; \
+ fi \
#
#
@@ -376,14 +381,16 @@ check_dlang = \
check_fortran = \
__CROSS_FC=$(strip $1) ; \
__o=$(BUILD_DIR)/.br-toolchain-test-fortran.tmp ; \
- printf 'program hello\n\tprint *, "Hello Fortran!\\n"\nend program hello\n' | \
- $${__CROSS_FC} -x f95 -o $${__o} - ; \
- if test $$? -ne 0 ; then \
- rm -f $${__o}* ; \
+ __HAS_FORTRAN=`printf 'program hello\n\tprint *, "Hello Fortran!\\\n"\nend program hello\n' | \
+ $${__CROSS_FC} -x f95 -ffree-form -o $${__o} - && echo y`; \
+ rm -f $${__o}* ; \
+ if [ "$${__HAS_FORTRAN}" != "y" -a "$(BR2_TOOLCHAIN_HAS_FORTRAN)" = y ] ; then \
echo "Fortran support is selected but is not available in external toolchain" ; \
exit 1 ; \
- fi ; \
- rm -f $${__o}* \
+ elif [ "$${__HAS_FORTRAN}" = "y" -a "$(BR2_TOOLCHAIN_HAS_FORTRAN)" != y ] ; then \
+ echo "Fortran support is not selected but is available in external toolchain" ; \
+ exit 1 ; \
+ fi \
#
#
@@ -394,14 +401,16 @@ check_fortran = \
check_openmp = \
__CROSS_CC=$(strip $1) ; \
__o=$(BUILD_DIR)/.br-toolchain-test-openmp.tmp ; \
- printf '\#include <omp.h>\nint main(void) { return omp_get_thread_num(); }' | \
- $${__CROSS_CC} -fopenmp -x c -o $${__o} - ; \
- if test $$? -ne 0 ; then \
- rm -f $${__o}* ; \
+ __HAS_OPENMP=`printf '\#include <omp.h>\nint main(void) { return omp_get_thread_num(); }' | \
+ $${__CROSS_CC} -fopenmp -x c -o $${__o} - >/dev/null 2>&1 && echo y` ; \
+ rm -f $${__o}* ; \
+ if [ "$${__HAS_OPENMP}" != "y" -a "$(BR2_TOOLCHAIN_HAS_OPENMP)" = y ] ; then \
echo "OpenMP support is selected but is not available in external toolchain"; \
exit 1 ; \
- fi ; \
- rm -f $${__o}* \
+ elif [ "$${__HAS_OPENMP}" = "y" -a "$(BR2_TOOLCHAIN_HAS_OPENMP)" != y ] ; then \
+ echo "OpenMP support is not selected but is available in external toolchain"; \
+ exit 1 ; \
+ fi \
#
# Check that the cross-compiler given in the configuration exists
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-07-06 17:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 17:18 [Buildroot] [PATCH 1/3] toolchain/toolchain-external/toolchain-external-bootlin: flag OpenMP support Vincent Fazio
2023-07-06 17:18 ` Vincent Fazio [this message]
2023-07-06 17:18 ` [Buildroot] [PATCH 3/3] toolchain/toolchain-external: always call checks with dependencies Vincent Fazio
2023-07-23 7:48 ` [Buildroot] [PATCH 1/3] toolchain/toolchain-external/toolchain-external-bootlin: flag OpenMP support Thomas Petazzoni via buildroot
2023-08-29 20:09 ` Peter Korsgaard
-- strict thread matches above, loose matches on Subject: below --
2023-07-06 17:09 Vincent Fazio
2023-07-06 17:09 ` [Buildroot] [PATCH 2/3] toolchain/helper: perform reverse support checks Vincent Fazio
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=20230706171834.1065129-2-vfazio@gmail.com \
--to=vfazio@gmail.com \
--cc=buildroot@buildroot.org \
--cc=giulio.benetti@benettiengineering.com \
--cc=romain.naour@gmail.com \
--cc=thomas.de_schampheleire@nokia.com \
--cc=thomas.petazzoni@bootlin.com \
/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