libinput_drv.so , libinput.so.10.13.0 fail to build for ARM64 FreeBSD 14.0-CURRENT source tree, versionsort() function declaration problem

Fred Finster <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
Hello Xorg maintainers,  I apologize for throwing so much information 
over the wall to point out a simple issue of broken software for

versionsort()  function, that is an update to file 
/usr/src/lib/libc/gen/scandir.c

My inexperience, gets me close to a solution, yet "No Cigar" for the answer.

I tried to learn much on my own and figure out where the fault is, 
before asking you.  I am sure it will be a missing line or a missing 
define somewhere easy to see, with your experience in the Xorg files.

I was using FreeBSD 14.0-CURRENT software and pkgs.    "pkg update"  
"pkg upgrade"    At somepoint,  "startx"  would show a desktop 
environment, yet no keyboad or mouse input was received.  SSH 
[email protected] into the raspberry pi 4B and displaying 
/var/log/Xorg.0.log showed a failure of libinput_drv.so

[ 3730.553] (EE) Failed to load 
/usr/local/lib/xorg/modules/input/libinput_drv.so: 
/usr/local/lib/libinput.so.10: Undefined symbol "versionsort@FBSD_1.7"

I thought patiently waiting, someone else will find and fix this 
problem, and then a pkg update pkg upgrade sequence will pull in the fix 
and the desktop will work again.
So today,  I searched, grepped, read, tested building 
/usr/ports/x11/libinput  and still have not got a solution except to 
comment out the single line 1062 in quirks.c file. Built and then 
another test file  tools/libinput-record.c is broken.
So at your own pace and time, take a look an update  the ARM64 source 
tree to fix this broken use of  versionsort() function.

Thank you,

Fred Finster


 From Xorg Maintainers doc
xinput
P:      Peter Hutterer
M: [email protected]
L: [email protected]
W: https://gitlab.freedesktop.org/xorg/app/xinput
S:      Maintained

xf86-input-keyboard
P:      Alan Coopersmith
M: [email protected]
L: [email protected]
W: https://gitlab.freedesktop.org/xorg/driver/xf86-input-keyboard
S:      Maintained

xf86-input-mouse
P:      Alan Coopersmith
M: [email protected]
L: [email protected]
W: https://gitlab.freedesktop.org/xorg/driver/xf86-input-mouse
S:      Maintained

Input subsystem
P:      Daniel Stone
M: [email protected]
P:      Peter Hutterer
M: [email protected]
L: [email protected]
W: https://wiki.x.org
S:      Maintained, being overhauled
S:      Please contact Daniel or Peter if you're planning to work on this

HERE I POSTED all the information I could find to fix my own problem.  
Alas, I am not experienced enough to solve this 'versionsort' missing 
error on my blog post here below.
https://ghostbsd-arm64.blogspot.com/2022/11/libinput-module-error-fbsd17-not-found.html

I can see 'versionsort' defined in with file 
/usr/src/lib/libc/gen/scandir.c   and  /usr/src/include/dirent.h

is ___BSD_VISIBLE defined??





libinput.so.10.13.0 is broken,  from updating software portsnap fetch 
update;  Then building /usr/ports/x11/libinput and having an issue with 
versionsort() function being defined
Is that a broken "for ARM64 source code tree" with #define __BSD_VISIBLE 
1 and #define __POSIX_VISIBLE 200809


Okay,  I do see below, that I mixed grep source with my GhostBSD 
fredTC93-pc x86_64 and my Raspberry Pi 4B Fred_RasPi4B ARM64:

WHY in file /usr/src/include/dirent.h  is there not a matching 
declaration line for versionsort()  ?
I see that updated software November 13, 2022 has versionsort() declared 
at line /usr/src/include/dirent.h:111:int

fred@fredTC93-pc /u/src> grep -in sort ./include/dirent.h ./sys/sys/dirent.
./include/dirent.h:107:intalphasort(const struct dirent **, const struct 
dirent **);

root@Fred_RasPi4B:/usr/src/include # grep -in sort 
/usr/src/include/dirent.h /usr/src/sys/sys/dirent.h
/usr/src/include/dirent.h:107:int     alphasort(const struct dirent **, 
const struct dirent **);
/usr/src/include/dirent.h:111:int     versionsort(const struct dirent 
**, const struct dirent **);


fred@fredTC93-pc /u/src> cd /usr/ports/x11
fred@fredTC93-pc /u/p/x11> grep -inr scandir *
evtest/files/patch-evtest.c:16:-ndev = scandir(DEV_INPUT_EVENT, 
&namelist, is_event_device, versionsort);
evtest/files/patch-evtest.c:17:+ndev = scandir(DEV_INPUT_EVENT, 
&namelist, is_event_device, alphasort);
fred@fredTC93-pc /u/p/x11>

LIKE:
./include/dirent.h:108:int versionsort(const struct dirent **, const 
struct dirent **);




root@Fred_RasPi4B:/usr/ports/x11/libinput # grep -inr versionsort *
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/meson.build:114:if 
cc.has_header_symbol('dirent.h', 'versionsort', prefix : prefix)
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/meson.build:115: 
config_h.set('HAVE_VERSIONSORT', '1')
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/quirks/README.md:22:Data 
files are read in versionsort order, read order determines how values
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/libinput-versionsort.h:31:#if 
!defined(HAVE_VERSIONSORT) || defined(TEST_VERSIONSORT)
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/libinput-versionsort.h:67:#ifndef 
HAVE_VERSIONSORT
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/libinput-versionsort.h:75:versionsort(const 
struct dirent **a, const struct dirent **b)
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/quirks.c:42:#include 
"libinput-versionsort.h"
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/quirks.c:1092: 
ndev = scandir(data_path, &namelist, is_data_file, versionsort);
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/test/litest.c:1487: 
            versionsort);
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/test/test-utils.c:39:#define 
TEST_VERSIONSORT
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/test/test-utils.c:40:#include 
"libinput-versionsort.h"
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/tools/libinput-record.c:46:#include 
"libinput-versionsort.h"
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/tools/libinput-record.c:1881: 
ndev = scandir("/dev/input", &namelist, is_event_node, versionsort);
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/tools/libinput-record.c:1943: 
ndev = scandir("/dev/input", &namelist, is_event_node, versionsort);
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/meson.build.orig:114:if 
cc.has_header_symbol('dirent.h', 'versionsort', prefix : prefix)
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/meson.build.orig:115: 
config_h.set('HAVE_VERSIONSORT', '1')
Binary file 
work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/_build/meson-private/coredata.dat 
matches


root@Fred_RasPi4B:/usr/ports/x11/libinput/work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/_build/meson-logs 
# grep -inr versionsort *
meson-log.txt:323:            #ifndef versionsort
meson-log.txt:324:                versionsort;
meson-log.txt:332:                versionsort;
meson-log.txt:336:Header "dirent.h" has symbol "versionsort" : YES
root@Fred_RasPi4B:/usr/ports/x11/libinput/work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/_build/meson-logs 
#


root@Fred_RasPi4B:/usr/src/lib/libc/gen # ls -l scandir*
-rw-r--r--  1 root  wheel  5018 Nov 13 00:36 scandir-compat11.c
-rw-r--r--  1 root  wheel  5306 Nov 13 00:36 scandir.3
-rw-r--r--  1 root  wheel  5965 Nov 13 00:36 scandir.c
-rw-r--r--  1 root  wheel  1416 Aug  5 12:24 scandir_b.c


partial file  /usr/src/lib/libc/gen/scandir.c
#ifndef _KERNEL

__BEGIN_DECLS
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
int      alphasort(const struct dirent **, const struct dirent **);
int      dirfd(DIR *);
#endif
#if __BSD_VISIBLE
int      versionsort(const struct dirent **, const struct dirent **);
DIR     *__opendir2(const char *, int);
int      fdclosedir(DIR *);
ssize_t  getdents(int, char *, size_t);
ssize_t  getdirentries(int, char *, size_t, off_t *);
#endif
DIR     *opendir(const char *);
DIR     *fdopendir(int);
struct dirent *
          readdir(DIR *);
#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
int      readdir_r(DIR *, struct dirent *, struct dirent **);
#endif
void     rewinddir(DIR *);
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700
int      scandir(const char *, struct dirent ***,
             int (*)(const struct dirent *), int (*)(const struct dirent **,
             const struct dirent **));
#ifdef __BLOCKS__
int      scandir_b(const char *, struct dirent ***,
             int (^)(const struct dirent *),
             int (^)(const struct dirent **, const struct dirent **));
#endif
#endif
#if __BSD_VISIBLE
int      scandirat(int, const char *, struct dirent ***,
             int (*)(const struct dirent *), int (*)(const struct dirent **,
             const struct dirent **));
#endif
#if __XSI_VISIBLE
void     seekdir(DIR *, long);
long     telldir(DIR *);
#endif
int      closedir(DIR *);
__END_DECLS

#endif /* !_KERNEL */

#endif /* !_DIRENT_H_ */




~~~~~~~~~~EOF~~~~~~~~

root@Fred_RasPi4B:/usr/ports/x11/libinput # make clean
===>  Cleaning for ninja-1.11.1,2
===>  Cleaning for pkgconf-1.8.0_1,1
===>  Cleaning for libinput-1.22.0


root@Fred_RasPi4B:/usr/ports/x11/libinput # make -dn
===>  Building for libinput-1.22.0
[  3% 1/32] cc  -o libinput.so.10.13.0 
libinput.so.10.13.0.p/src_filter.c.o 
libinput.so.10.13.0.p/src_filter-flat.c.o 
libinput.so.10.13.0.p/src_filter-low-dpi.c.o 
libinput.so.10.13.0.p/src_filter-mouse.c.o 
libinput.so.10.13.0.p/src_filter-touchpad.c.o 
libinput.so.10.13.0.p/src_filter-touchpad-flat.c.o 
libinput.so.10.13.0.p/src_filter-touchpad-x230.c.o 
libinput.so.10.13.0.p/src_filter-tablet.c.o 
libinput.so.10.13.0.p/src_filter-trackpoint.c.o 
libinput.so.10.13.0.p/src_filter-trackpoint-flat.c.o 
libinput.so.10.13.0.p/src_libinput.c.o 
libinput.so.10.13.0.p/src_libinput-private-config.c.o 
libinput.so.10.13.0.p/src_evdev.c.o 
libinput.so.10.13.0.p/src_evdev-debounce.c.o 
libinput.so.10.13.0.p/src_evdev-fallback.c.o 
libinput.so.10.13.0.p/src_evdev-totem.c.o 
libinput.so.10.13.0.p/src_evdev-middle-button.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-tap.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-thumb.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-buttons.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-edge-scroll.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-gestures.c.o 
libinput.so.10.13.0.p/src_evdev-tablet.c.o 
libinput.so.10.13.0.p/src_evdev-tablet-pad.c.o 
libinput.so.10.13.0.p/src_evdev-tablet-pad-leds.c.o 
libinput.so.10.13.0.p/src_evdev-wheel.c.o 
libinput.so.10.13.0.p/src_path-seat.c.o 
libinput.so.10.13.0.p/src_udev-seat.c.o 
libinput.so.10.13.0.p/src_timer.c.o -Wl,--as-needed -Wl,--no-undefined 
-Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libinput.so.10 
-fstack-protector-strong -O2 -pipe -fstack-protector-strong -isystem 
/usr/local/include -fno-strict-aliasing -isystem /usr/local/include 
-Wl,-rpath,/usr/local/lib -Wl,-rpath-link,/usr/local/lib 
liblibinput-util.a libquirks.a 
-Wl,--version-script,/usr/ports/x11/libinput/work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/libinput.sym 
/usr/local/lib/libmtdev.so /usr/local/lib/libudev.so 
/usr/local/lib/libevdev.so /usr/local/lib/libepoll-shim.so -lrt -lm 
/usr/local/lib/libwacom.so -Wl,--end-group
FAILED: libinput.so.10.13.0
cc  -o libinput.so.10.13.0 libinput.so.10.13.0.p/src_filter.c.o 
libinput.so.10.13.0.p/src_filter-flat.c.o 
libinput.so.10.13.0.p/src_filter-low-dpi.c.o 
libinput.so.10.13.0.p/src_filter-mouse.c.o 
libinput.so.10.13.0.p/src_filter-touchpad.c.o 
libinput.so.10.13.0.p/src_filter-touchpad-flat.c.o 
libinput.so.10.13.0.p/src_filter-touchpad-x230.c.o 
libinput.so.10.13.0.p/src_filter-tablet.c.o 
libinput.so.10.13.0.p/src_filter-trackpoint.c.o 
libinput.so.10.13.0.p/src_filter-trackpoint-flat.c.o 
libinput.so.10.13.0.p/src_libinput.c.o 
libinput.so.10.13.0.p/src_libinput-private-config.c.o 
libinput.so.10.13.0.p/src_evdev.c.o 
libinput.so.10.13.0.p/src_evdev-debounce.c.o 
libinput.so.10.13.0.p/src_evdev-fallback.c.o 
libinput.so.10.13.0.p/src_evdev-totem.c.o 
libinput.so.10.13.0.p/src_evdev-middle-button.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-tap.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-thumb.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-buttons.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-edge-scroll.c.o 
libinput.so.10.13.0.p/src_evdev-mt-touchpad-gestures.c.o 
libinput.so.10.13.0.p/src_evdev-tablet.c.o 
libinput.so.10.13.0.p/src_evdev-tablet-pad.c.o 
libinput.so.10.13.0.p/src_evdev-tablet-pad-leds.c.o 
libinput.so.10.13.0.p/src_evdev-wheel.c.o 
libinput.so.10.13.0.p/src_path-seat.c.o 
libinput.so.10.13.0.p/src_udev-seat.c.o 
libinput.so.10.13.0.p/src_timer.c.o -Wl,--as-needed -Wl,--no-undefined 
-Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libinput.so.10 
-fstack-protector-strong -O2 -pipe -fstack-protector-strong -isystem 
/usr/local/include -fno-strict-aliasing -isystem /usr/local/include 
-Wl,-rpath,/usr/local/lib -Wl,-rpath-link,/usr/local/lib 
liblibinput-util.a libquirks.a 
-Wl,--version-script,/usr/ports/x11/libinput/work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/src/libinput.sym 
/usr/local/lib/libmtdev.so /usr/local/lib/libudev.so 
/usr/local/lib/libevdev.so /usr/local/lib/libepoll-shim.so -lrt -lm 
/usr/local/lib/libwacom.so -Wl,--end-group
ld: error: undefined symbol: versionsort
 >>> referenced by quirks.c
 >>> libquirks.a.p/src_quirks.c.o:(quirks_init_subsystem) in archive 
libquirks.a
 >>> referenced by quirks.c
 >>> libquirks.a.p/src_quirks.c.o:(quirks_init_subsystem) in archive 
libquirks.a
cc: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/x11/libinput
*** Error code 1

Stop.
make: stopped in /usr/ports/x11/libinput
root@Fred_RasPi4B:/usr/ports/x11/libinput #

root@Fred_RasPi4B:/usr/ports/x11/libinput/work/libinput-fc59e574e050c502c9a3adefacf97babf3d09c7a/tools 
# grep -in versionsort *
libinput-record.c:46:#include "libinput-versionsort.h"
libinput-record.c:1881:    ndev = scandir("/dev/input", &namelist, 
is_event_node, versionsort);
libinput-record.c:1943:    ndev = scandir("/dev/input", &namelist, 
is_event_node, versionsort);

-- 
Fred  Finster
[email protected]
+1 971-718-9144
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.