I'm in the process of making a Void Linux package for wlrctl (don't worry, I'll take over maintaining it if you don't want to do so yourself), and I've found that it won't compile on any of the tested ARM platforms Void supports. That is, aarch64, armv7l, armv6l, and aarch64-musl.
Relevant details here: https://github.com/void-linux/void-packages/pull/29274
I don't actually plan on using it on ARM, but I just thought this deserved your attention. Feel free to look into this or label as WONTFIX at your discretion.
aarch64-linux-gnu-gcc -Iwlrctl.p -I. -I.. -I../include -I/usr/aarch64-linux-gnu/usr/include -flto -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -Wno-unused-parameter -Wno-missing-braces '-DWLRCTL_VERSION="0.2.1"' -fstack-clash-protection -D_FORTIFY_SOURCE=2 -O2 -march=armv8-a -MD -MQ wlrctl.p/keyboard.c.o -MF wlrctl.p/keyboard.c.o.d -o wlrctl.p/keyboard.c.o -c ../keyboard.c ../keyboard.c: In function 'is_ascii': ../keyboard.c:83:14: error: comparison is always false due to limited range of data type [-Werror=type-limits] 83 | if (str[i] < 0) { | ^ cc1: all warnings being treated as errors
The signedness of a
char
is arch dependent. x86_64 defaults it to be signed, most other platforms default to unsigned. The compiler warning is definitely correct. See https://stackoverflow.com/questions/2054939/is-char-signed-or-unsigned-by-default#2054941
Wlrctl would be extremely useful on Raspberry Pi OS, which now uses Wayland. Many people are looking for a xdotool replacement, and this would be perfect. I hope the author can either fix this or make the error non-fatal. In the meantime, just add this line to line 21 of meson.build:
add_project_arguments('-Wno-type-limits', language: 'c')
Just tried to install on a Librem5 running PureOS Byzantium and ran into this problem, too. Would appreciate a solution also.
~botspots suggestion to compile anyway worked on the phone.
Use the cype
isascii
method instead of comparering the value of char, because the signedness of a char is arch dependent.#Closes: #4
keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/keyboard.c b/keyboard.c index 8dc090c..8cb5d83 100644 --- a/keyboard.c +++ b/keyboard.c @@ -90,7 +90,7 @@ static bool is_ascii(const char str[]) { for (int i = 0; str[i] != '\0'; i++) {
if (str[i] < 0) {
if (!isascii(str[i])) { return false; }
#}
2.45.2
Thanks, applied.