GNOME Bugzilla – Bug 763227
[PATCH] Linux.Network.IfFlag enum produces C compiler error
Last modified: 2016-03-08 15:49:11 UTC
The following code: // valac linux-test.vala --pkg linux public static void main() { var flags = Linux.Network.IfFlag.UP; } produces the following C compiler errors: /usr/include/linux/if.h:211:19: error: field ‘ifru_addr’ has incomplete type struct sockaddr ifru_addr; ^ /usr/include/linux/if.h:212:19: error: field ‘ifru_dstaddr’ has incomplete type struct sockaddr ifru_dstaddr; ^ /usr/include/linux/if.h:213:19: error: field ‘ifru_broadaddr’ has incomplete type struct sockaddr ifru_broadaddr; ^ /usr/include/linux/if.h:214:19: error: field ‘ifru_netmask’ has incomplete type struct sockaddr ifru_netmask; ^ /usr/include/linux/if.h:215:20: error: field ‘ifru_hwaddr’ has incomplete type struct sockaddr ifru_hwaddr; ^ error: cc exited with status 256 Compilation failed: 1 error(s), 1 warning(s) Changing the binding to use <net/if.h> instead of <linux/if.h> resolves this.
Created attachment 323268 [details] [review] Resolves C compiler error when using Linux.Network.IfFlags
Looks good to me.
Created attachment 323295 [details] [review] Patch to include <sys/socket.h> when using <linux/if.h> Updated patch. <linux/if.h> includes <linux/socket.h>. <linux/socket.h> relies on the definition of the sockaddr type to be in <sys/socket.h> For example see: https://lkml.org/lkml/2015/3/10/850 This patch resolves that dependency in the Vala binding.
Review of attachment 323295 [details] [review]: Looks good