2002-10-12 15:11:08

by Olaf Dietsche

[permalink] [raw]
Subject: [PATCH] 2.5.42: UML build error

When building 2.5.42 UML it fails with:

make -C arch/um/sys-i386/util mk_sc
gcc -Wp,-MD,./.mk_sc.o.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -c -o mk_sc
.o mk_sc.c
/bin/sh: scripts/fixdep: No such file or directory
make[1]: *** [mk_sc.o] Error 1
make[1]: Target `mk_sc' not remade because of errors.
make: *** [arch/um/sys-i386/util/mk_sc] Error 2

This patch readds the path to scripts/fixdep in Rules.make. It doesn't
break _my_ regular build, but I can't tell for others.

diff -urN a/Rules.make b/Rules.make
--- a/Rules.make Sat Oct 12 14:24:11 2002
+++ b/Rules.make Sat Oct 12 16:45:47 2002
@@ -561,7 +561,7 @@
@set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
- scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
+ $(TOPDIR)/scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)


2002-10-12 15:55:19

by Kai Germaschewski

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error

On Sat, 12 Oct 2002, Olaf Dietsche wrote:

> When building 2.5.42 UML it fails with:
>
> make -C arch/um/sys-i386/util mk_sc
> gcc -Wp,-MD,./.mk_sc.o.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -c -o mk_sc
> .o mk_sc.c
> /bin/sh: scripts/fixdep: No such file or directory
> make[1]: *** [mk_sc.o] Error 1
> make[1]: Target `mk_sc' not remade because of errors.
> make: *** [arch/um/sys-i386/util/mk_sc] Error 2
>
> This patch readds the path to scripts/fixdep in Rules.make. It doesn't
> break _my_ regular build, but I can't tell for others.
>
> diff -urN a/Rules.make b/Rules.make
> --- a/Rules.make Sat Oct 12 14:24:11 2002
> +++ b/Rules.make Sat Oct 12 16:45:47 2002
> @@ -561,7 +561,7 @@
> @set -e; \
> $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
> $(cmd_$(1)); \
> - scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
> + $(TOPDIR)/scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
> rm -f $(depfile); \
> mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)

This is actually intentionally broken, since fixdep expects to be called
from the top-level dir only now - it doesn't take the previous "$(TOPDIR)"
argument anymore which allowed for $(PWD) != $(TOPDIR) before 2.5.41.

Descending into directories needs to be adjusted to use

$(call descend,<dir>,<target>)

now, and the Makefile in <dir> possibly needs adjusting to take into
account that $(PWD) == $(TOPDIR).

--Kai


2002-10-12 16:29:32

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error


On Sat, 12 Oct 2002, Olaf Dietsche wrote:
>
> This patch readds the path to scripts/fixdep in Rules.make. It doesn't
> break _my_ regular build, but I can't tell for others.

The thing is, the correct fix is to make uml (and other architectures) use
the direct makefile approach (ie "make -f xxxxx/Makefile" instead of "make
-C xxxxx").

All the dependencies are generated with relative paths anyway, so this
one-liner makes the tree build, but it means that the dependencies are
broken for uml-specific subdirectories anyway.

Linus

2002-10-12 16:43:52

by Kai Germaschewski

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error

On Sat, 12 Oct 2002, Olaf Dietsche wrote:

> When building 2.5.42 UML it fails with:
> [...]

Okay, so here's a patch which fixes the UML build for me (i386) -
generally, UML could use some more kbuild work, but I'll leave that for
post-freeze ;)

--Kai


Pull from http://linux-isdn.bkbits.net/linux-2.5.make

(Merging changesets omitted for clarity)

-----------------------------------------------------------------------------
[email protected], 2002-10-12 11:47:37-05:00, [email protected]
kbuild: Fix UML build

Not perfectly clean yet, but uses the standard way to descend into subdirs
and gives me working vmlinux and linux targets without spurious rebuilds.

----------------------------------------------------------------------------
Makefile | 33 ++++++++++++++++++++-------------
Makefile-i386 | 35 ++++++++++++++++-------------------
sys-i386/util/Makefile | 14 ++++++++------
util/Makefile | 18 +++++++++---------
4 files changed, 53 insertions(+), 47 deletions(-)





=============================================================================
unified diffs follow for reference
=============================================================================

-----------------------------------------------------------------------------
[email protected], 2002-10-12 11:47:37-05:00, [email protected]
kbuild: Fix UML build

Not perfectly clean yet, but uses the standard way to descend into subdirs
and gives me working vmlinux and linux targets without spurious rebuilds.

---------------------------------------------------------------------------

diff -Nru a/arch/um/Makefile b/arch/um/Makefile
--- a/arch/um/Makefile Sat Oct 12 11:48:06 2002
+++ b/arch/um/Makefile Sat Oct 12 11:48:06 2002
@@ -51,14 +51,6 @@

SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)

-$(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S
- $(call if_changed_dep,as_s_S)
-
-AFLAGS_uml.lds.o = -U$(SUBARCH) -DSTART=$$(($(TOP_ADDR) - $(SIZE))) \
- -DELF_ARCH=$(ELF_ARCH) -DELF_FORMAT=\"$(ELF_FORMAT)\" -P -C -Uum
-
-LDFLAGS_vmlinux = -r $(ARCH_DIR)/main.o
-
SYMLINK_HEADERS = include/asm-um/archparam.h include/asm-um/system.h \
include/asm-um/sigcontext.h include/asm-um/processor.h \
include/asm-um/ptrace.h include/asm-um/arch-signal.h
@@ -71,11 +63,25 @@
$(ARCH_DIR)/vmlinux.lds.S :
touch $@

-linux: scripts $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
- arch/um/uml.lds.s $(ARCH_DIR)/main.o vmlinux
+prepare: $(ARCH_SYMLINKS) $(GEN_HEADERS)
+
+
+LDFLAGS_vmlinux = -r $(ARCH_DIR)/main.o
+
+vmlinux: $(ARCH_DIR)/main.o
+
+
+$(ARCH_DIR)/uml.lds.s : $(ARCH_DIR)/uml.lds.S
+ $(call if_changed_dep,as_s_S)
+
+AFLAGS_uml.lds.o = -U$(SUBARCH) -DSTART=$$(($(TOP_ADDR) - $(SIZE))) \
+ -DELF_ARCH=$(ELF_ARCH) -DELF_FORMAT=\"$(ELF_FORMAT)\" -P -C -Uum
+
+linux: arch/um/uml.lds.s vmlinux
$(CC) -Wl,-T,arch/um/uml.lds.s -o $@ $(LINK_PROFILE) \
$(LINK_WRAPS) -static vmlinux -L/usr/lib -lutil

+
USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) -I$(ARCH_INCLUDE)
@@ -125,8 +131,9 @@
$(ARCH_DIR)/include/task.h : $(ARCH_DIR)/util/mk_task
$< > $@

-$(ARCH_DIR)/util/mk_task : $(ARCH_DIR)/util/mk_task_user.c \
- $(ARCH_DIR)/util/mk_task_kern.c
- $(MAKE) $(MFLAGS) -C $(ARCH_DIR)/util all
+$(ARCH_DIR)/util/mk_task : $(ARCH_DIR)/util FORCE ;
+
+$(ARCH_DIR)/util: FORCE
+ @$(call descend,$@,)

export SUBARCH USER_CFLAGS OS
diff -Nru a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
--- a/arch/um/Makefile-i386 Sat Oct 12 11:48:06 2002
+++ b/arch/um/Makefile-i386 Sat Oct 12 11:48:06 2002
@@ -8,27 +8,24 @@
ELF_ARCH = $(SUBARCH)
ELF_FORMAT = elf32-$(SUBARCH)

+SYS_DIR := $(ARCH_DIR)/include/sysdep-i386
+SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util

-SYS_HEADERS = $(ARCH_DIR)/include/sysdep-i386/sc.h \
- $(ARCH_DIR)/include/sysdep-i386/thread.h
+SYS_HEADERS = $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h

-$(ARCH_DIR)/include/sysdep-i386/sc.h : $(ARCH_DIR)/sys-i386/util/mk_sc \
- include/asm
- $(ARCH_DIR)/sys-i386/util/mk_sc > $@
-
-$(ARCH_DIR)/include/sysdep-i386/thread.h : $(ARCH_DIR)/sys-i386/util/mk_thread\
- include/asm
- $(ARCH_DIR)/sys-i386/util/mk_thread > $@
-
-$(ARCH_DIR)/sys-i386/util/mk_sc : $(ARCH_DIR)/sys-i386/util/mk_sc.c \
- include/asm
- $(MAKE) -C $(ARCH_DIR)/sys-i386/util mk_sc
-
-$(ARCH_DIR)/sys-i386/util/mk_thread : \
- $(ARCH_DIR)/sys-i386/util/mk_thread_user.c \
- $(ARCH_DIR)/sys-i386/util/mk_thread_kern.c
- $(MAKE) -C $(ARCH_DIR)/sys-i386/util mk_thread
+prepare: $(SYS_HEADERS)
+
+$(SYS_DIR)/sc.h: $(SYS_UTIL_DIR)/mk_sc
+ $< > $@
+
+$(SYS_DIR)/thread.h: $(SYS_UTIL_DIR)/mk_thread
+ $< > $@
+
+$(SYS_UTIL_DIR)/mk_sc $(SYS_UTIL_DIR)/mk_thread: $(SYS_UTIL_DIR) FORCE ;
+
+$(SYS_UTIL_DIR): include/asm FORCE
+ @$(call descend,$@,)

sysclean :
rm -f $(SYS_HEADERS)
- make -C $(ARCH_DIR)/sys-i386/util clean
+ @$(call descend,$(SYS_DIR),clean)
diff -Nru a/arch/um/sys-i386/util/Makefile b/arch/um/sys-i386/util/Makefile
--- a/arch/um/sys-i386/util/Makefile Sat Oct 12 11:48:06 2002
+++ b/arch/um/sys-i386/util/Makefile Sat Oct 12 11:48:06 2002
@@ -1,16 +1,18 @@
-host-progs = mk_sc
+EXTRA_TARGETS := mk_sc mk_thread mk_thread_kern.o

-mk_sc-objs = mk_sc.o
+host-progs := mk_sc
+
+mk_sc-objs := mk_sc.o

include $(TOPDIR)/Rules.make

-mk_thread : mk_thread_kern.o mk_thread_user.o
- $(CC) $(CFLAGS) -o $@ mk_thread_user.o mk_thread_kern.o
+$(obj)/mk_thread : $(obj)/mk_thread_kern.o $(obj)/mk_thread_user.o
+ $(CC) $(CFLAGS) -o $@ $^

-mk_thread_user.o : mk_thread_user.c
+$(obj)/mk_thread_user.o : $(src)/mk_thread_user.c
$(CC) $(USER_CFLAGS) -c -o $@ $<

clean :
- $(RM) $(host-progs) mk_thread
+ $(RM) -f $(EXTRA_TARGETS)

archmrproper : clean
diff -Nru a/arch/um/util/Makefile b/arch/um/util/Makefile
--- a/arch/um/util/Makefile Sat Oct 12 11:48:06 2002
+++ b/arch/um/util/Makefile Sat Oct 12 11:48:06 2002
@@ -1,14 +1,14 @@
-include $(TOPDIR)/Rules.make
+EXTRA_TARGETS := mk_task mk_task_kern.o

-all : mk_task
+include $(TOPDIR)/Rules.make

-mk_task : mk_task_user.o mk_task_kern.o
- $(CC) -o mk_task mk_task_user.o mk_task_kern.o
+$(obj)/mk_task: $(obj)/mk_task_user.o $(obj)/mk_task_kern.o
+ $(CC) -o $@ $^

-mk_task_user.o : mk_task_user.c
- $(CC) -c $<
+$(obj)/mk_task_user.o: $(src)/mk_task_user.c
+ $(CC) -o $@ -c $<

-clean :
- $(RM) mk_task *.o *~
+clean:
+ $(RM) $(EXTRA_TARGETS)

-archmrproper : clean
+archmrproper:


2002-10-12 18:18:07

by Olaf Dietsche

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error

Kai Germaschewski <[email protected]> writes:

> On Sat, 12 Oct 2002, Olaf Dietsche wrote:
>
>> When building 2.5.42 UML it fails with:
>> [...]
>
> Okay, so here's a patch which fixes the UML build for me (i386) -
> generally, UML could use some more kbuild work, but I'll leave that for
> post-freeze ;)
>
> --Kai
>
>
> Pull from http://linux-isdn.bkbits.net/linux-2.5.make
>
> (Merging changesets omitted for clarity)
>
> -----------------------------------------------------------------------------
> [email protected], 2002-10-12 11:47:37-05:00, [email protected]
> kbuild: Fix UML build
>
> Not perfectly clean yet, but uses the standard way to descend into subdirs
> and gives me working vmlinux and linux targets without spurious rebuilds.
>
> ----------------------------------------------------------------------------
> Makefile | 33 ++++++++++++++++++++-------------
> Makefile-i386 | 35 ++++++++++++++++-------------------
> sys-i386/util/Makefile | 14 ++++++++------
> util/Makefile | 18 +++++++++---------
> 4 files changed, 53 insertions(+), 47 deletions(-)
>
> =============================================================================
> unified diffs follow for reference
> =============================================================================
[...]

Thanks! I was still trying to figure out, how all this is supposed to
work :-).

Though, it still gives one error right at the beginning:

gcc -E -Wp,-MD,arch/um/.uml.lds.s.d_ -D__ASSEMBLY__ -D__KERNEL__ -Iinclude -nostdinc -iwithprefix include -Ui386 -DSTART=$((0xc0000000 - ((0 + 1) * 0x20000000))) -DELF_ARCH=i386 -DELF_FORMAT=\"elf32-i386\" -P -C -Uum -o arch/um/uml.lds.s arch/um/uml.lds.S
/bin/sh: scripts/fixdep: No such file or directory
make: *** [arch/um/uml.lds.s] Error 1

Regards, Olaf.

2002-10-12 18:25:43

by Kai Germaschewski

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error

On Sat, 12 Oct 2002, Olaf Dietsche wrote:

> Though, it still gives one error right at the beginning:
>
> gcc -E -Wp,-MD,arch/um/.uml.lds.s.d_ -D__ASSEMBLY__ -D__KERNEL__ -Iinclude -nostdinc -iwithprefix include -Ui386 -DSTART=$((0xc0000000 - ((0 + 1) * 0x20000000))) -DELF_ARCH=i386 -DELF_FORMAT=\"elf32-i386\" -P -C -Uum -o arch/um/uml.lds.s arch/um/uml.lds.S
> /bin/sh: scripts/fixdep: No such file or directory
> make: *** [arch/um/uml.lds.s] Error 1

Try a "make scripts" first, that should work around it. I'll fix it
properly.


--Kai


2002-10-12 19:01:51

by Olaf Dietsche

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error

Kai Germaschewski <[email protected]> writes:

> On Sat, 12 Oct 2002, Olaf Dietsche wrote:
>
>> Though, it still gives one error right at the beginning:
>>
>> gcc -E -Wp,-MD,arch/um/.uml.lds.s.d_ -D__ASSEMBLY__ -D__KERNEL__ -Iinclude -nostdinc -iwithprefix include -Ui386 -DSTART=$((0xc0000000 - ((0 + 1) * 0x20000000))) -DELF_ARCH=i386 -DELF_FORMAT=\"elf32-i386\" -P -C -Uum -o arch/um/uml.lds.s arch/um/uml.lds.S
>> /bin/sh: scripts/fixdep: No such file or directory
>> make: *** [arch/um/uml.lds.s] Error 1
>
> Try a "make scripts" first, that should work around it. I'll fix it
> properly.

Works now, thanks.

Regards, Olaf.

2002-10-14 06:47:39

by Oleg Drokin

[permalink] [raw]
Subject: Re: [PATCH] 2.5.42: UML build error

Hello!

On Sat, Oct 12, 2002 at 11:49:35AM -0500, Kai Germaschewski wrote:

> > When building 2.5.42 UML it fails with:
> > [...]
> Okay, so here's a patch which fixes the UML build for me (i386) -
> generally, UML could use some more kbuild work, but I'll leave that for
> post-freeze ;)

Actually this patch does not work for make ARCH=um distclean (at least it does
not work for me) because there is no Makefile in arch/um/include/sysdep/
(something like a fix attached).
Also after "distclean", you cannot build UML anymore.
It fails to execute "prepare" target and therefore include/asm/arch
symlink (and others ) is not made and build fails.

gcc -Wp,-MD,arch/um/sys-i386/util/.mk_thread_kern.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -g -U__i386__ -Ui386 -D__arch_um__ -DSUBARCH=\"i386\" -D_LARGEFILE64_SOURCE -I/home/green/bk/linux-2.5/arch/um/include -Derrno=kernel_errno -nostdinc -iwithprefix include -DKBUILD_BASENAME=mk_thread_kern -c -o arch/um/sys-i386/util/mk_thread_kern.o arch/um/sys-i386/util/mk_thread_kern.c
In file included from include/linux/posix_types.h:46,
from include/linux/types.h:11,
from include/linux/capability.h:16,
from include/linux/sched.h:9,
from arch/um/sys-i386/util/mk_thread_kern.c:2:
include/asm/posix_types.h:4: asm/arch/posix_types.h: No such file or directory


===== arch/um/Makefile-i386 1.2 vs edited =====
--- 1.2/arch/um/Makefile-i386 Sat Oct 12 20:47:35 2002
+++ edited/arch/um/Makefile-i386 Mon Oct 14 09:54:09 2002
@@ -28,4 +28,4 @@

sysclean :
rm -f $(SYS_HEADERS)
- @$(call descend,$(SYS_DIR),clean)
+ @$(call descend,$(SYS_UTIL_DIR),clean)


Bye,
Oleg

2002-10-14 20:58:26

by Jeff Dike

[permalink] [raw]
Subject: Re: [uml-devel] Re: [PATCH] 2.5.42: UML build error

[email protected] said:
> (something like a fix attached).

Applied, thanks.

Jeff