I'm trying to build uClibc 0.9.27 [1] on x86_64 with the linux kernel 3.10-2-amd64. I can verify that it builds on Ubuntu 12.04.3 with the 3.2.0-49-generic kernel. When running make, it manages to build a lot of object files but eventually reaches CC libc/inet/if_index.os
, complaining with
In file included from /usr/include/linux/kernel.h:4,
from /usr/include/linux/netlink.h:4,
from /usr/include/linux/rtnetlink.h:5,
from libc/inet/netlinkaccess.h:32,
from libc/inet/if_index.c:36:
/usr/include/linux/sysinfo.h:8: error: expected specifier-qualifier-list before '__kernel_long_t'
In file included from /usr/include/linux/rtnetlink.h:6,
from libc/inet/netlinkaccess.h:32,
from libc/inet/if_index.c:36:
/usr/include/linux/if_link.h:317: error: expected specifier-qualifier-list before '__be16'
I verified that the types exist in files that I gather should have been sucked in. In the case of __kernel_long_t
, the include files look like this:
/usr/include/linux/sysinfo.h includes <linux/types.h>
/usr/include/linux/types.h includes <linux/posix_types.h>
/usr/include/linux/posix_types.h includes <asm/posix_types.h>
/usr/include/x86_64-linux-gnu/asm/posix_types.h includes <asm/posix_types_64.h>
/usr/include/x86_64-linux-gnu/asm/posix_types_64.h includes <asm-generic/posix_types.h>
/usr/include/asm-generic/posix_types.h typedefs __kernel_long_t
So, where does that error come from, and how can I fix it?
[1] Yes, I know the newest version is 0.9.33.2, but I need that particular version.
The solution seems to be to backport a newer version of
libc/inet/netlinkacces.h
to the older version. The__kernel_long_t
problem goes away by avoiding an include (if necessary, that would have to be patched inkernel_types.h
, because the defines intentionally shadow the include guards of the headers in/usr/include
) and the other type(s) can be properly included by the following patch:This is basically the change between the old
netlinkaccess.h
and the one in the newer version (diffing of the preprocessed files suggested by ash hinted me to this).