Bug 378109

Summary: signals in glib2 was defined by QT
Product: [Frameworks and Libraries] frameworks-networkmanager-qt Reporter: Robert Lu <robberphex>
Component: generalAssignee: Jan Grulich <jgrulich>
Status: RESOLVED INTENTIONAL    
Severity: major CC: jgrulich, lamarque, lukas.tinkl
Priority: NOR    
Version: 5.27.0   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: the file that cannot compile

Description Robert Lu 2017-03-26 16:14:43 UTC
Created attachment 104744 [details]
the file that cannot compile

When I compile nm_conn in attachment, I met the error:

$ make      
Scanning dependencies of target nm_conn
[ 50%] Building CXX object CMakeFiles/nm_conn.dir/nm_conn.o
In file included from /usr/include/qt5/QtCore/qobject.h:46:0,
                 from /usr/include/qt5/QtCore/qabstractanimation.h:43,
                 from /usr/include/qt5/QtCore/QtCore:4,
                 from /usr/include/qt5/QtDBus/QtDBusDepends:3,
                 from /usr/include/qt5/QtDBus/QtDBus:3,
                 from /usr/include/KF5/NetworkManagerQt/networkmanagerqt/manager.h:29,
                 from /usr/include/KF5/NetworkManagerQt/NetworkManagerQt/Manager:1,
                 from /home/rlu/nm-connectivity/nm_conn.cpp:1:
/usr/include/glib-2.0/gio/gdbusintrospection.h:155:25: error: expected unqualified-id before ‘public’
   GDBusSignalInfo     **signals;
                         ^
In file included from /usr/include/glib-2.0/gio/gio.h:54:0,
                 from /usr/include/libnm/nm-types.h:24,
                 from /usr/include/libnm/nm-object.h:29,
                 from /usr/include/libnm/nm-access-point.h:29,
                 from /usr/include/libnm/NetworkManager.h:26,
                 from /usr/include/KF5/NetworkManagerQt/networkmanagerqt/ipconfig.h:31,
                 from /usr/include/KF5/NetworkManagerQt/networkmanagerqt/device.h:33,
                 from /usr/include/KF5/NetworkManagerQt/networkmanagerqt/manager.h:31,
                 from /usr/include/KF5/NetworkManagerQt/NetworkManagerQt/Manager:1,
                 from /home/rlu/nm-connectivity/nm_conn.cpp:1:
/usr/include/glib-2.0/gio/gdbusintrospection.h:155:24: error: expected ‘;’ at end of member declaration
   GDBusSignalInfo     **signals;
                        ^
/usr/include/glib-2.0/gio/gdbusintrospection.h:155:32: error: expected ‘:’ before ‘;’ token
   GDBusSignalInfo     **signals;
                                ^
CMakeFiles/nm_conn.dir/build.make:62: recipe for target 'CMakeFiles/nm_conn.dir/nm_conn.o' failed
make[2]: *** [CMakeFiles/nm_conn.dir/nm_conn.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/nm_conn.dir/all' failed
make[1]: *** [CMakeFiles/nm_conn.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Comment 1 Jan Grulich 2017-03-27 05:34:55 UTC
You have to use add_definitions(-DQT_NO_KEYWORDS) in your CMake, otherwise you won't be able to use nm-qt. This is due to glib using signals as a name for a variable, while signals is a keyword for us.