[klibc] Unable to build linux-2.6-klibc with O=

Luca kronos at kronoz.cjb.net
Wed Feb 15 12:32:02 PST 2006


Hi,
I wanted to test the kinit setup on my configuration, and I found out
that I'm unable to build using an external object directory
(i.e. using O=../dir). I'm using the sources from the GIT tree.

The first problem is in usr/dask/Kbuild, in the invocations of mktokens;
with O= the build system will try to execute something like:
/home/.../linux-2.6-klibc.git//home/.../linux-2.6-klibc.git/usr/dash/mktokens
which of course fails. I'm using the following patch to fix this issue:

Signed-Off-By: Luca Tettamanti <kronos at kronoz.cjb.net>
(in case you want it)

diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild
index 4e75324..452d066 100644
--- a/usr/dash/Kbuild
+++ b/usr/dash/Kbuild
@@ -66,8 +66,8 @@ $(obj)/check:
 
 # Generate token.h
 quiet_cmd_mktokens = GEN     $@
-      cmd_mktokens = cd $(obj); sh $(srctree)/$<
-$(obj)/token.h: $(src)/mktokens
+      cmd_mktokens = cd $(obj); sh $<
+$(obj)/token.h: $(srctree)/usr/dash/mktokens
 	$(call cmd,mktokens)
 
 # Generate builtins.def


The problem is that when building without O= $(src) contains the
relative path of mktokens (usr/dash), which combined with $(srctree)
gives the correct path; when building with O= $(src) contains the
absolute path of the sources (/home/.../usr/dash). Since the output of
mktokens is hardcoded to token.h in the current dir I had to hardcode
the relative path of mktokens in the rule; another solution could be
changing mktokens to output on the stdout and redirect it to the correct
file.

I've tested the patch with and without O= and it works as expected.

The compilation then stops at dash anyway, with the following error:

  KLIBCCC usr/dash/redir.o
  KLIBCCC usr/dash/show.o
  KLIBCCC usr/dash/trap.o
  KLIBCCC usr/dash/output.o
  KLIBCCC usr/dash/bltin/printf.o
  KLIBCCC usr/dash/system.o
  KLIBCCC usr/dash/bltin/test.o
  KLIBCCC usr/dash/bltin/times.o
  KLIBCCC usr/dash/var.o
  KLIBCLD usr/dash/sh
usr/dash/builtins.o:(.rodata+0x34): undefined reference to `bgcmd'
usr/dash/builtins.o:(.rodata+0xc4): undefined reference to `histcmd'
usr/dash/builtins.o:(.rodata+0xd0): undefined reference to `fgcmd'
make[3]: *** [usr/dash/sh] Error 1
make[2]: *** [klibcdirs] Error 2
make[1]: *** [usr] Error 2
make: *** [cdbuilddir] Error 2

This does not happen without O=, and I don't know what's going wrong :(

Luca
-- 
Home: http://kronoz.cjb.net
Non capisco tutta questa eccitazione per il Multitasking: 
io sono anni che leggo in bagno.



More information about the klibc mailing list