All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests: Fix build failures when invoked from kselftest target
@ 2015-03-14  1:45 Shuah Khan
  2015-03-14  1:45 ` [PATCH] selftests: Fix kcmp build to not require headers install Shuah Khan
  2015-03-16  0:38   ` Michael Ellerman
  0 siblings, 2 replies; 15+ messages in thread
From: Shuah Khan @ 2015-03-14  1:45 UTC (permalink / raw)
  To: linux-api, linux-kernel; +Cc: Shuah Khan

Several tests that rely on implicit build rules fail to build,
when invoked from the main Makefile kselftest target. These
failures are due to --no-builtin-rules and --no-builtin-variables
options set in the inherited MAKEFLAGS.

--no-builtin-rules eliminates the use of built-in implicit rules
and --no-builtin-variables is for not defining built-in variables.
These two options override the use of implicit rules resulting in
build failures. In addition, inherited LDFLAGS result in build
failures and there is no need to define LDFLAGS.  Clear LDFLAGS
and MAKEFLAG when make is invoked from the main Makefile kselftest
target. Fixing this at selftests Makefile avoids changing the main
Makefile and keeps this change self contained at selftests level.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4e51122..8e09db7 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -22,6 +22,15 @@ TARGETS += vm
 TARGETS_HOTPLUG = cpu-hotplug
 TARGETS_HOTPLUG += memory-hotplug
 
+# Clear LDFLAGS and MAKEFLAGS if called from main
+# Makefile to avoid test build failures when test
+# Makefile doesn't have explicit build rules.
+ifeq (1,$(MAKELEVEL))
+undefine LDFLAGS
+override define MAKEFLAGS =
+endef
+endif
+
 all:
 	for TARGET in $(TARGETS); do \
 		make -C $$TARGET; \
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] selftests: Fix kcmp build to not require headers install
  2015-03-14  1:45 [PATCH] selftests: Fix build failures when invoked from kselftest target Shuah Khan
@ 2015-03-14  1:45 ` Shuah Khan
  2015-03-16 11:00     ` Michael Ellerman
  2015-03-16  0:38   ` Michael Ellerman
  1 sibling, 1 reply; 15+ messages in thread
From: Shuah Khan @ 2015-03-14  1:45 UTC (permalink / raw)
  To: gorcunov, tranmanphong, mpe, akpm; +Cc: Shuah Khan, linux-api, linux-kernel

Change CFLAGS to look in uapi to allow kcmp to be built without
requiring headers install. This will make it easier to run tests
without going through the headers install step.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/kcmp/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index ff0eefd..d405ad4 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -1,5 +1,5 @@
 CC := $(CROSS_COMPILE)$(CC)
-CFLAGS += -I../../../../usr/include/
+CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
 
 all: kcmp_test
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix build failures when invoked from kselftest target
@ 2015-03-16  0:38   ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-16  0:38 UTC (permalink / raw)
  To: Shuah Khan; +Cc: linux-api, linux-kernel

On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> Several tests that rely on implicit build rules fail to build,
> when invoked from the main Makefile kselftest target. These
> failures are due to --no-builtin-rules and --no-builtin-variables
> options set in the inherited MAKEFLAGS.
> 
> --no-builtin-rules eliminates the use of built-in implicit rules
> and --no-builtin-variables is for not defining built-in variables.
> These two options override the use of implicit rules resulting in
> build failures. In addition, inherited LDFLAGS result in build
> failures and there is no need to define LDFLAGS.  Clear LDFLAGS
> and MAKEFLAG when make is invoked from the main Makefile kselftest
> target. Fixing this at selftests Makefile avoids changing the main
> Makefile and keeps this change self contained at selftests level.
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  tools/testing/selftests/Makefile | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 4e51122..8e09db7 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -22,6 +22,15 @@ TARGETS += vm
>  TARGETS_HOTPLUG = cpu-hotplug
>  TARGETS_HOTPLUG += memory-hotplug
>  
> +# Clear LDFLAGS and MAKEFLAGS if called from main
> +# Makefile to avoid test build failures when test
> +# Makefile doesn't have explicit build rules.
> +ifeq (1,$(MAKELEVEL))
> +undefine LDFLAGS
> +override define MAKEFLAGS =
> +endef
> +endif

You shouldn't need to use define/endef here, that is just for multi-line
variables.

This should be equivalent:

  ifeq (1,$(MAKELEVEL))
  undefine LDFLAGS
  override MAKEFLAGS =
  endif

cheers



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix build failures when invoked from kselftest target
@ 2015-03-16  0:38   ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-16  0:38 UTC (permalink / raw)
  To: Shuah Khan
  Cc: linux-api-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> Several tests that rely on implicit build rules fail to build,
> when invoked from the main Makefile kselftest target. These
> failures are due to --no-builtin-rules and --no-builtin-variables
> options set in the inherited MAKEFLAGS.
> 
> --no-builtin-rules eliminates the use of built-in implicit rules
> and --no-builtin-variables is for not defining built-in variables.
> These two options override the use of implicit rules resulting in
> build failures. In addition, inherited LDFLAGS result in build
> failures and there is no need to define LDFLAGS.  Clear LDFLAGS
> and MAKEFLAG when make is invoked from the main Makefile kselftest
> target. Fixing this at selftests Makefile avoids changing the main
> Makefile and keeps this change self contained at selftests level.
> 
> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
> ---
>  tools/testing/selftests/Makefile | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 4e51122..8e09db7 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -22,6 +22,15 @@ TARGETS += vm
>  TARGETS_HOTPLUG = cpu-hotplug
>  TARGETS_HOTPLUG += memory-hotplug
>  
> +# Clear LDFLAGS and MAKEFLAGS if called from main
> +# Makefile to avoid test build failures when test
> +# Makefile doesn't have explicit build rules.
> +ifeq (1,$(MAKELEVEL))
> +undefine LDFLAGS
> +override define MAKEFLAGS =
> +endef
> +endif

You shouldn't need to use define/endef here, that is just for multi-line
variables.

This should be equivalent:

  ifeq (1,$(MAKELEVEL))
  undefine LDFLAGS
  override MAKEFLAGS =
  endif

cheers

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-16 11:00     ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-16 11:00 UTC (permalink / raw)
  To: Shuah Khan; +Cc: gorcunov, tranmanphong, akpm, linux-api, linux-kernel

On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> Change CFLAGS to look in uapi to allow kcmp to be built without
> requiring headers install. This will make it easier to run tests
> without going through the headers install step.
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  tools/testing/selftests/kcmp/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> index ff0eefd..d405ad4 100644
> --- a/tools/testing/selftests/kcmp/Makefile
> +++ b/tools/testing/selftests/kcmp/Makefile
> @@ -1,5 +1,5 @@
>  CC := $(CROSS_COMPILE)$(CC)
> -CFLAGS += -I../../../../usr/include/
> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/

Hi Shuah,

Sorry but this is wrong. The contents of include/uapi are not the same as the
exported kernel headers.

Mixing the unprocessed kernel headers with user headers leads to all sorts of
mess, eg:

$ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
In file included from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27:0,
                 from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
                 from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
                 from /usr/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
 #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
  ^
In file included from ../../../../include/uapi/linux/posix_types.h:4:0,
                 from ../../../../include/uapi/linux/types.h:13,
                 from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27,
                 from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
                 from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
                 from /usr/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
 #include <linux/compiler.h>
                            ^
compilation terminated.
<builtin>: recipe for target 'kcmp_test' failed
make: *** [kcmp_test] Error 1


If you want to make it easier to build tests that need the kernel headers then
maybe kselftest should depend on headers_install?

cheers




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-16 11:00     ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-16 11:00 UTC (permalink / raw)
  To: Shuah Khan
  Cc: gorcunov-GEFAQzZX7r8dnm+yROfE0A,
	tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> Change CFLAGS to look in uapi to allow kcmp to be built without
> requiring headers install. This will make it easier to run tests
> without going through the headers install step.
> 
> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
> ---
>  tools/testing/selftests/kcmp/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> index ff0eefd..d405ad4 100644
> --- a/tools/testing/selftests/kcmp/Makefile
> +++ b/tools/testing/selftests/kcmp/Makefile
> @@ -1,5 +1,5 @@
>  CC := $(CROSS_COMPILE)$(CC)
> -CFLAGS += -I../../../../usr/include/
> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/

Hi Shuah,

Sorry but this is wrong. The contents of include/uapi are not the same as the
exported kernel headers.

Mixing the unprocessed kernel headers with user headers leads to all sorts of
mess, eg:

$ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
In file included from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27:0,
                 from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
                 from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
                 from /usr/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
 #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
  ^
In file included from ../../../../include/uapi/linux/posix_types.h:4:0,
                 from ../../../../include/uapi/linux/types.h:13,
                 from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27,
                 from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
                 from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
                 from /usr/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
 #include <linux/compiler.h>
                            ^
compilation terminated.
<builtin>: recipe for target 'kcmp_test' failed
make: *** [kcmp_test] Error 1


If you want to make it easier to build tests that need the kernel headers then
maybe kselftest should depend on headers_install?

cheers

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-18 15:04       ` Shuah Khan
  0 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2015-03-18 15:04 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: gorcunov, tranmanphong, akpm, linux-api, linux-kernel

On 03/16/2015 05:00 AM, Michael Ellerman wrote:
> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
>> Change CFLAGS to look in uapi to allow kcmp to be built without
>> requiring headers install. This will make it easier to run tests
>> without going through the headers install step.
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/testing/selftests/kcmp/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
>> index ff0eefd..d405ad4 100644
>> --- a/tools/testing/selftests/kcmp/Makefile
>> +++ b/tools/testing/selftests/kcmp/Makefile
>> @@ -1,5 +1,5 @@
>>  CC := $(CROSS_COMPILE)$(CC)
>> -CFLAGS += -I../../../../usr/include/
>> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
> 
> Hi Shuah,
> 
> Sorry but this is wrong. The contents of include/uapi are not the same as the
> exported kernel headers.
> 
> Mixing the unprocessed kernel headers with user headers leads to all sorts of
> mess, eg:
> 
> $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test

Do you see this error when you run the compile using kcmp Makefile
or using make ksefltest target?

Do you consider running cc directly isn't a valid use-case for
this test?

I see your point that kernel headers shouldn't be included from user
space. But kcmp_test isn't really a regular use space app. It is
intended for testing kernel. There are other tests that do include
uapi headers.

> In file included from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27:0,
>                  from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
>                  from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
>                  from /usr/include/signal.h:332,
>                  from kcmp_test.c:5:
> ../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
>  #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
>   ^
> In file included from ../../../../include/uapi/linux/posix_types.h:4:0,
>                  from ../../../../include/uapi/linux/types.h:13,
>                  from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27,
>                  from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
>                  from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
>                  from /usr/include/signal.h:332,
>                  from kcmp_test.c:5:
> ../../../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
>  #include <linux/compiler.h>
>                             ^
> compilation terminated.
> <builtin>: recipe for target 'kcmp_test' failed
> make: *** [kcmp_test] Error 1
> 
> 
> If you want to make it easier to build tests that need the kernel headers then
> maybe kselftest should depend on headers_install?
> 

Requiring header install is a big hammer. Thinking about a developer
use-case, if a developer is building and testing several kernels, it
is tedious install headers each time and remembering to cleanup headers.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-18 15:04       ` Shuah Khan
  0 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2015-03-18 15:04 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: gorcunov-GEFAQzZX7r8dnm+yROfE0A,
	tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 03/16/2015 05:00 AM, Michael Ellerman wrote:
> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
>> Change CFLAGS to look in uapi to allow kcmp to be built without
>> requiring headers install. This will make it easier to run tests
>> without going through the headers install step.
>>
>> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
>> ---
>>  tools/testing/selftests/kcmp/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
>> index ff0eefd..d405ad4 100644
>> --- a/tools/testing/selftests/kcmp/Makefile
>> +++ b/tools/testing/selftests/kcmp/Makefile
>> @@ -1,5 +1,5 @@
>>  CC := $(CROSS_COMPILE)$(CC)
>> -CFLAGS += -I../../../../usr/include/
>> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
> 
> Hi Shuah,
> 
> Sorry but this is wrong. The contents of include/uapi are not the same as the
> exported kernel headers.
> 
> Mixing the unprocessed kernel headers with user headers leads to all sorts of
> mess, eg:
> 
> $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test

Do you see this error when you run the compile using kcmp Makefile
or using make ksefltest target?

Do you consider running cc directly isn't a valid use-case for
this test?

I see your point that kernel headers shouldn't be included from user
space. But kcmp_test isn't really a regular use space app. It is
intended for testing kernel. There are other tests that do include
uapi headers.

> In file included from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27:0,
>                  from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
>                  from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
>                  from /usr/include/signal.h:332,
>                  from kcmp_test.c:5:
> ../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
>  #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
>   ^
> In file included from ../../../../include/uapi/linux/posix_types.h:4:0,
>                  from ../../../../include/uapi/linux/types.h:13,
>                  from /usr/include/powerpc64le-linux-gnu/asm/ptrace.h:27,
>                  from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:11,
>                  from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:27,
>                  from /usr/include/signal.h:332,
>                  from kcmp_test.c:5:
> ../../../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
>  #include <linux/compiler.h>
>                             ^
> compilation terminated.
> <builtin>: recipe for target 'kcmp_test' failed
> make: *** [kcmp_test] Error 1
> 
> 
> If you want to make it easier to build tests that need the kernel headers then
> maybe kselftest should depend on headers_install?
> 

Requiring header install is a big hammer. Thinking about a developer
use-case, if a developer is building and testing several kernels, it
is tedious install headers each time and remembering to cleanup headers.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org | (970) 217-8978

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix build failures when invoked from kselftest target
@ 2015-03-18 16:46     ` Shuah Khan
  0 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2015-03-18 16:46 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linux-api, linux-kernel, Shuah Khan

On 03/15/2015 06:38 PM, Michael Ellerman wrote:
> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
>> Several tests that rely on implicit build rules fail to build,
>> when invoked from the main Makefile kselftest target. These
>> failures are due to --no-builtin-rules and --no-builtin-variables
>> options set in the inherited MAKEFLAGS.
>>
>> --no-builtin-rules eliminates the use of built-in implicit rules
>> and --no-builtin-variables is for not defining built-in variables.
>> These two options override the use of implicit rules resulting in
>> build failures. In addition, inherited LDFLAGS result in build
>> failures and there is no need to define LDFLAGS.  Clear LDFLAGS
>> and MAKEFLAG when make is invoked from the main Makefile kselftest
>> target. Fixing this at selftests Makefile avoids changing the main
>> Makefile and keeps this change self contained at selftests level.
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/testing/selftests/Makefile | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
>> index 4e51122..8e09db7 100644
>> --- a/tools/testing/selftests/Makefile
>> +++ b/tools/testing/selftests/Makefile
>> @@ -22,6 +22,15 @@ TARGETS += vm
>>  TARGETS_HOTPLUG = cpu-hotplug
>>  TARGETS_HOTPLUG += memory-hotplug
>>  
>> +# Clear LDFLAGS and MAKEFLAGS if called from main
>> +# Makefile to avoid test build failures when test
>> +# Makefile doesn't have explicit build rules.
>> +ifeq (1,$(MAKELEVEL))
>> +undefine LDFLAGS
>> +override define MAKEFLAGS =
>> +endef
>> +endif
> 
> You shouldn't need to use define/endef here, that is just for multi-line
> variables.
> 
> This should be equivalent:
> 
>   ifeq (1,$(MAKELEVEL))
>   undefine LDFLAGS
>   override MAKEFLAGS =
>   endif
> 

ok. Will send a patch v2 with that change.

-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix build failures when invoked from kselftest target
@ 2015-03-18 16:46     ` Shuah Khan
  0 siblings, 0 replies; 15+ messages in thread
From: Shuah Khan @ 2015-03-18 16:46 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Shuah Khan

On 03/15/2015 06:38 PM, Michael Ellerman wrote:
> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
>> Several tests that rely on implicit build rules fail to build,
>> when invoked from the main Makefile kselftest target. These
>> failures are due to --no-builtin-rules and --no-builtin-variables
>> options set in the inherited MAKEFLAGS.
>>
>> --no-builtin-rules eliminates the use of built-in implicit rules
>> and --no-builtin-variables is for not defining built-in variables.
>> These two options override the use of implicit rules resulting in
>> build failures. In addition, inherited LDFLAGS result in build
>> failures and there is no need to define LDFLAGS.  Clear LDFLAGS
>> and MAKEFLAG when make is invoked from the main Makefile kselftest
>> target. Fixing this at selftests Makefile avoids changing the main
>> Makefile and keeps this change self contained at selftests level.
>>
>> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
>> ---
>>  tools/testing/selftests/Makefile | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
>> index 4e51122..8e09db7 100644
>> --- a/tools/testing/selftests/Makefile
>> +++ b/tools/testing/selftests/Makefile
>> @@ -22,6 +22,15 @@ TARGETS += vm
>>  TARGETS_HOTPLUG = cpu-hotplug
>>  TARGETS_HOTPLUG += memory-hotplug
>>  
>> +# Clear LDFLAGS and MAKEFLAGS if called from main
>> +# Makefile to avoid test build failures when test
>> +# Makefile doesn't have explicit build rules.
>> +ifeq (1,$(MAKELEVEL))
>> +undefine LDFLAGS
>> +override define MAKEFLAGS =
>> +endef
>> +endif
> 
> You shouldn't need to use define/endef here, that is just for multi-line
> variables.
> 
> This should be equivalent:
> 
>   ifeq (1,$(MAKELEVEL))
>   undefine LDFLAGS
>   override MAKEFLAGS =
>   endif
> 

ok. Will send a patch v2 with that change.

-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org | (970) 217-8978

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-19  0:02         ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-19  0:02 UTC (permalink / raw)
  To: Shuah Khan; +Cc: gorcunov, tranmanphong, akpm, linux-api, linux-kernel

On Wed, 2015-03-18 at 09:04 -0600, Shuah Khan wrote:
> On 03/16/2015 05:00 AM, Michael Ellerman wrote:
> > On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> >> Change CFLAGS to look in uapi to allow kcmp to be built without
> >> requiring headers install. This will make it easier to run tests
> >> without going through the headers install step.
> >>
> >> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> >> ---
> >>  tools/testing/selftests/kcmp/Makefile | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> >> index ff0eefd..d405ad4 100644
> >> --- a/tools/testing/selftests/kcmp/Makefile
> >> +++ b/tools/testing/selftests/kcmp/Makefile
> >> @@ -1,5 +1,5 @@
> >>  CC := $(CROSS_COMPILE)$(CC)
> >> -CFLAGS += -I../../../../usr/include/
> >> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
> > 
> > Hi Shuah,
> > 
> > Sorry but this is wrong. The contents of include/uapi are not the same as the
> > exported kernel headers.
> > 
> > Mixing the unprocessed kernel headers with user headers leads to all sorts of
> > mess, eg:
> > 
> > $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
> 
> Do you see this error when you run the compile using kcmp Makefile
> or using make ksefltest target?

$ cd tools/testing/selftests
$ make TARGETS=kcmp
for TARGET in kcmp; do \
	make -C $TARGET; \
done;
make[1]: Entering directory '/home/michael/work/topics/powerpc-maint/src/misc-test/tools/testing/selftests/kcmp'
ppc64-cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
In file included from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27:0,
                 from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
                 from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
                 from /usr/powerpc-linux-gnu/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
 #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
  ^

etc.

I don't use the kselftest target, because I'm cross compiling, and it assumes
you are running natively (it runs the tests). (And it doesn't work at the
moment because of -rR and LDFLAGS).

> Do you consider running cc directly isn't a valid use-case for
> this test?

Running cc directly is completely legitimate. It makes no difference anyway.

> I see your point that kernel headers shouldn't be included from user
> space. 

Good!

> But kcmp_test isn't really a regular use space app. It is
> intended for testing kernel. 

It is 100% a regular user space app. It tests the kernel using syscalls, just
like every other user space app.

> There are other tests that do include uapi headers.

They are also wrong and should be fixed.
 
> Requiring header install is a big hammer. Thinking about a developer
> use-case, if a developer is building and testing several kernels, it
> is tedious install headers each time and remembering to cleanup headers.

But if you are testing a kernel without installing the headers for that
kernel, you are not actually testing that kernel. You're testing that kernel
with some other kernel's headers, which is something different.

Because we are (generally) careful not to break the userspace API, it usually
works to build things with one kernels headers and run them on another kernel.
But if you're interested in testing a particular kernel version properly then
you absolutely must install that kernel's headers before building the tests.

cheers



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-19  0:02         ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-19  0:02 UTC (permalink / raw)
  To: Shuah Khan
  Cc: gorcunov-GEFAQzZX7r8dnm+yROfE0A,
	tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, 2015-03-18 at 09:04 -0600, Shuah Khan wrote:
> On 03/16/2015 05:00 AM, Michael Ellerman wrote:
> > On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> >> Change CFLAGS to look in uapi to allow kcmp to be built without
> >> requiring headers install. This will make it easier to run tests
> >> without going through the headers install step.
> >>
> >> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
> >> ---
> >>  tools/testing/selftests/kcmp/Makefile | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> >> index ff0eefd..d405ad4 100644
> >> --- a/tools/testing/selftests/kcmp/Makefile
> >> +++ b/tools/testing/selftests/kcmp/Makefile
> >> @@ -1,5 +1,5 @@
> >>  CC := $(CROSS_COMPILE)$(CC)
> >> -CFLAGS += -I../../../../usr/include/
> >> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
> > 
> > Hi Shuah,
> > 
> > Sorry but this is wrong. The contents of include/uapi are not the same as the
> > exported kernel headers.
> > 
> > Mixing the unprocessed kernel headers with user headers leads to all sorts of
> > mess, eg:
> > 
> > $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
> 
> Do you see this error when you run the compile using kcmp Makefile
> or using make ksefltest target?

$ cd tools/testing/selftests
$ make TARGETS=kcmp
for TARGET in kcmp; do \
	make -C $TARGET; \
done;
make[1]: Entering directory '/home/michael/work/topics/powerpc-maint/src/misc-test/tools/testing/selftests/kcmp'
ppc64-cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
In file included from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27:0,
                 from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
                 from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
                 from /usr/powerpc-linux-gnu/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
 #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
  ^

etc.

I don't use the kselftest target, because I'm cross compiling, and it assumes
you are running natively (it runs the tests). (And it doesn't work at the
moment because of -rR and LDFLAGS).

> Do you consider running cc directly isn't a valid use-case for
> this test?

Running cc directly is completely legitimate. It makes no difference anyway.

> I see your point that kernel headers shouldn't be included from user
> space. 

Good!

> But kcmp_test isn't really a regular use space app. It is
> intended for testing kernel. 

It is 100% a regular user space app. It tests the kernel using syscalls, just
like every other user space app.

> There are other tests that do include uapi headers.

They are also wrong and should be fixed.
 
> Requiring header install is a big hammer. Thinking about a developer
> use-case, if a developer is building and testing several kernels, it
> is tedious install headers each time and remembering to cleanup headers.

But if you are testing a kernel without installing the headers for that
kernel, you are not actually testing that kernel. You're testing that kernel
with some other kernel's headers, which is something different.

Because we are (generally) careful not to break the userspace API, it usually
works to build things with one kernels headers and run them on another kernel.
But if you're interested in testing a particular kernel version properly then
you absolutely must install that kernel's headers before building the tests.

cheers

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
  2015-03-19  0:02         ` Michael Ellerman
  (?)
@ 2015-03-19  0:18         ` Shuah Khan
  2015-03-19  0:51             ` Michael Ellerman
  -1 siblings, 1 reply; 15+ messages in thread
From: Shuah Khan @ 2015-03-19  0:18 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: gorcunov, tranmanphong, akpm, linux-api, linux-kernel, Shuah Khan

On 03/18/2015 06:02 PM, Michael Ellerman wrote:
> On Wed, 2015-03-18 at 09:04 -0600, Shuah Khan wrote:
>> On 03/16/2015 05:00 AM, Michael Ellerman wrote:
>>> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
>>>> Change CFLAGS to look in uapi to allow kcmp to be built without
>>>> requiring headers install. This will make it easier to run tests
>>>> without going through the headers install step.
>>>>
>>>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>>>> ---
>>>>  tools/testing/selftests/kcmp/Makefile | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
>>>> index ff0eefd..d405ad4 100644
>>>> --- a/tools/testing/selftests/kcmp/Makefile
>>>> +++ b/tools/testing/selftests/kcmp/Makefile
>>>> @@ -1,5 +1,5 @@
>>>>  CC := $(CROSS_COMPILE)$(CC)
>>>> -CFLAGS += -I../../../../usr/include/
>>>> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
>>>
>>> Hi Shuah,
>>>
>>> Sorry but this is wrong. The contents of include/uapi are not the same as the
>>> exported kernel headers.
>>>
>>> Mixing the unprocessed kernel headers with user headers leads to all sorts of
>>> mess, eg:
>>>
>>> $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
>>
>> Do you see this error when you run the compile using kcmp Makefile
>> or using make ksefltest target?
> 
> $ cd tools/testing/selftests
> $ make TARGETS=kcmp
> for TARGET in kcmp; do \
> 	make -C $TARGET; \
> done;
> make[1]: Entering directory '/home/michael/work/topics/powerpc-maint/src/misc-test/tools/testing/selftests/kcmp'
> ppc64-cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
> In file included from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27:0,
>                  from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
>                  from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
>                  from /usr/powerpc-linux-gnu/include/signal.h:332,
>                  from kcmp_test.c:5:
> ../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
>  #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
>   ^
> 

Hmm..  I don't see this when I run it on x86

make TARGETS=kcmp
for TARGET in kcmp; do \
	make -C $TARGET; \
done;
make[1]: Entering directory
'/lkml/linux-kselftest/tools/testing/selftests/kcmp'
cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c
  -o kcmp_test
make[1]: Leaving directory
'/lkml/linux-kselftest/tools/testing/selftests/kcmp'

oh well. I don't want to make the change, since it introduces warnings
on powerpc.

-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-19  0:51             ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-19  0:51 UTC (permalink / raw)
  To: Shuah Khan; +Cc: gorcunov, tranmanphong, akpm, linux-api, linux-kernel

On Wed, 2015-03-18 at 18:18 -0600, Shuah Khan wrote:
> On 03/18/2015 06:02 PM, Michael Ellerman wrote:
> > On Wed, 2015-03-18 at 09:04 -0600, Shuah Khan wrote:
> >> On 03/16/2015 05:00 AM, Michael Ellerman wrote:
> >>> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> >>>> Change CFLAGS to look in uapi to allow kcmp to be built without
> >>>> requiring headers install. This will make it easier to run tests
> >>>> without going through the headers install step.
> >>>>
> >>>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> >>>> ---
> >>>>  tools/testing/selftests/kcmp/Makefile | 2 +-
> >>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> >>>> index ff0eefd..d405ad4 100644
> >>>> --- a/tools/testing/selftests/kcmp/Makefile
> >>>> +++ b/tools/testing/selftests/kcmp/Makefile
> >>>> @@ -1,5 +1,5 @@
> >>>>  CC := $(CROSS_COMPILE)$(CC)
> >>>> -CFLAGS += -I../../../../usr/include/
> >>>> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
> >>>
> >>> Hi Shuah,
> >>>
> >>> Sorry but this is wrong. The contents of include/uapi are not the same as the
> >>> exported kernel headers.
> >>>
> >>> Mixing the unprocessed kernel headers with user headers leads to all sorts of
> >>> mess, eg:
> >>>
> >>> $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
> >>
> >> Do you see this error when you run the compile using kcmp Makefile
> >> or using make ksefltest target?
> > 
> > $ cd tools/testing/selftests
> > $ make TARGETS=kcmp
> > for TARGET in kcmp; do \
> > 	make -C $TARGET; \
> > done;
> > make[1]: Entering directory '/home/michael/work/topics/powerpc-maint/src/misc-test/tools/testing/selftests/kcmp'
> > ppc64-cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
> > In file included from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27:0,
> >                  from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
> >                  from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
> >                  from /usr/powerpc-linux-gnu/include/signal.h:332,
> >                  from kcmp_test.c:5:
> > ../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
> >  #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
> >   ^
> > 
> 
> Hmm..  I don't see this when I run it on x86
> 
> make TARGETS=kcmp
> for TARGET in kcmp; do \
> 	make -C $TARGET; \
> done;
> make[1]: Entering directory
> '/lkml/linux-kselftest/tools/testing/selftests/kcmp'
> cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c
>   -o kcmp_test
> make[1]: Leaving directory
> '/lkml/linux-kselftest/tools/testing/selftests/kcmp'

Yeah, but that's basically just luck.

$ cc -w -H -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
. /usr/include/stdio.h
.. /usr/include/features.h
... /usr/include/x86_64-linux-gnu/sys/cdefs.h
.... /usr/include/x86_64-linux-gnu/bits/wordsize.h
... /usr/include/x86_64-linux-gnu/gnu/stubs.h
.... /usr/include/x86_64-linux-gnu/gnu/stubs-64.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/types.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
... /usr/include/x86_64-linux-gnu/bits/typesizes.h
.. /usr/include/libio.h
... /usr/include/_G_config.h
.... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.... /usr/include/wchar.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h
.. /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
.. /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
. /usr/include/stdlib.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/waitflags.h
.. /usr/include/x86_64-linux-gnu/bits/waitstatus.h
... /usr/include/endian.h
.... /usr/include/x86_64-linux-gnu/bits/endian.h
.... /usr/include/x86_64-linux-gnu/bits/byteswap.h
..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
..... /usr/include/x86_64-linux-gnu/bits/byteswap-16.h
.. /usr/include/xlocale.h
.. /usr/include/x86_64-linux-gnu/sys/types.h
... /usr/include/time.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
... /usr/include/x86_64-linux-gnu/sys/select.h
.... /usr/include/x86_64-linux-gnu/bits/select.h
..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.... /usr/include/x86_64-linux-gnu/bits/sigset.h
.... /usr/include/time.h
.... /usr/include/x86_64-linux-gnu/bits/time.h
... /usr/include/x86_64-linux-gnu/sys/sysmacros.h
... /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
.... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.. /usr/include/alloca.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/stdlib-float.h
. /usr/include/signal.h
.. /usr/include/x86_64-linux-gnu/bits/sigset.h
.. /usr/include/x86_64-linux-gnu/bits/signum.h
.. /usr/include/time.h
.. /usr/include/x86_64-linux-gnu/bits/siginfo.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.. /usr/include/x86_64-linux-gnu/bits/sigaction.h
.. /usr/include/x86_64-linux-gnu/bits/sigcontext.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/sigstack.h
.. /usr/include/x86_64-linux-gnu/sys/ucontext.h
... /usr/include/signal.h
.. /usr/include/x86_64-linux-gnu/bits/sigthread.h
. /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h
.... /usr/include/limits.h
..... /usr/include/x86_64-linux-gnu/bits/posix1_lim.h
...... /usr/include/x86_64-linux-gnu/bits/local_lim.h
....... ../../../../include/uapi/linux/limits.h
..... /usr/include/x86_64-linux-gnu/bits/posix2_lim.h
..... /usr/include/x86_64-linux-gnu/bits/xopen_lim.h
...... /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
. /usr/include/unistd.h
.. /usr/include/x86_64-linux-gnu/bits/posix_opt.h
.. /usr/include/x86_64-linux-gnu/bits/environments.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/confname.h
.. /usr/include/getopt.h
. /usr/include/errno.h
.. /usr/include/x86_64-linux-gnu/bits/errno.h
... ../../../../include/uapi/linux/errno.h
.... /usr/include/x86_64-linux-gnu/asm/errno.h
..... ../../../../include/uapi/asm-generic/errno.h
...... ../../../../include/uapi/asm-generic/errno-base.h
. /usr/include/string.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
. /usr/include/fcntl.h
.. /usr/include/x86_64-linux-gnu/bits/fcntl.h
... /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h
.... /usr/include/x86_64-linux-gnu/bits/uio.h
.. /usr/include/time.h
.. /usr/include/x86_64-linux-gnu/bits/stat.h
. ../../../../include/uapi/linux/unistd.h
.. /usr/include/x86_64-linux-gnu/asm/unistd.h
... /usr/include/x86_64-linux-gnu/asm/unistd_64.h
. ../../../../include/uapi/linux/kcmp.h
. /usr/include/x86_64-linux-gnu/sys/syscall.h
.. /usr/include/x86_64-linux-gnu/bits/syscall.h
. /usr/include/x86_64-linux-gnu/sys/stat.h
.. /usr/include/time.h
.. /usr/include/x86_64-linux-gnu/bits/stat.h
. /usr/include/x86_64-linux-gnu/sys/wait.h
.. /usr/include/x86_64-linux-gnu/bits/siginfo.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
. ../kselftest.h
Multiple include guards may be useful for:
../../../../include/uapi/linux/errno.h
/usr/include/errno.h
/usr/include/limits.h
/usr/include/wchar.h
/usr/include/x86_64-linux-gnu/asm/errno.h
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h
/usr/include/x86_64-linux-gnu/bits/byteswap.h
/usr/include/x86_64-linux-gnu/bits/confname.h
/usr/include/x86_64-linux-gnu/bits/endian.h
/usr/include/x86_64-linux-gnu/bits/environments.h
/usr/include/x86_64-linux-gnu/bits/errno.h
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h
/usr/include/x86_64-linux-gnu/bits/fcntl.h
/usr/include/x86_64-linux-gnu/bits/local_lim.h
/usr/include/x86_64-linux-gnu/bits/select.h
/usr/include/x86_64-linux-gnu/bits/sigaction.h
/usr/include/x86_64-linux-gnu/bits/signum.h
/usr/include/x86_64-linux-gnu/bits/sigstack.h
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h
/usr/include/x86_64-linux-gnu/bits/syscall.h
/usr/include/x86_64-linux-gnu/bits/time.h
/usr/include/x86_64-linux-gnu/bits/typesizes.h
/usr/include/x86_64-linux-gnu/bits/uio.h
/usr/include/x86_64-linux-gnu/bits/waitflags.h
/usr/include/x86_64-linux-gnu/bits/waitstatus.h
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h
/usr/include/x86_64-linux-gnu/gnu/stubs.h
/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h


As you can see it uses a few uapi headers, but not many, and we seem to get
away with it.

On powerpc instead we have:

$ ppc64-cc -w -H -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
. /usr/powerpc-linux-gnu/include/stdio.h
.. /usr/powerpc-linux-gnu/include/features.h
... /usr/powerpc-linux-gnu/include/sys/cdefs.h
.... /usr/powerpc-linux-gnu/include/bits/wordsize.h
... /usr/powerpc-linux-gnu/include/gnu/stubs.h
.... /usr/powerpc-linux-gnu/include/bits/wordsize.h
.... /usr/powerpc-linux-gnu/include/gnu/stubs-32.h
.. /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.. /usr/powerpc-linux-gnu/include/bits/types.h
... /usr/powerpc-linux-gnu/include/bits/wordsize.h
... /usr/powerpc-linux-gnu/include/bits/typesizes.h
.. /usr/powerpc-linux-gnu/include/libio.h
... /usr/powerpc-linux-gnu/include/_G_config.h
.... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.... /usr/powerpc-linux-gnu/include/wchar.h
... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stdarg.h
.. /usr/powerpc-linux-gnu/include/bits/stdio_lim.h
.. /usr/powerpc-linux-gnu/include/bits/sys_errlist.h
. /usr/powerpc-linux-gnu/include/stdlib.h
.. /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.. /usr/powerpc-linux-gnu/include/bits/waitflags.h
.. /usr/powerpc-linux-gnu/include/bits/waitstatus.h
... /usr/powerpc-linux-gnu/include/endian.h
.... /usr/powerpc-linux-gnu/include/bits/endian.h
.... /usr/powerpc-linux-gnu/include/bits/byteswap.h
..... /usr/powerpc-linux-gnu/include/bits/byteswap-16.h
.. /usr/powerpc-linux-gnu/include/xlocale.h
.. /usr/powerpc-linux-gnu/include/sys/types.h
... /usr/powerpc-linux-gnu/include/time.h
... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
... /usr/powerpc-linux-gnu/include/sys/select.h
.... /usr/powerpc-linux-gnu/include/bits/select.h
.... /usr/powerpc-linux-gnu/include/bits/sigset.h
.... /usr/powerpc-linux-gnu/include/time.h
.... /usr/powerpc-linux-gnu/include/bits/time.h
... /usr/powerpc-linux-gnu/include/sys/sysmacros.h
... /usr/powerpc-linux-gnu/include/bits/pthreadtypes.h
.... /usr/powerpc-linux-gnu/include/bits/wordsize.h
.. /usr/powerpc-linux-gnu/include/alloca.h
... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.. /usr/powerpc-linux-gnu/include/bits/stdlib-float.h
. /usr/powerpc-linux-gnu/include/signal.h
.. /usr/powerpc-linux-gnu/include/bits/sigset.h
.. /usr/powerpc-linux-gnu/include/bits/signum.h
.. /usr/powerpc-linux-gnu/include/time.h
.. /usr/powerpc-linux-gnu/include/bits/siginfo.h
... /usr/powerpc-linux-gnu/include/bits/wordsize.h
.. /usr/powerpc-linux-gnu/include/bits/sigaction.h
.. /usr/powerpc-linux-gnu/include/bits/sigcontext.h
... /usr/powerpc-linux-gnu/include/asm/sigcontext.h
.... /usr/powerpc-linux-gnu/include/asm/ptrace.h
..... ../../../../include/uapi/linux/types.h
...... /usr/powerpc-linux-gnu/include/asm/types.h
....... ../../../../include/uapi/asm-generic/int-ll64.h
........ /usr/powerpc-linux-gnu/include/asm/bitsperlong.h
......... ../../../../include/uapi/asm-generic/bitsperlong.h
...... ../../../../include/uapi/linux/posix_types.h
....... ../../../../include/uapi/linux/stddef.h
In file included from ../../../../include/uapi/linux/posix_types.h:4:0,
                 from ../../../../include/uapi/linux/types.h:13,
                 from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27,
                 from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
                 from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
                 from /usr/powerpc-linux-gnu/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
 #include <linux/compiler.h>
                            ^
compilation terminated.


So things start to go badly when we include asm/sigcontext.h. It just comes
down to the exact sequence the headers are included, and we can't do much about
that.

cheers



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] selftests: Fix kcmp build to not require headers install
@ 2015-03-19  0:51             ` Michael Ellerman
  0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2015-03-19  0:51 UTC (permalink / raw)
  To: Shuah Khan
  Cc: gorcunov-GEFAQzZX7r8dnm+yROfE0A,
	tranmanphong-Re5JQEeQqe8AvxtiuMwx3w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	linux-api-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, 2015-03-18 at 18:18 -0600, Shuah Khan wrote:
> On 03/18/2015 06:02 PM, Michael Ellerman wrote:
> > On Wed, 2015-03-18 at 09:04 -0600, Shuah Khan wrote:
> >> On 03/16/2015 05:00 AM, Michael Ellerman wrote:
> >>> On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> >>>> Change CFLAGS to look in uapi to allow kcmp to be built without
> >>>> requiring headers install. This will make it easier to run tests
> >>>> without going through the headers install step.
> >>>>
> >>>> Signed-off-by: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
> >>>> ---
> >>>>  tools/testing/selftests/kcmp/Makefile | 2 +-
> >>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
> >>>> index ff0eefd..d405ad4 100644
> >>>> --- a/tools/testing/selftests/kcmp/Makefile
> >>>> +++ b/tools/testing/selftests/kcmp/Makefile
> >>>> @@ -1,5 +1,5 @@
> >>>>  CC := $(CROSS_COMPILE)$(CC)
> >>>> -CFLAGS += -I../../../../usr/include/
> >>>> +CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
> >>>
> >>> Hi Shuah,
> >>>
> >>> Sorry but this is wrong. The contents of include/uapi are not the same as the
> >>> exported kernel headers.
> >>>
> >>> Mixing the unprocessed kernel headers with user headers leads to all sorts of
> >>> mess, eg:
> >>>
> >>> $ cc -I../../../../include/uapi -I../../../../usr/include/ kcmp_test.c   -o kcmp_test
> >>
> >> Do you see this error when you run the compile using kcmp Makefile
> >> or using make ksefltest target?
> > 
> > $ cd tools/testing/selftests
> > $ make TARGETS=kcmp
> > for TARGET in kcmp; do \
> > 	make -C $TARGET; \
> > done;
> > make[1]: Entering directory '/home/michael/work/topics/powerpc-maint/src/misc-test/tools/testing/selftests/kcmp'
> > ppc64-cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
> > In file included from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27:0,
> >                  from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
> >                  from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
> >                  from /usr/powerpc-linux-gnu/include/signal.h:332,
> >                  from kcmp_test.c:5:
> > ../../../../include/uapi/linux/types.h:9:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" [-Wcpp]
> >  #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
> >   ^
> > 
> 
> Hmm..  I don't see this when I run it on x86
> 
> make TARGETS=kcmp
> for TARGET in kcmp; do \
> 	make -C $TARGET; \
> done;
> make[1]: Entering directory
> '/lkml/linux-kselftest/tools/testing/selftests/kcmp'
> cc -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c
>   -o kcmp_test
> make[1]: Leaving directory
> '/lkml/linux-kselftest/tools/testing/selftests/kcmp'

Yeah, but that's basically just luck.

$ cc -w -H -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
. /usr/include/stdio.h
.. /usr/include/features.h
... /usr/include/x86_64-linux-gnu/sys/cdefs.h
.... /usr/include/x86_64-linux-gnu/bits/wordsize.h
... /usr/include/x86_64-linux-gnu/gnu/stubs.h
.... /usr/include/x86_64-linux-gnu/gnu/stubs-64.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/types.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
... /usr/include/x86_64-linux-gnu/bits/typesizes.h
.. /usr/include/libio.h
... /usr/include/_G_config.h
.... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.... /usr/include/wchar.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h
.. /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
.. /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
. /usr/include/stdlib.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/waitflags.h
.. /usr/include/x86_64-linux-gnu/bits/waitstatus.h
... /usr/include/endian.h
.... /usr/include/x86_64-linux-gnu/bits/endian.h
.... /usr/include/x86_64-linux-gnu/bits/byteswap.h
..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
..... /usr/include/x86_64-linux-gnu/bits/byteswap-16.h
.. /usr/include/xlocale.h
.. /usr/include/x86_64-linux-gnu/sys/types.h
... /usr/include/time.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
... /usr/include/x86_64-linux-gnu/sys/select.h
.... /usr/include/x86_64-linux-gnu/bits/select.h
..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.... /usr/include/x86_64-linux-gnu/bits/sigset.h
.... /usr/include/time.h
.... /usr/include/x86_64-linux-gnu/bits/time.h
... /usr/include/x86_64-linux-gnu/sys/sysmacros.h
... /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
.... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.. /usr/include/alloca.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/stdlib-float.h
. /usr/include/signal.h
.. /usr/include/x86_64-linux-gnu/bits/sigset.h
.. /usr/include/x86_64-linux-gnu/bits/signum.h
.. /usr/include/time.h
.. /usr/include/x86_64-linux-gnu/bits/siginfo.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.. /usr/include/x86_64-linux-gnu/bits/sigaction.h
.. /usr/include/x86_64-linux-gnu/bits/sigcontext.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/sigstack.h
.. /usr/include/x86_64-linux-gnu/sys/ucontext.h
... /usr/include/signal.h
.. /usr/include/x86_64-linux-gnu/bits/sigthread.h
. /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h
... /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h
.... /usr/include/limits.h
..... /usr/include/x86_64-linux-gnu/bits/posix1_lim.h
...... /usr/include/x86_64-linux-gnu/bits/local_lim.h
....... ../../../../include/uapi/linux/limits.h
..... /usr/include/x86_64-linux-gnu/bits/posix2_lim.h
..... /usr/include/x86_64-linux-gnu/bits/xopen_lim.h
...... /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
. /usr/include/unistd.h
.. /usr/include/x86_64-linux-gnu/bits/posix_opt.h
.. /usr/include/x86_64-linux-gnu/bits/environments.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
.. /usr/include/x86_64-linux-gnu/bits/confname.h
.. /usr/include/getopt.h
. /usr/include/errno.h
.. /usr/include/x86_64-linux-gnu/bits/errno.h
... ../../../../include/uapi/linux/errno.h
.... /usr/include/x86_64-linux-gnu/asm/errno.h
..... ../../../../include/uapi/asm-generic/errno.h
...... ../../../../include/uapi/asm-generic/errno-base.h
. /usr/include/string.h
.. /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h
. /usr/include/fcntl.h
.. /usr/include/x86_64-linux-gnu/bits/fcntl.h
... /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h
.... /usr/include/x86_64-linux-gnu/bits/uio.h
.. /usr/include/time.h
.. /usr/include/x86_64-linux-gnu/bits/stat.h
. ../../../../include/uapi/linux/unistd.h
.. /usr/include/x86_64-linux-gnu/asm/unistd.h
... /usr/include/x86_64-linux-gnu/asm/unistd_64.h
. ../../../../include/uapi/linux/kcmp.h
. /usr/include/x86_64-linux-gnu/sys/syscall.h
.. /usr/include/x86_64-linux-gnu/bits/syscall.h
. /usr/include/x86_64-linux-gnu/sys/stat.h
.. /usr/include/time.h
.. /usr/include/x86_64-linux-gnu/bits/stat.h
. /usr/include/x86_64-linux-gnu/sys/wait.h
.. /usr/include/x86_64-linux-gnu/bits/siginfo.h
... /usr/include/x86_64-linux-gnu/bits/wordsize.h
. ../kselftest.h
Multiple include guards may be useful for:
../../../../include/uapi/linux/errno.h
/usr/include/errno.h
/usr/include/limits.h
/usr/include/wchar.h
/usr/include/x86_64-linux-gnu/asm/errno.h
/usr/include/x86_64-linux-gnu/bits/byteswap-16.h
/usr/include/x86_64-linux-gnu/bits/byteswap.h
/usr/include/x86_64-linux-gnu/bits/confname.h
/usr/include/x86_64-linux-gnu/bits/endian.h
/usr/include/x86_64-linux-gnu/bits/environments.h
/usr/include/x86_64-linux-gnu/bits/errno.h
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h
/usr/include/x86_64-linux-gnu/bits/fcntl.h
/usr/include/x86_64-linux-gnu/bits/local_lim.h
/usr/include/x86_64-linux-gnu/bits/select.h
/usr/include/x86_64-linux-gnu/bits/sigaction.h
/usr/include/x86_64-linux-gnu/bits/signum.h
/usr/include/x86_64-linux-gnu/bits/sigstack.h
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h
/usr/include/x86_64-linux-gnu/bits/syscall.h
/usr/include/x86_64-linux-gnu/bits/time.h
/usr/include/x86_64-linux-gnu/bits/typesizes.h
/usr/include/x86_64-linux-gnu/bits/uio.h
/usr/include/x86_64-linux-gnu/bits/waitflags.h
/usr/include/x86_64-linux-gnu/bits/waitstatus.h
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h
/usr/include/x86_64-linux-gnu/gnu/stubs.h
/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h


As you can see it uses a few uapi headers, but not many, and we seem to get
away with it.

On powerpc instead we have:

$ ppc64-cc -w -H -I../../../../include/uapi -I../../../../usr/include/    kcmp_test.c   -o kcmp_test
. /usr/powerpc-linux-gnu/include/stdio.h
.. /usr/powerpc-linux-gnu/include/features.h
... /usr/powerpc-linux-gnu/include/sys/cdefs.h
.... /usr/powerpc-linux-gnu/include/bits/wordsize.h
... /usr/powerpc-linux-gnu/include/gnu/stubs.h
.... /usr/powerpc-linux-gnu/include/bits/wordsize.h
.... /usr/powerpc-linux-gnu/include/gnu/stubs-32.h
.. /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.. /usr/powerpc-linux-gnu/include/bits/types.h
... /usr/powerpc-linux-gnu/include/bits/wordsize.h
... /usr/powerpc-linux-gnu/include/bits/typesizes.h
.. /usr/powerpc-linux-gnu/include/libio.h
... /usr/powerpc-linux-gnu/include/_G_config.h
.... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.... /usr/powerpc-linux-gnu/include/wchar.h
... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stdarg.h
.. /usr/powerpc-linux-gnu/include/bits/stdio_lim.h
.. /usr/powerpc-linux-gnu/include/bits/sys_errlist.h
. /usr/powerpc-linux-gnu/include/stdlib.h
.. /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.. /usr/powerpc-linux-gnu/include/bits/waitflags.h
.. /usr/powerpc-linux-gnu/include/bits/waitstatus.h
... /usr/powerpc-linux-gnu/include/endian.h
.... /usr/powerpc-linux-gnu/include/bits/endian.h
.... /usr/powerpc-linux-gnu/include/bits/byteswap.h
..... /usr/powerpc-linux-gnu/include/bits/byteswap-16.h
.. /usr/powerpc-linux-gnu/include/xlocale.h
.. /usr/powerpc-linux-gnu/include/sys/types.h
... /usr/powerpc-linux-gnu/include/time.h
... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
... /usr/powerpc-linux-gnu/include/sys/select.h
.... /usr/powerpc-linux-gnu/include/bits/select.h
.... /usr/powerpc-linux-gnu/include/bits/sigset.h
.... /usr/powerpc-linux-gnu/include/time.h
.... /usr/powerpc-linux-gnu/include/bits/time.h
... /usr/powerpc-linux-gnu/include/sys/sysmacros.h
... /usr/powerpc-linux-gnu/include/bits/pthreadtypes.h
.... /usr/powerpc-linux-gnu/include/bits/wordsize.h
.. /usr/powerpc-linux-gnu/include/alloca.h
... /usr/lib/gcc-cross/powerpc-linux-gnu/4.9/include/stddef.h
.. /usr/powerpc-linux-gnu/include/bits/stdlib-float.h
. /usr/powerpc-linux-gnu/include/signal.h
.. /usr/powerpc-linux-gnu/include/bits/sigset.h
.. /usr/powerpc-linux-gnu/include/bits/signum.h
.. /usr/powerpc-linux-gnu/include/time.h
.. /usr/powerpc-linux-gnu/include/bits/siginfo.h
... /usr/powerpc-linux-gnu/include/bits/wordsize.h
.. /usr/powerpc-linux-gnu/include/bits/sigaction.h
.. /usr/powerpc-linux-gnu/include/bits/sigcontext.h
... /usr/powerpc-linux-gnu/include/asm/sigcontext.h
.... /usr/powerpc-linux-gnu/include/asm/ptrace.h
..... ../../../../include/uapi/linux/types.h
...... /usr/powerpc-linux-gnu/include/asm/types.h
....... ../../../../include/uapi/asm-generic/int-ll64.h
........ /usr/powerpc-linux-gnu/include/asm/bitsperlong.h
......... ../../../../include/uapi/asm-generic/bitsperlong.h
...... ../../../../include/uapi/linux/posix_types.h
....... ../../../../include/uapi/linux/stddef.h
In file included from ../../../../include/uapi/linux/posix_types.h:4:0,
                 from ../../../../include/uapi/linux/types.h:13,
                 from /usr/powerpc-linux-gnu/include/asm/ptrace.h:27,
                 from /usr/powerpc-linux-gnu/include/asm/sigcontext.h:11,
                 from /usr/powerpc-linux-gnu/include/bits/sigcontext.h:27,
                 from /usr/powerpc-linux-gnu/include/signal.h:332,
                 from kcmp_test.c:5:
../../../../include/uapi/linux/stddef.h:1:28: fatal error: linux/compiler.h: No such file or directory
 #include <linux/compiler.h>
                            ^
compilation terminated.


So things start to go badly when we include asm/sigcontext.h. It just comes
down to the exact sequence the headers are included, and we can't do much about
that.

cheers

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-03-19  0:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-14  1:45 [PATCH] selftests: Fix build failures when invoked from kselftest target Shuah Khan
2015-03-14  1:45 ` [PATCH] selftests: Fix kcmp build to not require headers install Shuah Khan
2015-03-16 11:00   ` Michael Ellerman
2015-03-16 11:00     ` Michael Ellerman
2015-03-18 15:04     ` Shuah Khan
2015-03-18 15:04       ` Shuah Khan
2015-03-19  0:02       ` Michael Ellerman
2015-03-19  0:02         ` Michael Ellerman
2015-03-19  0:18         ` Shuah Khan
2015-03-19  0:51           ` Michael Ellerman
2015-03-19  0:51             ` Michael Ellerman
2015-03-16  0:38 ` [PATCH] selftests: Fix build failures when invoked from kselftest target Michael Ellerman
2015-03-16  0:38   ` Michael Ellerman
2015-03-18 16:46   ` Shuah Khan
2015-03-18 16:46     ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.