[klibc] klibc build trouble

Ben Hutchings ben at decadent.org.uk
Sun Mar 14 11:41:56 PDT 2010

On Sun, 2010-03-14 at 18:50 +0100, maximilian attems wrote:
> On Sun, Mar 14, 2010 at 05:47:40PM +0000, Ben Hutchings wrote:
> > 
> > How does it not work?  That links to the kernel headers
> > under /usr/include.  No need to -I/usr/include.
> how would klcc see linux-libc-dev the headers in /usr/include
> without aboves include
> please specify "That links"
> simple example of a libklc-dev wihtout linux-2.6 headers:
> In file included from /usr/lib/klibc/include/unistd.h:11,
>                  from mdadm.h:27,
>                  from mdadm.c:28:
> /usr/lib/klibc/include/sys/types.h:15:31: error: linux/posix_types.h: No such file or directory
> /usr/lib/klibc/include/sys/types.h:16:23: error: asm/types.h: No such file or directory
> once you add aboves -I the redefinitions start rolling:
> In file included from /usr/include/glob.h:22,
>                  from config.c:28:
> /usr/include/sys/cdefs.h:216:1: error: "__attribute_pure__" redefined
> easy to test out with make CC=klcc

With these changes:

diff --git a/debian/control b/debian/control
index 14902cc..12f98e1 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Vcs-Git: git://git.debian.org/git/kernel/klibc.git
 Package: libklibc-dev
 Section: libdevel
 Architecture: any
-Depends: libklibc (= ${binary:Version}), ${misc:Depends}
+Depends: libklibc (= ${binary:Version}), linux-libc-dev, ${misc:Depends}
 Description: kernel headers used during the build of klibc
  This package contains the set of kernel headers that were required to
  build klibc and the utilities that ship with it.  This may or may
diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
index de918f0..608759d 100644
--- a/scripts/Kbuild.install
+++ b/scripts/Kbuild.install
@@ -95,8 +95,11 @@ header:
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
+	$(Q)for x in /usr/include/linux /usr/include/asm*; do \
+		ln -s $${x} $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/ || exit; \
+	done
 	$(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
+	$(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
 	$(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
 	$(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir)
--- END ---

(the extra chmod was needed to allow for umask > 022) I could compile,
link and run this program:

#include <unistd.h>

int main(void)
    write(1, "Hello world\n", 12);
    return 0;


Ben Hutchings
I say we take off; nuke the site from orbit.  It's the only way to be sure.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: This is a digitally signed message part
URL: <http://www.zytor.com/pipermail/klibc/attachments/20100314/3627dc50/attachment-0001.sig>

More information about the klibc mailing list