[lttng-dev] lttng-modules fails to build OOT when modules are built into the linux kernel

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Fri Jul 15 15:38:41 UTC 2016


----- On Jul 15, 2016, at 3:08 AM, Anders Wallin wallinux at gmail.com wrote:

> $ make all O=../kernel_builddir
> .....
>  CC [M]  lttng/probes/lttng-kprobes.o
>  CC [M]  lttng/probes/lttng-kretprobes.o
>  LD      lttng/tests/built-in.o
>  CC [M]  lttng/tests/probes/lttng-test.o
> Assembler messages:
> Fatal error: can't create lttng/tests/probes/lttng-test.o: No such
> file or directory
> /media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:264:
> recipe for target 'lttng/tests/probes/lttng-test.o' failed
> make[3]: *** [lttng/tests/probes/lttng-test.o] Error 2
> /media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:403:
> recipe for target 'lttng/tests' failed
> make[2]: *** [lttng/tests] Error 2
> /media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/Makefile:946:
> recipe for target 'lttng' failed
> make[1]: *** [lttng] Error 2
> make[1]: Leaving directory
> '/media/awallin/sda1/home/awallin/src/lttng-test/kernel_builddir'
> Makefile:146: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
> 
> $tree ../kernel_builddir/lttng/tests/
> ../kernel_builddir/lttng/tests/
> └── built-in.o
> 
> The subdirectories  lttng/tests/clock_plugin and
> lttng/tests/clock_plugin/probes are not created when building the
> kernel out of tree!
> Move the code from the lttng/test/* to lttng/test and it will work
> Or use this patch;

I re-wrote patch to match the LTTng code (e.g. no CONFIG_LTTNG28).
Thanks for reporting the issue! It seems to only happen when building against
older kernels (reproduced here with a 2.6.38.8 kernel tree).

I committed my fix into master, cherry-picked into stable-2.8:

commit f37e05c62a2f5739e2f25db53cb6dc741029547c
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Fri Jul 15 11:29:33 2016 -0400

    Fix: tests/Kbuild for older kernels
    
    Older kernels (e.g. 2.6.38.8) don't seem to handle subdirectory in the
    same way as recent kernels (e.g. 4.6). As a result, building LTTng
    out-of-tree within a kernel modified to have LTTng as a built-in addon
    fails with CONFIG_LTTNG=m.
    
    $ make all O=../kernel_builddir
    .....
      CC [M]  lttng/probes/lttng-kprobes.o
      CC [M]  lttng/probes/lttng-kretprobes.o
      LD      lttng/tests/built-in.o
      CC [M]  lttng/tests/probes/lttng-test.o
    Assembler messages:
    Fatal error: can't create lttng/tests/probes/lttng-test.o: No such
    file or directory
    /media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:264:
    recipe for target 'lttng/tests/probes/lttng-test.o' failed
    make[3]: *** [lttng/tests/probes/lttng-test.o] Error 2
    /media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/scripts/Makefile.build:403:
    recipe for target 'lttng/tests' failed
    make[2]: *** [lttng/tests] Error 2
    /media/awallin/sda1/home/awallin/src/lttng-test/linux-2.6/Makefile:946:
    recipe for target 'lttng' failed
    make[1]: *** [lttng] Error 2
    make[1]: Leaving directory
    '/media/awallin/sda1/home/awallin/src/lttng-test/kernel_builddir'
    Makefile:146: recipe for target 'sub-make' failed
    make: *** [sub-make] Error 2
    
    $tree ../kernel_builddir/lttng/tests/
    ../kernel_builddir/lttng/tests/
    └── built-in.o
    
    Reported-by: Anders Wallin <anders.wallin at windriver.com>
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

Thanks,

Mathieu


> ---------------------------------------------------------
> From 598d76c5b17ce41ef491e9a643121da9fbdb3ef6 Mon Sep 17 00:00:00 2001
> Message-Id:
> <598d76c5b17ce41ef491e9a643121da9fbdb3ef6.1468566371.git.anders.wallin at windriver.com>
> From: Anders Wallin <anders.wallin at windriver.com>
> Date: Tue, 5 Jul 2016 14:27:08 +0200
> Subject: [PATCH 1/1] lttng28: building tests out of tree fails when using
> subdirectories to Kbuild
> 
> Signed-off-by: Anders Wallin <anders.wallin at windriver.com>
> ---
> drivers/staging/lttng2.8/tests/Kbuild | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/lttng2.8/tests/Kbuild
> b/drivers/staging/lttng2.8/tests/Kbuild
> index c529a83..86087ca 100644
> --- a/drivers/staging/lttng2.8/tests/Kbuild
> +++ b/drivers/staging/lttng2.8/tests/Kbuild
> @@ -4,8 +4,14 @@ include $(TOP_LTTNG_MODULES_DIR)/Makefile.ABI.workarounds
> 
> ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)
> 
> -obj-$(CONFIG_LTTNG28) += probes/lttng-test.o
> +obj-$(CONFIG_LTTNG28) += lttng-test.o
> 
> -obj-$(CONFIG_LTTNG28) += clock-plugin/lttng-clock-plugin-test.o
> +obj-$(CONFIG_LTTNG28) += lttng-clock-plugin-test.o
> +
> +lttng-test-objs := \
> +  probes/lttng-test.o
> +
> +lttng-clock-plugin-test-objs := \
> +  clock-plugin/lttng-clock-plugin-test.o
> 
> # vim:syntax=make
> --
> 2.9.1
> ---------------------------------------------------------
> 
> Regards
> Anders Wallin
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list