Bug 246028

Summary: games/retroarch: Fails to build with UDEV enabled
Product: Ports & Packages Reporter: rozhuk.im
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Open ---    
Severity: Affects Some People CC: greg, lwhsu, rozhuk.im, wulf
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (greg)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch
rozhuk.im: maintainer-approval?
games.retroarch.patch
none
games.retroarch.patch none

Description rozhuk.im 2020-04-29 13:24:45 UTC
...
CC input/drivers/udev_input.c
CC input/drivers_joypad/udev_joypad.c
CC input/drivers_hid/libusb_hid.c
input/drivers/udev_input.c:54:10:CC input/drivers_joypad/hid_joypad.c
 fatal error: 'linux/kd.h' file not found
#include <linux/kd.h>
         ^~~~~~~~~~~~
CC input/connect/joypad_connection.c
CC input/connect/connect_ps2adapter.c
1 error generated.
gmake[2]: *** [Makefile:207: obj-unix/release/input/drivers/udev_input.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
...


WAYLAND_BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto \
			${LOCALBASE}/include/linux/kd.h:graphics/svgalib

but I unset WAYLAND and set UDEV.
Comment 1 rozhuk.im 2020-04-29 13:27:42 UTC
I install graphics/svgalib by hands, but get next error:
...
CC libretro-common/rthreads/tpool.c
CC tasks/task_decompress.c
LD retroarch
ld: error: undefined symbol: rarch_key_map_linux
>>> referenced by udev_input.c
>>>               obj-unix/release/input/drivers/udev_input.o:(udev_input_init)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [Makefile:202: retroarch] Error 1
gmake[2]: Leaving directory '/tmp/ports/usr/ports/games/retroarch/work/RetroArch-1.8.5'
...
Comment 2 rozhuk.im 2020-04-29 13:49:20 UTC
By default cores dir is: /usr/local/lib/libretro
but all cores installed to /usr/local/libexec/libretro

can it be fixed too?
Comment 3 Greg V 2020-04-29 16:45:22 UTC
> rarch_key_map_linux

That is ifdef'd to linux||HAVE_WAYLAND too. I guess I'll just set UDEV_IMPLIES=WAYLAND in the next update.

> By default cores dir is: /usr/local/lib/libretro but all cores installed to /usr/local/libexec/libretro

PREFIX/lib/libretro is the modern directory — upstream emulator ports (emulators/mgba, emulators/mesen and emulators/ppsspp) already install their cores there!

Looks like the games/libretro* core ports that were just committed are installing to the wrong directory. Daniel please fix :)
Comment 4 rozhuk.im 2020-04-29 18:45:26 UTC
Greg, please, I'm not ready to wayland :)

Just add
UDEV_BUILD_DEPENDS=	${LOCALBASE}/include/linux/kd.h:graphics/svgalib

and probably some simple regexp patch to fix rarch_key_map_linux.
Comment 5 Daniel Menelkir 2020-04-29 23:41:11 UTC
(In reply to Greg V from comment #3)

Fixed, I'll send a bug report asap.
Comment 6 rozhuk.im 2020-05-12 08:33:24 UTC
Created attachment 214406 [details]
patch

With this build and work ok.
No wayland required.
Comment 7 Li-Wen Hsu freebsd_committer 2020-07-02 04:38:28 UTC
(In reply to rozhuk.im from comment #6)
Greg: are you ok with this patch?
Comment 8 Greg V 2020-07-02 10:05:34 UTC
Does it build with UDEV off?
Comment 9 rozhuk.im 2020-07-02 11:57:58 UTC
(In reply to Greg V from comment #8)

No
input/input_keymaps.c:50:10: fatal error: 'linux/kd.h' file not found
#include <linux/kd.h>
         ^~~~~~~~~~~~

Looks like should fix this.
BUILD_DEPENDS+=	${LOCALBASE}/include/linux/kd.h:graphics/svgalib
Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2020-07-03 02:26:28 UTC
^Triage: What is the conditionality of this build fix? Is the default build/connfiguration (options, etc) affected?

Note also: Build fixes are:

Approved by: portmgr (blanket: build fix)
MFH: <branch|no> <reason> (if quarterly is affected)
Comment 11 Greg V 2020-07-03 09:08:01 UTC
(In reply to Kubilay Kocak from comment #10)
No, the default configuration is fine. This is about when WAYLAND is off.
Comment 12 Vladimir Kondratyev freebsd_committer 2020-11-05 23:21:37 UTC
Created attachment 219378 [details]
games.retroarch.patch

Slightly improved version of PR's patch.

Changes are:

1. linux/input.h is installed unconditionally.
2. dummy linux/kd.h is created unconditionally too, so svgalib is not needed anymore.

That should make port buildable with any combination of WAYLAND and UDEV options.
Comment 13 Vladimir Kondratyev freebsd_committer 2020-11-05 23:38:16 UTC
polkit sucks in rust and llvm90 through spidermonkey78 dependence. WTF?????
Comment 14 rozhuk.im 2020-11-06 09:06:16 UTC
(In reply to Vladimir Kondratyev from comment #12)

> 1. linux/input.h is installed unconditionally.

good catch!

> 2. dummy linux/kd.h is created unconditionally too, so svgalib is not needed anymore.

If no staff from linux/kd.h used then probably better comment/remove in source files?


> polkit sucks in rust and llvm90 through spidermonkey78 dependence. WTF?????

Yes, rust is crap!
https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35
Comment 15 Vladimir Kondratyev freebsd_committer 2020-11-06 22:31:01 UTC
Created attachment 219406 [details]
games.retroarch.patch

> If no staff from linux/kd.h used then probably better comment/remove in source files?
Here you are.

> Yes, rust is crap!
> https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35
I don't think that the rust is guilty. It looks like the wrong embedded interpreter library was chosen by polkit authors at the day 0.