Bug 240964 - devel/libmtdev needs run_depends on evdev-proto
Summary: devel/libmtdev needs run_depends on evdev-proto
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Hans Petter Selasky
URL: https://lists.freebsd.org/pipermail/f...
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2019-10-01 09:16 UTC by Walter Schwarzenfeld
Modified: 2021-11-10 21:19 UTC (History)
16 users (show)

See Also:
tcberner: maintainer-feedback+
meta: merge-quarterly?


Attachments
patch (1.69 KB, text/plain)
2019-10-04 01:19 UTC, Koichiro Iwao
tcberner: maintainer-approval-
Details
devel/evdev-proto: Use the same include guard as base (2.02 KB, patch)
2019-10-08 15:38 UTC, Ting-Wei Lan
lantw44: maintainer-approval? (x11)
lantw44: maintainer-approval? (hselasky)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Schwarzenfeld 2019-10-01 09:16:41 UTC
Update to 5.13.0 failed (12amd64) with:

--- sub-input-all ---
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:27:8: error: redefinition of 'input_event'
struct input_event {
       ^
/usr/include/dev/evdev/input.h:44:8: note: previous definition is here
struct input_event {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:53:8: error: redefinition of 'input_id'
struct input_id {
       ^
/usr/include/dev/evdev/input.h:53:8: note: previous definition is here
struct input_id {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:84:8: error: redefinition of 'input_absinfo'
struct input_absinfo {
       ^
/usr/include/dev/evdev/input.h:60:8: note: previous definition is here
struct input_absinfo {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:108:8: error: redefinition of 'input_keymap_entry'
struct input_keymap_entry {
       ^
/usr/include/dev/evdev/input.h:71:8: note: previous definition is here
struct input_keymap_entry {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:300:8: error: redefinition of 'ff_replay'
struct ff_replay {
       ^
/usr/include/dev/evdev/input.h:164:8: note: previous definition is here
struct ff_replay {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:310:8: error: redefinition of 'ff_trigger'
struct ff_trigger {
       ^
/usr/include/dev/evdev/input.h:170:8: note: previous definition is here
struct ff_trigger {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:327:8: error: redefinition of 'ff_envelope'
struct ff_envelope {
       ^
/usr/include/dev/evdev/input.h:176:8: note: previous definition is here
struct ff_envelope {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:339:8: error: redefinition of 'ff_constant_effect'
struct ff_constant_effect {
       ^
/usr/include/dev/evdev/input.h:183:8: note: previous definition is here
struct ff_constant_effect {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:350:8: error: redefinition of 'ff_ramp_effect'
struct ff_ramp_effect {
       ^
/usr/include/dev/evdev/input.h:188:8: note: previous definition is here
struct ff_ramp_effect {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:366:8: error: redefinition of 'ff_condition_effect'
struct ff_condition_effect {
       ^
/usr/include/dev/evdev/input.h:194:8: note: previous definition is here
struct ff_condition_effect {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:395:8: error: redefinition of 'ff_periodic_effect'
struct ff_periodic_effect {
       ^
/usr/include/dev/evdev/input.h:221:8: note: previous definition is here
struct ff_periodic_effect {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:416:8: error: redefinition of 'ff_rumble_effect'
struct ff_rumble_effect {
       ^
/usr/include/dev/evdev/input.h:232:8: note: previous definition is here
struct ff_rumble_effect {
       ^
In file included from evdevtouch/qevdevtouchhandler.cpp:62:
In file included from /usr/local/include/mtdev.h:36:
/usr/local/include/linux/input.h:444:8: error: redefinition of 'ff_effect'
struct ff_effect {
       ^
/usr/include/dev/evdev/input.h:253:8: note: previous definition is here
struct ff_effect {
       ^
13 errors generated.
*** [.obj/qevdevtouchhandler.o] Error code 1

make[3]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport/input
1 error

make[3]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport/input
*** [sub-input-support-pro-all-ordered] Error code 2

make[2]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport/input
1 error

make[2]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport/input
*** [sub-input-all] Error code 2

make[1]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport
--- sub-linuxaccessibility-all ---
A failure has been detected in another branch of the parallel make

make[2]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport/linuxaccessibility
*** [sub-linuxaccessibility-all] Error code 2

make[1]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport
2 errors

make[1]: stopped in /ram/usr/ports/x11-toolkits/qt5-gui/work/qtbase-everywhere-src-5.13.0/src/platformsupport
*** Error code 2

Stop.
make: stopped in /usr/ports/x11-toolkits/qt5-gui

===>>> make build failed for x11-toolkits/qt5-gui
===>>> Aborting update

===>>> Update for qt5-gui-5.12.2_1 failed
===>>> Aborting update
Comment 1 Walter Schwarzenfeld 2019-10-01 09:17:47 UTC
It builds if I remove in 

src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp:

     52 #ifdef Q_OS_FREEBSD
     53 #include <dev/evdev/input.h>
     54 #else
     55 #include <linux/input.h>
     56 #endif
     57
Comment 2 Anders Bolt-Evensen 2019-10-01 15:29:03 UTC
Can confirm I have the same issue, and the provided workaround worked for me too.
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2019-10-01 16:06:54 UTC
(In reply to Anders Bolt-Evensen from comment #2)
Same here too!
Comment 4 Tobias C. Berner freebsd_committer freebsd_triage 2019-10-01 16:13:14 UTC
Moin moin 

How can you produce the error? Are you building in an unclean environment?


mfg Tobias
Comment 5 Walter Schwarzenfeld 2019-10-01 16:29:30 UTC
Error appears with the port, I have not tested it with poudriere.
Comment 6 nick.rozhkov 2019-10-01 16:49:33 UTC
Same and for me
It turned out that the build fails when devel/evdev-proto port is installed.
Comment 7 Walter Schwarzenfeld 2019-10-01 18:51:57 UTC
(In reply to Anders Bolt-Evensen from comment #2)
It was not meant as workaround (it is wrong).

If I am right, this should the correct way:

--- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp.orig    2019-10-01 18:04:32 UTC
+++ src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -38,6 +38,12 @@
 **
 ****************************************************************************/
 
+#ifdef Q_OS_FREEBSD
+#include <dev/evdev/input.h>
+#else
+#include <linux/input.h>
+#endif
+
 #include "qevdevtouchhandler_p.h"
 #include "qtouchoutputmapping_p.h"
 #include <QStringList>
@@ -49,11 +55,6 @@
 #include <QtCore/private/qcore_unix_p.h>
 #include <QtGui/private/qhighdpiscaling_p.h>
 #include <QtGui/private/qguiapplication_p.h>
-#ifdef Q_OS_FREEBSD
-#include <dev/evdev/input.h>
-#else
-#include <linux/input.h>
-#endif
 
 #include <math.h>
Comment 8 alt2600 2019-10-02 00:39:52 UTC
in response to patch posted in comment #7, I can confirm creating an arbitrary files/patch file with the patch contents of comment 7 will allow the build to complete if a manual "make patch" is applied. not 100% if it would auto-apply by ports or not, so manual may not be necessary, just not familiar enough with the ports Mk system to be sure.

I'm going to let the rest of the remaining QT5 upgrades to occur. this perhaps is a more suitable workaround, although given the nature of things this is likely something best suited for upstream patching, as my read of what had to be fixed is likely an issue in linux too, as it seems to be an bad order of header references for the same component evdev-proto.

so for folks looking to get things updated this may be a temp hack for local fix for now. if it breaks ardour or one of the other evdev-proto dependent builds I have I'll make further comment. but qt5-declarative built and installed, which is dependent on qt5-gui, and I confirmed the patch applied where it was expected to apply
Comment 9 alt2600 2019-10-02 00:46:50 UTC
(In reply to alt2600 from comment #8)

in case folks read this and do not realize this. I deleted my locally created files directory when done, as I expect there will be a more correct update at some point, and updating source tree will NOT automatically delete this folder for you. it will likely cause problems with the build being corrected upstream if you take this approach for the time being.
Comment 10 Marco Beishuizen 2019-10-03 13:25:31 UTC
x11-toolkits/qt5-gui builds and installs when the above patch is put in files/patch-qevdevtouchhandler.cpp.
Comment 11 Koichiro Iwao freebsd_committer freebsd_triage 2019-10-04 01:01:44 UTC
2019Q4 branch also has the same issue. MFH needed.
Comment 12 Koichiro Iwao freebsd_committer freebsd_triage 2019-10-04 01:19:22 UTC
Created attachment 208080 [details]
patch

Created svn patch based on Walter's patch.

Also fixed following QA error:
====> Running Q/A tests (stage-qa)
Error: /usr/local/lib/qt5/plugins/generic/libqevdevtouchplugin.so is linked to /usr/local/lib/libmtdev.so.1 from devel/l
ibmtdev but it is not declared as a dependency
Warning: you need LIB_DEPENDS+=libmtdev.so:devel/libmtdev
Comment 13 Ting-Wei Lan 2019-10-06 09:02:31 UTC
(In reply to Walter Schwarzenfeld from comment #7)
This is still a workaround. You just made the #ifdef check be always false because you checked it before including files which could define it. Therefore, the patch you wrote

+#ifdef Q_OS_FREEBSD
+#include <dev/evdev/input.h>
+#else
+#include <linux/input.h>
+#endif

is effectively

+#include <linux/input.h>

because the false branch is always taken.

The reason of the compilation error is that both dev/evdev/input.h (from base) and linux/input.h (from devel/evdev-proto) declare the same things. They use different macros as header guards, so including one does not prevent the other one from being included. If a source file includes both header files, it cannot be compiled because of the redefinition error shown above.

Qt uses dev/evdev/input.h here, while mtdev.h provided by devel/libmtdev uses linux/input.h. Since Qt also includes mtdev.h in this file, it causes a conflict. This doesn't happen in poudriere because devel/libmtdev does not RUN_DEPENDS on devel/evdev-proto, so devel/evdev-proto isn't installed in the poudriere environment. Therefore, even if devel/libmtdev is pulled in by x11/libinput and installed in the poudriere environment, Qt still disables mtdev because including mtdev.h causes an error due to missing linux/input.h.

I think devel/libmtdev should add devel/evdev-proto as RUN_DEPENDS, and headers installed by devel/evdev-proto should probably guard equivalent headers from base from being included.
Comment 14 Vladimir Omelchuk 2019-10-07 12:03:59 UTC
(In reply to Koichiro Iwao from comment #12)

This patch works for me.
Thanks!
Comment 15 Koichiro Iwao freebsd_committer freebsd_triage 2019-10-08 04:46:32 UTC
As Ting-Wei Lan says, the patch is still workaround but I would say workaround is OK. The build is now failing. We need to address the build issue soon.

What about committing the current patch first? When new patch is ready, update to the new patch later.
Comment 16 Ting-Wei Lan 2019-10-08 12:29:10 UTC
(In reply to Koichiro Iwao from comment #15)
If we want a workaround, I think we should just remove the Q_OS_FREEBSD check and leave only #include <linux/input.h> there. The current way of moving the entire #ifdef block is misleading.
Comment 17 Ting-Wei Lan 2019-10-08 15:38:35 UTC
Created attachment 208179 [details]
devel/evdev-proto: Use the same include guard as base

In order to prevent a source file from including both dev/evdev/input.h from base and linux/input.h from ports, these files should be the same include guards. This should fix the qt5-gui error caused by redefinition of structs.

This patch also adds devel/evdev-proto to RUN_DEPENDS of devel/libmtdev because mtdev.h needs linux/input.h.

I haven't tested the patch with poudriere. I only tested it with portmaster on my desktop computer running FreeBSD 12.1-BETA3.
Comment 18 Tobias C. Berner freebsd_committer freebsd_triage 2019-10-08 15:51:58 UTC
(In reply to Ting-Wei Lan from comment #17)
This looks promising. 

I'm not a fan of committing the other (broken) work around.
Comment 19 Vladimir Kondratyev freebsd_committer freebsd_triage 2019-10-09 00:01:57 UTC
dev/evdev/input.h was never intended to be used outside the base system so leaving only #include <linux/input.h> is not a workaround. It is a fix.

You can bump evdev-proto to 5.3 instead of assigning a new revision number
Comment 20 Walter Schwarzenfeld 2019-10-09 02:18:36 UTC
I think the same. This example is base system. I found this

https://git.sr.ht/~sircmpwn/wlroots/commit/f80d174e8b179f3af80f7990529c3b0440846dca
Comment 21 Tobias C. Berner freebsd_committer freebsd_triage 2019-10-09 18:51:23 UTC
Thanks for the clarification Vladimir. We discussed it, and I'll prepare a fix for this shortly.

mfg Tobias
Comment 23 Adriaan de Groot freebsd_committer freebsd_triage 2019-10-10 09:51:56 UTC
Filed upstream as https://bugreports.qt.io/browse/QTBUG-79130
Comment 24 Walter Schwarzenfeld 2019-10-10 19:10:47 UTC
Committed with ports r514242. Commit statement in the wrong PR.
Comment 25 Vladimir Druzenko freebsd_committer freebsd_triage 2019-10-10 20:13:38 UTC
evdevmouse/qevdevmousehandler.cpp:56:10: fatal error: 'linux/kd.h' file not found
#include <linux/kd.h>
         ^~~~~~~~~~~~
1 error generated.
*** [.obj/qevdevmousehandler.o] Error code 1
Comment 26 commit-hook freebsd_committer freebsd_triage 2019-10-10 20:39:26 UTC
A commit references this bug:

Author: adridg
Date: Thu Oct 10 20:38:42 UTC 2019
New revision: 514255
URL: https://svnweb.freebsd.org/changeset/ports/514255

Log:
  Fix build of x11-toolkits/qt5-gui

  <linux/kd.h> isn't needed here.

  Pointy hat to adridg@, for mixing up pou-build tree and the SVN tree.

  PR:		240964
  Reported by:	vvd@unislabs.com

Changes:
  head/x11-toolkits/qt5-gui/files/patch-src_platformsupport_input_evdevmouse_qevdevmousehandler.cpp
Comment 27 Ting-Wei Lan 2019-10-11 02:46:15 UTC
Since the evdev-proto part of attachment 208179 [details] is now unnecessary, can I propose committing only the libmtdev part of it?
Comment 28 Adriaan de Groot freebsd_committer freebsd_triage 2019-10-11 16:41:26 UTC
Reassigning to maintainer of libmtdev (the relevant bit is **only** the last comment, and the part adding evdev-proto to the RUN_DEPENDS of libmtdev). Now qt5-gui has reverted to using the headers from the evdev-proto port, it's up to other parts of the stack to sort out their includes.

See in particular comment #19 about using base input.h.
Comment 29 Ting-Wei Lan 2019-12-01 03:40:10 UTC
Ping! The bug has been opened for two months, but libmtdev is still broken.
Comment 30 Hans Petter Selasky freebsd_committer freebsd_triage 2019-12-01 07:11:29 UTC
I'll try to have a look at this later today. Thanks for the ping.

--HPS
Comment 31 Hans Petter Selasky freebsd_committer freebsd_triage 2019-12-01 07:12:47 UTC
Basically the patch looks good, so if someone wants to commit it feel free!
Else I'll try to queue it up myself.
Comment 32 Hans Petter Selasky freebsd_committer freebsd_triage 2019-12-01 11:31:18 UTC
Patches are approved. Who will test/commit them?
Comment 33 Ivan Rozhuk 2020-02-19 16:28:28 UTC
ping
Comment 34 Jan Beich freebsd_committer freebsd_triage 2020-02-19 21:42:39 UTC
See also review D18791 i.e., ad RUN_DEPENDS to devel/libevdev as well.
Comment 35 commit-hook freebsd_committer freebsd_triage 2020-09-13 20:06:44 UTC
A commit references this bug:

Author: adridg
Date: Sun Sep 13 20:06:30 UTC 2020
New revision: 548573
URL: https://svnweb.freebsd.org/changeset/ports/548573

Log:
  Fix up (run) depends of devel/libmtdev

  There's some confusion about evdev headers, and this patch
  was shunted back and forth between Qt and others for a while,
  and then languished.

  Original patch from Ting-Wei Lan, partly obsoleted by changes
  in Qt in ports r514242 and r514255, OK'ed by maintainer in the PR.

  PR:		240964
  Submitted by:	Ting-Wei Lan
  Reported by:	Walter Schwarzenfeld
  Reviewed by:	adridg
  Approved by:	hselasky

Changes:
  head/devel/libmtdev/Makefile
Comment 36 Adriaan de Groot freebsd_committer freebsd_triage 2020-09-13 20:13:18 UTC
The review mentioned by Jan is abandoned, so I've just pushed the relevant part of the patch in here; I'll be submitting a PR to update to libmtdev 1.1.6 (released January 2020) shortly.
Comment 37 Jan Beich freebsd_committer freebsd_triage 2021-11-10 21:19:19 UTC
(In reply to commit-hook from comment #35)
FWIW, this change was reverted in ports 5d998836b36f.