extraFds build issue
tg-x opened this issue · comments
using gcc-9.3.0
$ make
[ 6%] Built target swtcon
Scanning dependencies of target rMlib
[ 7%] Building CXX object libs/rMlib/CMakeFiles/rMlib.dir/Input.cpp.o
In file included from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/sys-include/sys/select.h:123,
from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/sys-include/sys/types.h:179,
from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/sys-include/stdlib.h:394,
from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/include/c++/9.3.0/cstdlib:75,
from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/include/c++/9.3.0/ext/string_conversions.h:41,
from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/include/c++/9.3.0/bits/basic_string.h:6493,
from /nix/store/kj0fqg18lp9mghjl01g56naa6yl1yyq2-armv7l-unknown-linux-gnueabihf-stage-final-gcc-debug-9.3.0/armv7l-unknown-linux-gnueabihf/include/c++/9.3.0/string:55,
from /home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Error.h:4,
from /home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Input.h:3,
from /home/dev/src/remarkable/rM2-stuff/libs/rMlib/Input.cpp:1:
/home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Input.h: In member function ‘std::optional<typename std::conditional<(sizeof... (ExtraFds) == 0), std::vector<std::variant<rmlib::input::TouchEvent, rmlib::input::PenEvent, rmlib::input::KeyEvent> >, std::pair<std::vector<std::variant<rmlib::input::TouchEvent, rmlib::input::PenEvent, rmlib::input::KeyEvent> >, std::array<bool, sizeof... (ExtraFds)> > >::type> rmlib::input::InputManager::waitForInput(std::optional<std::chrono::duration<long long int, std::ratio<1, 1000000> > >, ExtraFds ...)’:
/home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Input.h:114:13: error: parameter packs not expanded with ‘...’:
114 | (FD_SET(extraFds, &fds), ...);
| ^
/home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Input.h:114:13: note: ‘extraFds’
/home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Input.h:129:37: error: parameter packs not expanded with ‘...’:
129 | ((extraResult[i++] = FD_ISSET(extraFds, &fds)), ...);
| ^
/home/dev/src/remarkable/rM2-stuff/libs/rMlib/include/Input.h:129:37: note: ‘extraFds’
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-gnu-statement-expression’
make[2]: *** [libs/rMlib/CMakeFiles/rMlib.dir/build.make:82: libs/rMlib/CMakeFiles/rMlib.dir/Input.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:361: libs/rMlib/CMakeFiles/rMlib.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
I can't reproduce this:
[I] timo@ubuntu ~/m/S/P/r/build> make rMlib
[ 20%] Building CXX object libs/rMlib/CMakeFiles/rMlib.dir/Input.cpp.o
[ 40%] Building CXX object libs/rMlib/CMakeFiles/rMlib.dir/Device.cpp.o
[ 60%] Building CXX object libs/rMlib/CMakeFiles/rMlib.dir/FrameBuffer.cpp.o
[ 80%] Building CXX object libs/rMlib/CMakeFiles/rMlib.dir/Canvas.cpp.o
[100%] Linking CXX static library librMlib.a
[100%] Built target rMlib
[I] timo@ubuntu ~/m/S/P/r/build> gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But I suspect the issue is not with gcc but the implementation of FD_SET
and FD_ISSET
which would be the c standard library. I've changed the code to not use macros in the parameter pack, let me know if it fixes your issue.
yes, this resolved the issue for me
now I get this:
$ make
[ 45%] Built target rMlib
[ 54%] Building CXX object apps/yaft/CMakeFiles/yaft.dir/keyboard.cpp.o
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:24:3: error: modification of ‘<temporary>’ is not a constant expression
24 | };
| ^
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:126:1: error: modification of ‘<temporary>’ is not a constant expression
126 | };
| ^
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:127:29: error: non-constant condition for static assertion
127 | static_assert(layout.size() == num_rows);
| ~~~~~~~~~~~~~~^~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:140:42: error: modification of ‘<temporary>’ is not a constant expression
140 | { "\\n", Enter } } };
| ^
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp: In member function ‘void Keyboard::sendKeyDown(const Keyboard::Key&) const’:
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:421:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
421 | write(term->fd, code, strlen(code));
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp: In function ‘void {anonymous}::handleScreenEvent(Keyboard&, const Event&) [with Event = rmlib::input::PenEvent]’:
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:516:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
516 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:527:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
527 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:531:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
531 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp: In function ‘void {anonymous}::handleScreenEvent(Keyboard&, const Event&) [with Event = rmlib::input::TouchEvent]’:
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:516:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
516 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:527:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
527 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:531:10: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
531 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp: In function ‘void {anonymous}::handleGesture(Keyboard&, const rmlib::input::SwipeGesture&)’:
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:476:12: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
476 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dev/src/remarkable/rM2-stuff/apps/yaft/keyboard.cpp:481:12: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
481 | write(kb.term->fd, buf.data(), buf.size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-gnu-statement-expression’
make[2]: *** [apps/yaft/CMakeFiles/yaft.dir/build.make:134: apps/yaft/CMakeFiles/yaft.dir/keyboard.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:551: apps/yaft/CMakeFiles/yaft.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
That's a gcc bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92181), I'll see if I can work around it. If possible you can try compiling with clang.
- is gcc version here the same gcc that is compiling? i thought it would be the toolchain version, like:
okay@chalk:~/tonka/src/remarkable/rM2-stuff$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
or
okay@chalk:~/tonka/src/remarkable/rM2-stuff$ arm-oe-linux-gnueabi-gcc --version
arm-oe-linux-gnueabi-gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
okay@chalk:~/tonka/src/remarkable/rM2-stuff$ arm-remarkable-linux-gnueabi-gcc --version
arm-remarkable-linux-gnueabi-gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
okay@chalk:~/tonka/src/remarkable/rM2-stuff$ arm-remarkable-linux-musl-gcc --version
arm-remarkable-linux-musl-gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- maybe using docker images will help. toltec has some: https://github.com/toltec-dev/toolchain, would use with
FROM ghcr.io/toltec-dev/<name>:<version>
in Dockerfile.
Should work with gcc now
indeed, it does compile now.
built it with the following shell.nix:
with import <nixpkgs> {
crossSystem = {
config = "armv7l-unknown-linux-gnueabihf";
platform = {
name = "zero-sugar";
kernelBaseConfig = "zero-sugar_defconfig";
kernelArch = "arm";
kernelDTB = true;
kernelAutoModules = false;
kernelPreferBuiltin = true;
kernelTarget = "zImage";
gcc = {
cpu = "cortex-a7";
fpu = "neon-vfpv4";
float-abi = "hard";
};
};
};
};
mkShell {
nativeBuildinputs = with pkgs; [
cmake
];
buildInputs = with pkgs; [
libevdev
];
cmakeFlags = [
"-DLIBEVDEV_INCLUDE_DIR=${pkgs.libevdev}/include/libevdev-1.0/libevdev"
"-DLIBEVDEV_LIBRARY=${pkgs.libevdev}/lib/libevdev.so"
];
}
$ nix-shell
$ cmake $cmakeFlags .
$ make
$ patchelf --set-interpreter /lib/ld-2.27.so apps/yaft/yaft
Note: the remarkable2 system definition has only recently been added and thus missing from 20.09, that's why it's replicated here, could also pin this to a newer nixpkgs.