Bug 246028 - games/retroarch: Fails to build with UDEV enabled
Summary: games/retroarch: Fails to build with UDEV enabled
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2020-04-29 13:24 UTC by Ivan Rozhuk
Modified: 2022-01-31 19:40 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (val)
koobs: merge-quarterly?


Attachments
patch (881 bytes, patch)
2020-05-12 08:33 UTC, Ivan Rozhuk
rozhuk.im: maintainer-approval?
Details | Diff
games.retroarch.patch (1.47 KB, patch)
2020-11-05 23:21 UTC, Vladimir Kondratyev
no flags Details | Diff
games.retroarch.patch (1.49 KB, patch)
2020-11-06 22:31 UTC, Vladimir Kondratyev
no flags Details | Diff
files/patch-input_input__keymaps.c (662 bytes, patch)
2022-01-31 19:10 UTC, Val Packett
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 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 Ivan Rozhuk 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 Ivan Rozhuk 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 Val Packett 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 Ivan Rozhuk 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 Ivan Rozhuk 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 freebsd_triage 2020-07-02 04:38:28 UTC
(In reply to rozhuk.im from comment #6)
Greg: are you ok with this patch?
Comment 8 Val Packett 2020-07-02 10:05:34 UTC
Does it build with UDEV off?
Comment 9 Ivan Rozhuk 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 Val Packett 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 freebsd_triage 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 freebsd_triage 2020-11-05 23:38:16 UTC
polkit sucks in rust and llvm90 through spidermonkey78 dependence. WTF?????
Comment 14 Ivan Rozhuk 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 freebsd_triage 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.
Comment 16 Ivan Rozhuk 2022-01-30 21:47:01 UTC
with latest update:

In file included from deps/switchres/custom_video.cpp:18:
./deps/switchres/custom_video.h:99:7: warning: private field 'm_device_name' is not used [-Wunused-private-field]
        char m_device_name[32];
             ^
./deps/switchres/custom_video.h:100:7: warning: private field 'm_device_key' is not used [-Wunused-private-field]
        char m_device_key[128];
             ^
./deps/switchres/custom_video.h:103:6: warning: private field 'm_custom_method' is not used [-Wunused-private-field]
        int m_custom_method;
            ^
3 warnings generated.
deps/switchres/edid.cpp:165:20: warning: implicit conversion from 'int' to 'char' changes value from 229 to -27 [-Wconstant-conversion]
        edid->b[66] = 485 & 0xff;
                    ~ ~~~~^~~~~~
1 warning generated.
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)
>>> 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)
Comment 17 Val Packett 2022-01-31 19:10:36 UTC
Created attachment 231472 [details]
files/patch-input_input__keymaps.c

(In reply to Ivan Rozhuk from comment #16)

This is because you're building without the WAYLAND option.

Try this as /usr/ports/games/retroarch/files/patch-input_input__keymaps.c
Comment 18 Ivan Rozhuk 2022-01-31 19:40:47 UTC
(In reply to Greg V from comment #17)

It work, thanks!