[klibc] Build problems: klibc with Linux 3.10.7

leroy christophe christophe.leroy at c-s.fr
Mon Aug 19 22:44:39 PDT 2013


Le 19/08/2013 22:45, Neal Murphy a écrit :
> Gauche as it may be, I am reviving an old thread from January:
> http://www.zytor.com/pipermail/klibc/2013-January/003402.html.
>
> Building Smoothwall Express 3.1 in a chroot jail works well. (gcc 4.7.2, linux
> 3.4.58, klibc 2.0.1, et alia).
>
> I'm now working on 'express-next' to prepare for a future release (linux
> 3.10.7, klibc 2.0.2, et alia). Same build system, worked through some kernel
> changes and iptables API change. But klibc refuses to build.
>
> The build system installs the linux headers to a pkg dir, tars it, then
> unpacks the tar into the jail's /. (Meaning the headers are in /usr/include,
> but these aren't the host's headers.)
>
>
> After going 'round and 'round and decrypting instructions, makefiles and
> scripts, 'make' succeeds. All that's needed for this step:
>
> ------------
>    tar xvf klibc-2.0.2.tar.bz2
>
>    # Make a symlink so make can find the chroot jail headers that are
>    #   absent with -nostdinc
>    (cd klibc-2.0.2; ln -sf /usr linux)
>    # (Actually, the build system makes the symlink automagically. The above
>    #   just illustrates what happens.)
>
>    # Now cd to the build dir and 'make build'; the build system does its
>    #   thing: throws itself in jail and compiles.
> ------------
>
> Now it's time to install into the klibc pkg dir. This step always fails. I've
> tried every way to link to the headers to no avail. 'make ... headers_install'
> fails. If I don't get the link to the kernel source right, it can't find
> unistd*.h. Once that symlink is correct, the build can't find asm/errno.h. I'm
> fairly certain something's wrong with how the include dirs are specified (-I
> ...).
>
>
> My findings so far:
>
> According to klibc-2.0.2/usr/klibc/README.klibc, one should make
> klibc-2.0.2/usr/linux a symlink to the place where the linux headers were
> installed (for me, /usr in the chroot jail).
>    "In the source root directory (the directory above the one in which
>     this file is found)"
> But as noted above, this symlink really wants to be in the root of the source
> archive (klibc-2.0.2/linux), not in usr/ (klibc-2.0.2/usr/linux) (the dir
> above the one where README.klibc is found).
>
> In Kbuild.install, 'INSTALLROOT' is what many (most?) packages call DESTDIR:
> an alternate install dir to prepare pkgs. And KLIBCKERNELSRC is the path to
> the kernel sources. In my case, this is /build/sources/linux/linux-3.10.7 (in
> the jail).
>
> There's an oddity in how include dirs are specified. First, an absolute
> 'relative' dir and it's companion:
>    -I/build/sources/klibc/klibc-2.0.2/usr/klibc/../include
>    -Iusr/klibc/../include
> Then the same dir is specified without relativity:
>    -I/build/sources/klibc/klibc-2.0.2/usr/include
>    -Iusr/include
> Is this intentional? Or is a var missing somewhere?
>
> Very near the beginning of 'make install', there's an error (asm/errno.h not
> found), but the make session continues until the next time it encounters the
> error.
>
> 'make install' seems to be re-building syscalls/ and socketcalls/. Should it
> rebuild? Or should it use what it built during 'make all'?
>
>
> Finally, some questions:
>    Exactly which dirs and symlinks need to be specified in order to build?
>    Does klibc really need its own copy of the linux headers?
>    Does Kbuild.install need to be updated/modernized (as hpa mentioned)?
>
>
> I can provide verbose and non-verbose build logs, as needed, with and/or
> without '-j 4'.
>
> Thanks,
> N
> _______________________________________________
> klibc mailing list
> klibc at zytor.com
> http://www.zytor.com/mailman/listinfo/klibc
>
Find attached two patches I have in order to build klibc 2.0.2 against 
kernel 3.8.13
We had to introduce those patches when going from kernel 3.6 to kernel 3.7
Hope it helps.

Christophe
-------------- next part --------------
--- Kbuild.orig	2011-08-22 22:16:56.000000000 +0200
+++ Kbuild	2012-04-27 10:03:04.000000000 +0200
@@ -178,4 +178,4 @@
 	$(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
 	                      $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib
 	$(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
-	                      $(INSTALLROOT)$(SHLIBDIR)
+	                      $(INSTALLROOT)$(INSTALLDIR)/$(SHLIBDIR)
-------------- next part --------------
diff -ur klibc-2.0.2/scripts/Kbuild.install klibc-2.0.2.new/scripts/Kbuild.install
--- klibc-2.0.2/scripts/Kbuild.install	2012-10-03 18:41:43.000000000 +0200
+++ klibc-2.0.2.new/scripts/Kbuild.install	2013-01-03 20:00:52.000000000 +0100
@@ -95,7 +95,7 @@
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
 	$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
-	$(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install
+	$(Q)cp -rf $(KLIBCKERNELSRC)/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
 	$(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


More information about the klibc mailing list