Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#28090 - [glibc] and [linux-api-headers] incompatibilities

Attached to Project: Arch Linux
Opened by André Prata (nDray) - Tuesday, 24 January 2012, 18:35 GMT
Last edited by Allan McRae (Allan) - Sunday, 25 March 2012, 11:03 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I use two libraries in a project of mine. One of them uses the glibc net/if.h, and the other one uses the linux-api-headers'.
If I include the linux's first, I get this:
...
/usr/include/net/if.h:45:5: error: expected identifier before numeric constant
/usr/include/net/if.h:45:5: error: expected ‘}’ before numeric constant
/usr/include/net/if.h:45:5: error: expected unqualified-id before numeric constant
/usr/include/net/if.h:82:3: error: expected declaration before ‘}’ token
...

If I include the glibc's first, this is the result:
...
/usr/include/linux/if.h:136:8: error: redefinition of ‘struct ifmap’
/usr/include/net/if.h:112:8: error: previous definition of ‘struct ifmap’
/usr/include/linux/if.h:170:8: error: redefinition of ‘struct ifreq’
/usr/include/net/if.h:127:8: error: previous definition of ‘struct ifreq’
/usr/include/linux/if.h:219:8: error: redefinition of ‘struct ifconf’
/usr/include/net/if.h:177:8: error: previous definition of ‘struct ifconf’
...

How do I solve this issue? I don't want to change any of the libraries, of course.

Additional info:
* package version(s)
Name : linux-api-headers
Version : 3.1.6-1

Name : glibc
Version : 2.15-3

This task depends upon

Closed by  Allan McRae (Allan)
Sunday, 25 March 2012, 11:03 GMT
Reason for closing:  Upstream
Additional comments about closing:  See comment
Comment by André Prata (nDray) - Tuesday, 24 January 2012, 18:38 GMT
By the way, the library that uses the linux api is libnl3. The other one is boost!
Comment by Allan McRae (Allan) - Thursday, 26 January 2012, 11:12 GMT
I think there is very little that can be done here...

Try including the boost/asio.hpp first, then "#define _LINUX_IF_H", and then include the libnl3 header. It is a crap workaround, but may work...
Comment by André Prata (nDray) - Thursday, 09 February 2012, 09:23 GMT
That workaround seems to work, and not break anything, but it isn't beautiful...
Comment by Allan McRae (Allan) - Thursday, 09 February 2012, 11:23 GMT
In fact... you are better of including linux/if.h and defining "_NET_IF_H" before whatever includes net/if.h

From what I can gather from conversations with relevant people, neither side will take the "blame" here. The "rule" is the the glibc header should be used in userspace applications and not the linux one. But it appears that is being ignored by many projects... So I am not sure this will be fixed in a hurry.
Comment by Allan McRae (Allan) - Sunday, 25 March 2012, 11:03 GMT
This does not seem like it will be fixed by either upstream in a hurry (or every). The party line is to nut use both headers at once... No help in this case, but the workaround will have to do.

Loading...