From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: Buildroot Development <buildroot@buildroot.org>,
Edgar Bonet <bonet@grenoble.cnrs.fr>,
Brandon Maier <brandon.maier@collins.com>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
Subject: Re: [Buildroot] [PATCH] package/git: fix wchar-less uclibc build
Date: Mon, 28 Oct 2024 23:13:34 +0100 [thread overview]
Message-ID: <20241028231334.30d80be8@windsurf> (raw)
In-Reply-To: <20241020092527.734923-3-bagasdotme@gmail.com>
Hello,
On Sun, 20 Oct 2024 16:25:29 +0700
Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> diff --git a/package/git/0001-t-unit-tests-fix-clar-build-for-wchar-less-uclibc.patch b/package/git/0001-t-unit-tests-fix-clar-build-for-wchar-less-uclibc.patch
> new file mode 100644
> index 0000000000..50e844f5d4
> --- /dev/null
> +++ b/package/git/0001-t-unit-tests-fix-clar-build-for-wchar-less-uclibc.patch
> @@ -0,0 +1,97 @@
> +From 3d24a1610bf5a84486c84526ded567a53e10b96f Mon Sep 17 00:00:00 2001
> +From: Edgar Bonet <bonet@grenoble.cnrs.fr>
> +Date: Fri, 18 Oct 2024 14:59:48 +0200
> +Subject: [PATCH] t/unit-tests: fix clar build for wchar-less uclibc
> +
> +Git fails to build on uclibc systems without wchar support:
> +
> +```
> + CC t/unit-tests/unit-test.o
> +t/unit-tests/clar/clar.c: In function 'clar__assert_equal':
> +t/unit-tests/clar/clar.c:767:23: error: unknown type name 'wchar_t'
> + 767 | const wchar_t *wcs1 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +In file included from t/unit-tests/clar/clar.c:13:
> +t/unit-tests/clar/clar.c:767:58: error: unknown type name 'wchar_t'
> + 767 | const wchar_t *wcs1 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:768:23: error: unknown type name 'wchar_t'
> + 768 | const wchar_t *wcs2 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:768:58: error: unknown type name 'wchar_t'
> + 768 | const wchar_t *wcs2 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:769:65: warning: implicit declaration of function 'wcscmp' [-Wimplicit-function-declaration]
> + 769 | is_equal = (!wcs1 || !wcs2) ? (wcs1 == wcs2) : !wcscmp(wcs1, wcs2);
> + | ^~~~~~
> +t/unit-tests/clar/clar.c:784:23: error: unknown type name 'wchar_t'
> + 784 | const wchar_t *wcs1 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:784:58: error: unknown type name 'wchar_t'
> + 784 | const wchar_t *wcs1 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:785:23: error: unknown type name 'wchar_t'
> + 785 | const wchar_t *wcs2 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:785:58: error: unknown type name 'wchar_t'
> + 785 | const wchar_t *wcs2 = va_arg(args, const wchar_t *);
> + | ^~~~~~~
> +t/unit-tests/clar/clar.c:787:65: warning: implicit declaration of function 'wcsncmp' [-Wimplicit-function-declaration]
> + 787 | is_equal = (!wcs1 || !wcs2) ? (wcs1 == wcs2) : !wcsncmp(wcs1, wcs2, len);
> + | ^~~~~~~
> +make[1]: *** [Makefile:2795: t/unit-tests/clar/clar.o] Error 1
> +```
> +
> +This is because on these systems, although there is #error macro
> +in uclibc source when __UCLIBC_HAS_WCHAR__ is not defined, somehow
> +the #error doesn't get triggered when wchar_t is used in clar.
When wchar support is disabled in uClibc, the wchar.h file that gets
installed is ./include/wchar-stub.h, and it doesn't have any #error.
See in the uClibc Makefile:
ifeq ($(UCLIBC_HAS_WCHAR),)
$(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && mv -f wchar-stub.h wchar.h
else
$(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -f wchar-stub.h
endif
> +
> +Fix the build failure by only using wchar_t when __UCLIBC_HAS_WCHAR__
> +is actually defined.
The solution isn't really nice, because it adds some uClibc specific
logic. Isn't there some configure.ac logic that runs to properly detect
the availability of wchar?
Otherwise, we could also make git depend on wchar, and be done with it.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-10-28 22:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 9:25 [Buildroot] [PATCH] package/git: fix wchar-less uclibc build Bagas Sanjaya
2024-10-28 22:13 ` Thomas Petazzoni via buildroot [this message]
2024-10-28 22:39 ` Edgar Bonet
2024-10-30 9:55 ` Bagas Sanjaya
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=20241028231334.30d80be8@windsurf \
--to=buildroot@buildroot.org \
--cc=Ben.Wolsieffer@hefring.com \
--cc=bagasdotme@gmail.com \
--cc=bonet@grenoble.cnrs.fr \
--cc=brandon.maier@collins.com \
--cc=dario.binacchi@amarulasolutions.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