-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: ncurses module does not have wide character support #3530
Comments
+cc maintainer of this module: @wep21 |
Digging into this more, I compared the In the one generated by Bazel, there is an extra This seems to explain the above error:
Removing the
Looking at /*
* Wide-character macros to hide some platform-differences.
*/
#if USE_WIDEC_SUPPORT
#if defined(_NC_WINDOWS) && !defined(_NC_MSC) && !defined(EXP_WIN32_DRIVER)
/*
* MinGW has wide-character functions, but they do not work correctly.
*/
extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t);
#define wctomb(s,wc) _nc_wctomb(s,wc)
#define wcrtomb(s,wc,n) _nc_wctomb(s,wc)
extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t);
#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n)
extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t);
#define mblen(s,n) _nc_mblen(s, n)
#endif /* _NC_WINDOWS && !_NC_MSC */
#if HAVE_MBTOWC && HAVE_MBLEN
#define reset_mbytes(state) IGNORE_RC(mblen(NULL, (size_t) 0)), IGNORE_RC(mbtowc(NULL, NULL, (size_t) 0))
#define count_mbytes(buffer,length,state) mblen(buffer,length)
#define check_mbytes(wch,buffer,length,state) \
(int) mbtowc(&(wch), buffer, length)
#define state_unused
#elif HAVE_MBRTOWC && HAVE_MBRLEN
#define reset_mbytes(state) init_mb(state)
#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&(state))
#define check_mbytes(wch,buffer,length,state) \
(int) mbrtowc(&(wch), buffer, length, &(state))
#else
make an error
#endif
#endif /* USE_WIDEC_SUPPORT */ The Running
|
I have pasted my I have not yet found where Interestingly, on Linux, there are instead errors like these, reporting that members
@wep21 have you seen such errors before? |
@davidzchen Does this BUILD.bazel work on your environment?
|
That worked. Thank you very much! Let's go ahead and create a new version of the ncurses module in BCR. |
closes #3530 Signed-off-by: wep21 <[email protected]>
I'm not sure if "bug" is the best category for this, but at this moment, I am not requesting a new module, and this is also not a security vulnerability.
What happened?
The ncurses module has no wide character support. I attempted to add wide character support, but ran into problems. See details below.
Version
Development (host) and target OS/architectures:
Output of
bazel --version
:Version of relevant rules from the
WORKSPACE
orMODULE.bazel
file:Language(s) and/or frameworks involved:
C, C++
How to reproduce
To reproduce the lack of wide character support:
git clone https://github.com/davidzchen/bazel-ncurses-example cd bazel-ncurses-example bazel run //foo:main
Note that the character
█
is being rendered as~V~H
.Any other information?
I understand that this is because the
ncurses
module is currently not being built with wide character support. I am unsure whether we should create a newncursesw
module or enable wide character support in thencurses
module itself.Either way, I attempted to enable wide character support but ran into some problems.
I copied the files from the
ncurses
module in the BCR, including the BUILD file for thencurses
repository and other needed files, such as the rule implementations forpseudo_configure
andautomake_substitution
, into my repository using the module extension setup. See: https://github.com/davidzchen/bazel-ncurses-example/tree/module-extensionThen, I added
NCURSES_WIDECHAR
andUSE_WIDEC_SUPPORT
to thedefs
for thepseudo_configure
rule that generatesncurses_cfg.h
:However, when I tried to
bazel build @ncurses
, I get the following errors:macOS 15.2:
Ubuntu 24.04:
Another data point is that cloning the
ncurses
repository from https://github.com/mirror/ncurses, then running./configure --enable-widec
, thenmake
succeeds, so there must be something else we are missing in the BUILD file.I am at a loss as to why both clang/llvm and gcc are reporting this compilation error in a system header. I tried to search for this error message on Google, and all the results seem to point to this error message indicating a syntax error, which does not seem to make sense here.
The text was updated successfully, but these errors were encountered: