[klibc] Build problems: klibc with Linux 3.10.7

Neal Murphy neal.p.murphy at alum.wpi.edu
Mon Aug 19 13:45:05 PDT 2013


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


More information about the klibc mailing list