Skip to contentSkip to conversation

make -C tools clean failure on older systems

PATCH Arnaldo Carvalho de Melo 3 participants 7 messages May 14, 2015 Kselftest

lore
Share & tools
lore
#0 lore raw

Hi,

	In:

-------------
commit 67d8712dcc70aa16d8e14a52eb73870e3cbddfc2

Author: Shuah Khan <[email protected]>
Date:   Wed Mar 18 11:57:39 2015 -0600

selftests: Fix build failures when invoked from kselftest target

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

You cleaned two variables using different methods, any reason for that?

I asked because the 'undefine' method causes it to fail in older systems:

[acme@rhel5 linux]$ make -C tools/ clean
<SNIP>
CLEAN python
make[1]: Leaving directory `/home/acme/git/linux/tools/perf'
DESCEND testing/selftests
make[1]: Entering directory /home/acme/git/linux/tools/testing/selftests' Makefile:30: *** missing separator. Stop. make[1]: Leaving directory /home/acme/git/linux/tools/testing/selftests'
make: *** [selftests_clean] Error 2
make: Leaving directory `/home/acme/git/linux/tools'

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

[acme@rhel5 linux]$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
[acme@rhel5 linux]$

Wonder if it would be ok to use:

tools/testing/selftests/Makefile +1 -1
index 95abddcd7839..f76830643086 100644
@@ -27,7 +27,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif
 

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

- Arnaldo

#1 lore raw
Quoted 9 lines · Arnaldo Carvalho de Melo

Hi,

	In:

-------------
commit 67d8712dcc70aa16d8e14a52eb73870e3cbddfc2

Author: Shuah Khan <[email protected]>
Date:   Wed Mar 18 11:57:39 2015 -0600
Quoted 8 lines

selftests: Fix build failures when invoked from kselftest target

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

You cleaned two variables using different methods, any reason for that?

I asked because the 'undefine' method causes it to fail in older systems:

The reason for this change is some tests fail to build when invoked from the main Makefile level. The commit log explains the change:

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.

Quoted 33 lines

[acme@rhel5 linux]$ make -C tools/ clean
<SNIP>
CLEAN python
make[1]: Leaving directory `/home/acme/git/linux/tools/perf'
DESCEND testing/selftests
make[1]: Entering directory /home/acme/git/linux/tools/testing/selftests' Makefile:30: *** missing separator. Stop. make[1]: Leaving directory /home/acme/git/linux/tools/testing/selftests'
make: *** [selftests_clean] Error 2
make: Leaving directory `/home/acme/git/linux/tools'

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

[acme@rhel5 linux]$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
[acme@rhel5 linux]$

Wonder if it would be ok to use:

tools/testing/selftests/Makefile +0 -0
index 95abddcd7839..f76830643086 100644

tools/testing/selftests/Makefile TARGETS_HOTPLUG += memory-hotplug · line 32

Quoted 7 lines
tools/testing/selftests/Makefile +1 -1
@@ -27,7 +27,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif

I recall testing with override and remember it to not work. If you would like experiment with it, feel free to send a patch with that change. My make version is very new:

make --version
GNU Make 4.0
Built for x86_64-pc-linux-gnu

You have to run make kselftest from the main kernel Makefile to see the build failures that undefine LDFLAGS fixed.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#2 lore raw

Em Thu, May 14, 2015 at 09:39:43AM -0600, Shuah Khan escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 13 lines

Hi,

	In:

-------------
commit 67d8712dcc70aa16d8e14a52eb73870e3cbddfc2

Author: Shuah Khan <[email protected]>
Date:   Wed Mar 18 11:57:39 2015 -0600

selftests: Fix build failures when invoked from kselftest target

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

Quoted 7 lines
Quoted 4 lines

You cleaned two variables using different methods, any reason for that?

I asked because the 'undefine' method causes it to fail in older systems:

The reason for this change is some tests fail to build when invoked from the main Makefile level. The commit log explains the change:

I saw it

Quoted 11 lines

tools/testing/selftests/Makefile TARGETS_HOTPLUG += memory-hotplug · line 32

Quoted 9 lines

+++ b/tools/testing/selftests/Makefile

tools/testing/selftests/Makefile +1 -1
@@ -27,7 +27,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif

I recall testing with override and remember it to not work. If you would

bummer, then its not that easy, I thought it was an oversight, but if you tested it and it didn't work, nevermind, no need, I guess, to support older systems if it requires more, non trivial, work.

Quoted 21 lines

like experiment with it, feel free to send a patch with that change. My make version is very new:

make --version
GNU Make 4.0
Built for x86_64-pc-linux-gnu

You have to run make kselftest from the main kernel Makefile to see the build failures that undefine LDFLAGS fixed.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#3 lore raw
Quoted 11 lines · Arnaldo Carvalho de Melo
Quoted 10 lines

tools/testing/selftests/Makefile TARGETS_HOTPLUG += memory-hotplug · line 32

Quoted 8 lines
tools/testing/selftests/Makefile +1 -1
@@ -27,7 +27,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif

I recall testing with override and remember it to not work. If you would

Quoted 3 lines

bummer, then its not that easy, I thought it was an oversight, but if you tested it and it didn't work, nevermind, no need, I guess, to support older systems if it requires more, non trivial, work.

So what's the 'make' version cutoff for this capability?

We should not require insane hacks, the minimum required make version for the kernel, as per Documentation/Changes, is v3.80:

o GNU make 3.80 # make --version

Thanks,

Ingo

#4 lore raw

Em Thu, May 14, 2015 at 07:42:22PM +0200, Ingo Molnar escreveu:

Quoted 13 lines · Arnaldo Carvalho de Melo
Quoted 11 lines
Quoted 7 lines

tools/testing/selftests/Makefile TARGETS_HOTPLUG += memory-hotplug · line 31

Quoted 5 lines

# Makefile doesn't have explicit build rules.
ifeq (1,$(MAKELEVEL))

tools/testing/selftests/Makefile +1 -1
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =

I recall testing with override and remember it to not work. If you would

bummer, then its not that easy, I thought it was an oversight, but if you tested it and it didn't work, nevermind, no need, I guess, to support older systems if it requires more, non trivial, work.

Quoted 6 lines

So what's the 'make' version cutoff for this capability?

We should not require insane hacks, the minimum required make version for the kernel, as per Documentation/Changes, is v3.80:

o GNU make 3.80 # make --version

3.81 is what is used where I found the problem.

With his confirmation that one of the two variants that he used on the same patch to do what seemingly has the same effect for the problem at hand, the one that is supported in make 3.81 (RHEL5), all is well :-)

- Arnaldo

#5 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 37 lines · Arnaldo Carvalho de Melo

Em Thu, May 14, 2015 at 09:39:43AM -0600, Shuah Khan escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 13 lines

Hi,

	In:

-------------
commit 67d8712dcc70aa16d8e14a52eb73870e3cbddfc2

Author: Shuah Khan <[email protected]>
Date:   Wed Mar 18 11:57:39 2015 -0600

selftests: Fix build failures when invoked from kselftest target

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

Quoted 7 lines
Quoted 4 lines

You cleaned two variables using different methods, any reason for that?

I asked because the 'undefine' method causes it to fail in older systems:

The reason for this change is some tests fail to build when invoked from the main Makefile level. The commit log explains the change:

I saw it

Quoted 11 lines

Review TARGETS_HOTPLUG += memory-hotplug · line 32

Quoted 9 lines

+++ b/tools/testing/selftests/Makefile

(quoted diff) +1 -1
@@ -27,7 +27,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif

I recall testing with override and remember it to not work. If you would

Quoted 14 lines

bummer, then its not that easy, I thought it was an oversight, but if you tested it and it didn't work, nevermind, no need, I guess, to support older systems if it requires more, non trivial, work.

Quoted 10 lines

like experiment with it, feel free to send a patch with that change. My make version is very new:

make --version
GNU Make 4.0
Built for x86_64-pc-linux-gnu

You have to run make kselftest from the main kernel Makefile to see the build failures that undefine LDFLAGS fixed.

Hmm. I ran a quick test with override and it worked. My recollection must not be good. :) Here is what I tried:

(quoted diff) +0 -0

b/tools/testing/selftests/Makefile
index ebac6b8..56b11cd 100644

tools/testing/selftests/Makefile +1 -1
@@ -28,7 +28,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif
 

Could you please try this and let me know if it works and if you have time, please send me a patch as well.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#6 lore raw

Em Thu, May 14, 2015 at 12:29:37PM -0600, Shuah Khan escreveu:

Quoted 62 lines · Arnaldo Carvalho de Melo
Quoted 37 lines

Em Thu, May 14, 2015 at 09:39:43AM -0600, Shuah Khan escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 13 lines

Hi,

	In:

-------------
commit 67d8712dcc70aa16d8e14a52eb73870e3cbddfc2

Author: Shuah Khan <[email protected]>
Date:   Wed Mar 18 11:57:39 2015 -0600

selftests: Fix build failures when invoked from kselftest target

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

Quoted 7 lines
Quoted 4 lines

You cleaned two variables using different methods, any reason for that?

I asked because the 'undefine' method causes it to fail in older systems:

The reason for this change is some tests fail to build when invoked from the main Makefile level. The commit log explains the change:

I saw it

Quoted 11 lines

tools/testing/selftests/Makefile TARGETS_HOTPLUG += memory-hotplug · line 32

Quoted 9 lines

+++ b/tools/testing/selftests/Makefile

tools/testing/selftests/Makefile +1 -1
@@ -27,7 +27,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif

I recall testing with override and remember it to not work. If you would

Quoted 14 lines

bummer, then its not that easy, I thought it was an oversight, but if you tested it and it didn't work, nevermind, no need, I guess, to support older systems if it requires more, non trivial, work.

Quoted 10 lines

like experiment with it, feel free to send a patch with that change. My make version is very new:

make --version
GNU Make 4.0
Built for x86_64-pc-linux-gnu

You have to run make kselftest from the main kernel Makefile to see the build failures that undefine LDFLAGS fixed.

Hmm. I ran a quick test with override and it worked. My recollection must not be good. :) Here is what I tried:

tools/testing/selftests/Makefile +0 -0
index ebac6b8..56b11cd 100644

tools/testing/selftests/Makefile TARGETS_HOTPLUG += memory-hotplug · line 33

Quoted 7 lines
tools/testing/selftests/Makefile +1 -1
@@ -28,7 +28,7 @@ TARGETS_HOTPLUG += memory-hotplug
 # Makefile to avoid test build failures when test
 # Makefile doesn't have explicit build rules.
 ifeq (1,$(MAKELEVEL))
-undefine LDFLAGS
+override LDFLAGS =
 override MAKEFLAGS =
 endif

Yeah, that is perfect! I.e. it is the patch I had proposed :o)

Ok, will send a patch to you, works well for me for:

Red Hat Enterprise Linux 5 (Fedora Core 6 based, ides of 2.6.18 kernels)

[acme@rhel5 tools]$ make -v
GNU Make 3.81

And:

Fedora 21:

[acme@zoo tools]$ make --version
GNU Make 4.0

- Arnaldo