我正试图解决这个bug,因为作者不再响应bug报告:https://github.com/PeterCxy/evdev-right-click-emulation/issues/14
它本质上与下面报告的两个错误相同:https://github.com/PeterCxy/evdev-right-click-emulation/issues/12https://github.com/PeterCxy/evdev-right-click-emulation/issues/13
我想知道这是否可以通过修改Makefile来修复,但我不知道如何。
在安装了以下evdev相关软件包(apt list——installed | grep evdev)后,该程序在Raspbian 10上编译良好
libevdev-dev/oldstable,now 1.6.0+dfsg-1 armhf [installed]
libevdev-doc/oldstable,now 1.6.0+dfsg-1 all [installed]
libevdev-tools/oldstable,now 1.6.0+dfsg-1 armhf [installed]
libevdev2/oldstable,now 1.6.0+dfsg-1 armhf [installed]
python-evdev/oldstable,now 1.1.2+dfsg-1+b1 armhf [installed]
python3-evdev/oldstable,now 1.1.2+dfsg-1+b1 armhf [installed,automatic]
但是在Ubuntu Mate 20.04上安装了以下evdev相关的软件包后就失败了
libevdev-dev/focal-updates,now 1.9.0+dfsg-1ubuntu0.1 arm64 [installed]
libevdev-doc/focal-updates,now 1.9.0+dfsg-1ubuntu0.1 all [installed]
libevdev-tools/focal-updates,now 1.9.0+dfsg-1ubuntu0.1 arm64 [installed]
libevdev2/focal-updates,now 1.9.0+dfsg-1ubuntu0.1 arm64 [installed]
python3-libevdev/focal,now 0.5-1 all [installed]
xserver-xorg-input-evdev-dbg/focal,now 1:2.10.6-1 arm64 [installed]
xserver-xorg-input-evdev-dev-hwe-18.04/focal,now 3:14.5 arm64 [installed]
xserver-xorg-input-evdev-dev/focal,now 1:2.10.6-1 all [installed]
xserver-xorg-input-evdev-hwe-18.04-dbg/focal,now 3:14.5 arm64 [installed]
xserver-xorg-input-evdev-hwe-18.04/focal,now 3:14.5 arm64 [installed]
xserver-xorg-input-evdev/focal,now 1:2.10.6-1 arm64 [installed]
make failed with
gcc -Wall -std=c11 -D_POSIX_C_SOURCE=199309L -levdev -I/usr/include/libevdev-1.0 -c uinput.c -o out/uinput.o
gcc -Wall -std=c11 -D_POSIX_C_SOURCE=199309L -levdev -I/usr/include/libevdev-1.0 -c input.c -o out/input.o
gcc -Wall -std=c11 -D_POSIX_C_SOURCE=199309L -levdev -I/usr/include/libevdev-1.0 -c rce.c -o out/rce.o
gcc -Wall -std=c11 -D_POSIX_C_SOURCE=199309L -levdev -I/usr/include/libevdev-1.0 out/uinput.o out/input.o out/rce.o -o out/evdev-rce
/usr/bin/ld: out/uinput.o: in function `uinput_initialize':
uinput.c:(.text+0x1c): undefined reference to `libevdev_new'
/usr/bin/ld: uinput.c:(.text+0x30): undefined reference to `libevdev_set_name'
/usr/bin/ld: uinput.c:(.text+0x3c): undefined reference to `libevdev_enable_event_type'
/usr/bin/ld: uinput.c:(.text+0x50): undefined reference to `libevdev_enable_event_code'
/usr/bin/ld: uinput.c:(.text+0x68): undefined reference to `libevdev_uinput_create_from_device'
/usr/bin/ld: uinput.c:(.text+0x7c): undefined reference to `libevdev_free'
/usr/bin/ld: out/uinput.o: in function `uinput_send_right_click':
uinput.c:(.text+0xd0): undefined reference to `libevdev_uinput_write_event'
/usr/bin/ld: uinput.c:(.text+0xe4): undefined reference to `libevdev_uinput_write_event'
/usr/bin/ld: uinput.c:(.text+0xf8): undefined reference to `libevdev_uinput_write_event'
/usr/bin/ld: uinput.c:(.text+0x10c): undefined reference to `libevdev_uinput_write_event'
/usr/bin/ld: out/input.o: in function `free_evdev':
input.c:(.text+0x10): undefined reference to `libevdev_get_fd'
/usr/bin/ld: input.c:(.text+0x1c): undefined reference to `libevdev_free'
/usr/bin/ld: out/input.o: in function `build_fd_set':
input.c:(.text+0xfc): undefined reference to `libevdev_get_fd'
/usr/bin/ld: out/input.o: in function `process_evdev_input':
input.c:(.text+0x5a0): undefined reference to `libevdev_get_fd'
/usr/bin/ld: input.c:(.text+0x5d8): undefined reference to `libevdev_get_fd'
/usr/bin/ld: input.c:(.text+0x634): undefined reference to `libevdev_next_event'
/usr/bin/ld: input.c:(.text+0x6ac): undefined reference to `libevdev_uinput_destroy'
/usr/bin/ld: out/rce.o: in function `find_evdev':
rce.c:(.text+0x1bc): undefined reference to `libevdev_new_from_fd'
/usr/bin/ld: rce.c:(.text+0x214): undefined reference to `libevdev_has_event_type'
/usr/bin/ld: rce.c:(.text+0x228): undefined reference to `libevdev_has_event_type'
/usr/bin/ld: rce.c:(.text+0x240): undefined reference to `libevdev_has_event_code'
/usr/bin/ld: rce.c:(.text+0x258): undefined reference to `libevdev_has_event_code'
/usr/bin/ld: rce.c:(.text+0x268): undefined reference to `libevdev_get_name'
/usr/bin/ld: rce.c:(.text+0x34c): undefined reference to `libevdev_free'
collect2: error: ld returned 1 exit status
make: *** [Makefile:19: out/evdev-rce] Error 1
下面是Makefile的内容。:
CC := gcc
XFLAGS := -Wall -std=c11 -D_POSIX_C_SOURCE=199309L
LIBRARIES := -levdev
INCLUDES := -I/usr/include/libevdev-1.0
CFLAGS := $(XFLAGS) $(LIBRARIES) $(INCLUDES)
OUTDIR := out
SOURCES := uinput.c input.c rce.c
OBJS := $(SOURCES:%.c=$(OUTDIR)/%.o)
TARGET := $(OUTDIR)/evdev-rce
.PHONY: all clean
$(OUTDIR)/%.o: %.c
@mkdir -p $(OUTDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $^ -o $@
all: $(TARGET)
clean:
rm -rf $(OUTDIR)
libevdev相关文件包含
/usr/include/libevdev-1.0
/usr/include/libevdev-1.0/libevdev
/usr/include/libevdev-1.0/libevdev/libevdev-uinput.h
/usr/include/libevdev-1.0/libevdev/libevdev.h
/usr/include/gudev-1.0/gudev/gudevdevice.h
/usr/lib/aarch64-linux-gnu/libevdev.so
/usr/lib/aarch64-linux-gnu/libevdev.a
/usr/lib/aarch64-linux-gnu/pkgconfig/libevdev.pc
/usr/lib/aarch64-linux-gnu/libevdev.so.2
/usr/lib/aarch64-linux-gnu/qt5/plugins/generic/libqevdevkeyboardplugin.so
/usr/lib/aarch64-linux-gnu/qt5/plugins/generic/libqevdevtouchplugin.so
/usr/lib/aarch64-linux-gnu/qt5/plugins/generic/libqevdevmouseplugin.so
/usr/lib/aarch64-linux-gnu/qt5/plugins/generic/libqevdevtabletplugin.so
/usr/lib/aarch64-linux-gnu/libevdev.so.2.3.0
像这样编辑你的Makefile:
https://github.com/PeterCxy/evdev-right-click-emulation/pull/5/commits/06c9506ce8cbb4d741f852359d7b77e300b12e49
对我有用。基本上,将$(LIBRARIES)
从CFLAGS
中移除,并在$(CC)
命令行中将其添加到$^
和-o
之间。