You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While amouse builds fine on my x86 Linux machine (Arch Linux), it was failing at link time on my Raspberry Pi:
$ make
gcc -g -Wall -c src/include/serial.c -o src/include/serial.o
gcc -g -Wall -c src/../../shared/utils.c -o src/include/utils.o
gcc -g -Wall -c src/../../shared/mouse.c -o src/include/mouse.o
gcc -g -Wall -levdev -I/usr/include/libevdev-1.0/libevdev -I./include -o bin/amouse src/include/serial.c src/include/wrappers.c src/amouse.c ../shared/mouse.c ../shared/utils.c
/usr/bin/ld: /tmp/cclZh5iy.o: in function `open_usbinput':
/home/mkaushik/usb/amouse/linux/src/amouse.c:131: undefined reference to `libevdev_new_from_fd'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:136: undefined reference to `libevdev_has_event_type'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:137: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:138: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:139: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:140: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:141: undefined reference to `libevdev_has_event_code'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:142: undefined reference to `libevdev_free'
/usr/bin/ld: /tmp/cclZh5iy.o: in function `main':
/home/mkaushik/usb/amouse/linux/src/amouse.c:233: undefined reference to `libevdev_new_from_fd'
/usr/bin/ld: /home/mkaushik/usb/amouse/linux/src/amouse.c:324: undefined reference to `libevdev_next_event'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: amouse] Error 1
To fix this, we need to add the --no-as-needed flag to CFLAGS in the Makefile, or move -levdev to be after the object file names in the final build command. Apparently the linker on Raspbian 11 has --as-needed set by default (see the man page for ld for details on why this causes problems when -levdev is before the object files)
The text was updated successfully, but these errors were encountered:
I had a look over this and while I can't easily directly test this at the moment, I've changed the order of parameters for the final linking so that the libraries are included last after the objects. That appears to be the most compatible way to handle this issue as "--no-as-needed" is not a fully standard flag from what I'm seeing.
This change is in the current cba115f commit of the dev branch.
While amouse builds fine on my x86 Linux machine (Arch Linux), it was failing at link time on my Raspberry Pi:
To fix this, we need to add the
--no-as-needed
flag to CFLAGS in the Makefile, or move-levdev
to be after the object file names in the final build command. Apparently the linker on Raspbian 11 has--as-needed
set by default (see the man page for ld for details on why this causes problems when -levdev is before the object files)The text was updated successfully, but these errors were encountered: