Xtr126 / wayland-getevent

GNU General Public License v3.0
27 stars 4 forks source link

Cage fails to build #11

Closed sudoharun closed 2 months ago

sudoharun commented 2 months ago

I get this error when doing ninja -C build:

Found ninja-1.12.1 at /usr/bin/ninja
ninja: Entering directory `build'                                                                                                                                                                                   
[301/301] Linking target cage
FAILED: cage 
cc  -o cage cage.p/cage.c.o cage.p/idle_inhibit_v1.c.o cage.p/output.c.o cage.p/seat.c.o cage.p/view.c.o cage.p/xdg_shell.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 '-Wl,-rpath,$ORIGIN/subprojects/wlroots' -Wl,-rpath-link,/home/harun/cage/build/subprojects/wlroots -Wl,--start-group subprojects/wlroots/libwlroots.so.12 /usr/lib/libwayland-server.so /usr/lib/libdrm.so /usr/lib/libxkbcommon.so /usr/lib/libpixman-1.so -lm -lrt /usr/lib/libEGL.so /usr/lib/libgbm.so /usr/lib/libGLESv2.so /usr/lib/libvulkan.so /usr/lib/libxcb.so /usr/lib/libxcb-dri3.so /usr/lib/libxcb-present.so /usr/lib/libxcb-render.so /usr/lib/libxcb-render-util.so /usr/lib/libxcb-shm.so /usr/lib/libxcb-xfixes.so /usr/lib/libxcb-xinput.so /usr/lib/libwayland-client.so -Wl,--end-group
/usr/bin/ld: cage.p/seat.c.o: in function `handle_keyboard_group_key':
seat.c:(.text+0x8dd): undefined reference to `wlr_session_change_vt'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
sudoharun commented 2 months ago

Nevermind, installing cage and wlroots fixed dependencies issues.

The very last command in README-alt does not work, however, it just shows > on a new line when running it and nothing happens. Making a script doesn't work either, and Waydroid closes with no errors in terminal either:

#!/bin/sh

the_function() {
    while [[ -z $(waydroid prop get sys.boot_completed) ]]; do
        sleep 1;
    done;
    echo -en \'\\033[032m\'
    exec sudo waydroid shell -- sh /sdcard/Android/data/xtr.keymapper/files/xtMapper.sh --wayland-client --width=$XTMAPPER_WIDTH --height=$XTMAPPER_HEIGHT
}

systemctl restart waydroid-container.service
export WLR_NO_DECORATION=1 XTMAPPER_WIDTH=1920 XTMAPPER_HEIGHT=1080
./build/cage waydroid show-full-ui | the_function
Xtr126 commented 2 months ago

Thanks for reporting this issue, turns out the command works in fish shell but not bash shell, I'll remove the color output for now.

sudoharun commented 2 months ago

That fixes the command, but then after it finishes executing, Waydroid just closes.

https://github.com/Xtr126/wayland-getevent/assets/123123333/4fdbea6a-ff02-4c51-bfab-b5200cdf9334

Xtr126 commented 2 months ago

That fixes the command, but then after it finishes executing, Waydroid just closes.

2024-07-09.13-45-21.mp4

It closes because xtMapper.sh did not proceed, most likely because it is not created if your waydroid container is rooted. This workaround may work

echo 'exec /system/bin/app_process -Djava.library.path=$(echo /data/app/*/xtr.keymapper*/lib/x86_64) -Djava.class.path=$(echo /data/app/*/xtr.keymapper*/base.apk) / xtr.keymapper.server.RemoteServiceShell "$@"' | sudo tee ~/.local/share/waydroid/data/media/0/Android/data/xtr.keymapper/files/xtMapper.sh
Xtr126 commented 2 months ago

The new cage_xtmapper.sh script solves the issue.

InternetRebelAKAQuachHungPhong commented 1 month ago

I think I installed wlroots from guix, and here's my log this time: ` git clone https://github.com/Xtr126/cage cd cage git submodule update --init patch -d subprojects/wlroots/ -p1 -i ../../0001-wlroots-wayland-confine-pointer.patch patch -d subprojects/wlroots/ -p1 -i ../../0002-wayland-decoration-envvar.patch patch -d subprojects/wlroots/ -p1 -i ../../0003-wlroots-wayland-backend-custom-size.patch patch -d subprojects/wlroots/ -p1 -i ../../0004-wlroots-x11-backend-custom-size.patch patch -d subprojects/wlroots/ -p1 -i ../../0005-wlroots-x11-confine-pointer.patch meson setup build --buildtype=release ninja -C build fatal: destination path 'cage' already exists and is not an empty directory. patching file backend/wayland/backend.c Hunk #1 FAILED at 30. Hunk #2 FAILED at 405. 2 out of 2 hunks FAILED -- saving rejects to file backend/wayland/backend.c.rej patching file backend/wayland/meson.build Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 1 out of 1 hunk ignored -- saving rejects to file backend/wayland/meson.build.rej patching file backend/wayland/pointer.c Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 3 out of 3 hunks ignored -- saving rejects to file backend/wayland/pointer.c.rej patching file include/backend/wayland.h Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 2 out of 2 hunks ignored -- saving rejects to file include/backend/wayland.h.rej patching file backend/wayland/backend.c Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 2 out of 2 hunks ignored -- saving rejects to file backend/wayland/backend.c.rej patching file backend/wayland/output.c Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 3 out of 3 hunks ignored -- saving rejects to file backend/wayland/output.c.rej patching file backend/x11/output.c Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 2 out of 2 hunks ignored -- saving rejects to file backend/x11/output.c.rej patching file backend/x11/output.c patch: *** malformed patch at line 33: + XCB_NONE, / confine_to = in which window should the cursor stay */

The Meson build system Version: 1.3.2 Source dir: /home/internet-rebel/cage Build dir: /home/internet-rebel/cage/build Build type: native build Project name: cage Project version: 0.1.5 C compiler for the host machine: cc (gcc 13.2.0 "cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0") C linker for the host machine: cc ld.bfd 2.42 Host machine cpu family: x86_64 Host machine cpu: x86_64

Executing subproject wlroots

wlroots| Project name: wlroots wlroots| Project version: 0.17.2 wlroots| C compiler for the host machine: cc (gcc 13.2.0 "cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0") wlroots| C linker for the host machine: cc ld.bfd 2.42 wlroots| Compiler for C supports arguments -Wundef: YES wlroots| Compiler for C supports arguments -Wlogical-op: YES wlroots| Compiler for C supports arguments -Wmissing-include-dirs: YES wlroots| Compiler for C supports arguments -Wold-style-definition: YES wlroots| Compiler for C supports arguments -Wpointer-arith: YES wlroots| Compiler for C supports arguments -Winit-self: YES wlroots| Compiler for C supports arguments -Wstrict-prototypes: YES wlroots| Compiler for C supports arguments -Wimplicit-fallthrough=2: YES wlroots| Compiler for C supports arguments -Wendif-labels: YES wlroots| Compiler for C supports arguments -Wstrict-aliasing=2: YES wlroots| Compiler for C supports arguments -Woverflow: YES wlroots| Compiler for C supports arguments -Wmissing-prototypes: YES wlroots| Compiler for C supports arguments -Walloca: YES wlroots| Compiler for C supports arguments -Wno-missing-braces: YES wlroots| Compiler for C supports arguments -Wno-missing-field-initializers: YES wlroots| Compiler for C supports arguments -Wno-unused-parameter: YES wlroots| Compiler for C supports arguments -fmacro-prefix-map=/prefix/to/hide=: YES wlroots| Found pkg-config: YES (/usr/bin/pkg-config) 1.8.1 wlroots| Run-time dependency wayland-server found: YES 1.22.0 wlroots| Found CMake: /usr/bin/cmake (3.28.3) wlroots| Run-time dependency libdrm found: NO (tried pkgconfig and cmake) wlroots| Looking for a fallback subproject for the dependency libdrm

subprojects/wlroots/meson.build:111:6: ERROR: Neither a subproject directory nor a libdrm.wrap file was found.

A full log can be found at /home/internet-rebel/cage/build/meson-logs/meson-log.txt ninja: Entering directory build' ninja: error: loading 'build.ninja': No such file or directory

It seems this time I don't have libdrm on the whole system or the project or something, but I found there's just libdrm2 and lots of dependencies searching 'libdrm'.

Well, gonna try some methods in this issue now. Anyway, would you like, share binaries you've possibly successfully built of your modification of Cage some time? And by the way, I succeed building wayland-getevent on my system when I tried building it myself, but its executable and the executable I downloaded seems to be the same.

Update: I installed cage via apt, probably a prebuilt wlroots from guix, and I still have your cage folder on my system, yet when I run the exact terminal line as instructed from you: sudo -E cage/cage_xtmapper.sh --user $(whoami) --window-width 1280 --window-height 720 --window-no-title-bar [sudo] password for internet-rebel: bash: line 1: ./build/cage: No such file or directory Waiting for overlay... using wayland client I got the same message from the getevent part, but I see no window anyway.; as I said, for some reason I never managed to build either your cage or wlroots on my own(also, what's with 1280:720?).

sudoharun commented 1 month ago

After installing cage and wlroots you still have to build.

Xtr126 commented 1 month ago

Yes, and the script should be run from the cage directory, otherwise it cannot use the built cage binary. There is an issue with the current release of XtMapper when using cage, so you have to wait for the next release or try this build: https://github.com/Xtr126/XtMapper/actions/runs/10539050472

Xtr126 commented 1 month ago

Well, gonna try some methods in this issue now. Anyway, would you like, share binaries you've possibly successfully built of your modification of Cage some time? And by the way, I succeed building wayland-getevent on my system when I tried building it myself, but its executable and the executable I downloaded seems to be the same.

cage and wlroots are system software that needs to interact deeply with the GPU driver and kernel, so I'm still not sure if it's a good idea to distribute binaries instead of building them. Usually they are installed with system package manager, tailored for each system. Upstream cage and wlroots projects also distribute only source code, no pre-builts. In my opinion, cage and wlroots are easiest to build on archlinux, even upstream cage uses archlinux/alpine for their CI build. Most Arch Linux systems running wayland already have the dependencies to build wlroots/cage, they can build straight-away. I always had dependency issues when trying to build them on Ubuntu, debian. These are the required dependencies: https://github.com/cage-kiosk/cage/blob/69c5eccc50457b268ff54dc7e07520dc3dc6df37/.github/workflows/main.yml#L53

InternetRebelAKAQuachHungPhong commented 1 month ago

So, is the log like this? sudo apt-get install xcb-util-wm seatd git clang meson libinput libdrm mesa libxkbcommon wayland wayland-protocols xorg-server-xwayland scdoc hwdata [sudo] password for internet-rebel: Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package xcb-util-wm E: Unable to locate package libinput E: Unable to locate package libdrm E: Unable to locate package mesa E: Unable to locate package libxkbcommon E: Unable to locate package wayland E: Unable to locate package xorg-server-xwayland Well, now I kinda regret I didn't pick Debian or an Arch distro; I updated XtMapper to the latest version(not just a 'release' version) and tried to use the current version of wayland-getevent, but it's almost impossible; yesterday I did two videos of Waydroid rooted and unrooted and the executable worked inputing touches, but now I can't make this work again a single time. It seems this version of this executable work best with the latest, uh, 'debug' version, meaning I can't make my own controls then export them to community right now. So why is it discontinued? I also see that the 'cage_xtmapper.sh' seem to only try to find a 'cage' executable in /cage/build when I tried to run it, meaning it won't use any other cage on my system. But it's also why I wondered if I just put a prebuilt cage executable in this directory then run the script, like for reference. I don't know, if there's a chat about XtMapper I might try to go there as well; anyway, keep on developing XtMapper, hope it gets known more by people around and is helped on more as well.

sudoharun commented 1 month ago

Try installing cage and wlroots via your package manager (might be sudo apt install cage wlroots since it looks like you are on a Debian-based system) THEN follow these instructions (you need git, meson and ninja installed for this).

Xtr126 commented 1 month ago

I also see that the 'cage_xtmapper.sh' seem to only try to find a 'cage' executable in /cage/build when I tried to run it, meaning it won't use any other cage on my system. But it's also why I wondered if I just put a prebuilt cage executable in this directory then run the script, like for reference.

System cage does not have the modifications required for XtMapper, so you have to build it.

Well, now I kinda regret I didn't pick Debian or an Arch distro; I updated XtMapper to the latest version(not just a 'release' version) and tried to use the current version of wayland-getevent, but it's almost impossible; yesterday I did two videos of Waydroid rooted and unrooted and the executable worked inputing touches, but now I can't make this work again a single time. It seems this version of this executable work best with the latest, uh, 'debug' version, meaning I can't make my own controls then export them to community right now. So why is it discontinued?

You can re-sign the builds with Android debug key and install the APK. Or build a debug version yourself.