Skip to contentSkip to conversation

9da0763 "kbuild: Use relative path ..." Broke my IDE

PATCH In review Boaz Harrosh 4 participants 8 messages Jun 18, 2014 – Jun 19, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Sir Michal

Below patch broke my stupid yet useful IDE tool. I use kdevelop.

kdevelop now gets confused on warnings and errors because it now comes out
as (for example):
../fs/ext4/fsync.c:63:3: error: implicit declaration of function ‘iputddd’ [-Werror=implicit-function-declaration]

Quoted 1 line

From what I understand kdevelop picks up the "[make] cd ..." outputs from make and

will interpret those for finding gcc files output. But Linux Makefile will suppress these messages and kdevelop as no way to interpret the "../xxxx"

I do not know what other IDEs do, but this one here is not smart enough.

Could we please define a new input to Makefile that will revert to old behavior. like:
KBUILD_FULL_PATH

let me cook up a patch tomorrow (getting late here) Thanks
Boaz

The patch that broke it
----

Quoted 1 line

From 9da0763bdd82572be243fcf5161734f11568960f Mon Sep 17 00:00:00 2001

From: Michal Marek <[email protected]>
Date: Fri, 25 Apr 2014 23:25:18 +0200
Subject: [PATCH] kbuild: Use relative path when building in a subdir of the
source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

---
 Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Makefile +11 -1
index 3e134ec..f4702c1 100644
@@ -149,7 +149,17 @@ else
 _all: modules
 endif
 
-srctree		:= $(if $(KBUILD_SRC),$(KBUILD_SRC),.)
+ifeq ($(KBUILD_SRC),)
+        # building in the source tree
+        srctree := .
+else
+        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+                # building in a subdirectory of the source tree
+                srctree := ..
+        else
+                srctree := $(KBUILD_SRC)
+        endif
+endif
 objtree		:= .
 src		:= $(srctree)
 obj		:= $(objtree)
Signature · 1 line
1.9.3
#1 lore raw
Quoted 18 lines · Boaz Harrosh

Hi Sir Michal

Below patch broke my stupid yet useful IDE tool. I use kdevelop.

kdevelop now gets confused on warnings and errors because it now comes out
as (for example):
../fs/ext4/fsync.c:63:3: error: implicit declaration of function ‘iputddd’ [-Werror=implicit-function-declaration]

From what I understand kdevelop picks up the "[make] cd ..." outputs from make and will interpret those for finding gcc files output. But Linux Makefile will suppress these messages and kdevelop as no way to interpret the "../xxxx"

I do not know what other IDEs do, but this one here is not smart enough.

Could we please define a new input to Makefile that will revert to old behavior. like:
KBUILD_FULL_PATH

Quoted 5 lines

let me cook up a patch tomorrow (getting late here) Thanks
Boaz

The patch that broke it

Boaz, thanks for the bisect.
reverting it also helps to solve 'make deb-pkg' problem I reported in the other thread.

Quoted 48 lines

----
From 9da0763bdd82572be243fcf5161734f11568960f Mon Sep 17 00:00:00 2001
From: Michal Marek <[email protected]>
Date: Fri, 25 Apr 2014 23:25:18 +0200
Subject: [PATCH] kbuild: Use relative path when building in a subdir of the
source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

---
 Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Makefile +11 -2
index 3e134ec..f4702c1 100644
@@ -149,7 +149,17 @@ else
 _all: modules
 endif
 
-srctree                := $(if $(KBUILD_SRC),$(KBUILD_SRC),.)
+ifeq ($(KBUILD_SRC),)
+        # building in the source tree
+        srctree := .
+else
+        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+                # building in a subdirectory of the source tree
+                srctree := ..
+        else
+                srctree := $(KBUILD_SRC)
+        endif
+endif
 objtree                := .
 src            := $(srctree)
 obj            := $(objtree)
--

1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw

kbuild: support of new KBUILD_FULL_PATH

In reply to Boaz Harrosh

The commit:

commit 9da0763bdd82572be243fcf5161734f11568960f
Author: Michal Marek <[email protected]>
Date: Fri Apr 25 23:25:18 2014 +0200

kbuild: Use relative path when building in a subdir of the source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

Broke IDEs and other tools which analyze the make output. Introduce a new KBUILD_FULL_PATH switch to Makefile that will revert to the old output if KBUILD_FULL_PATH=1 is specified.
The default is KBUILD_FULL_PATH=0

Is there a document I need to edit for this new parameter?

---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Makefile +7 -1
index 97b2861..778732a 100644
@@ -149,11 +149,17 @@ else
 _all: modules
 endif
 
+# put KBUILD_FULL_PATH=1 if relative path to sources breaks your system
+ifneq ($(KBUILD_FULL_PATH), 1)
+	KBUILD_FULL_PATH=""
+endif
+
 ifeq ($(KBUILD_SRC),)
         # building in the source tree
         srctree := .
 else
-        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+        # if KBUILD_FULL_PATH is not empty then condition will fail
+        ifeq ($(KBUILD_FULL_PATH)$(KBUILD_SRC)/,$(dir $(CURDIR)))
                 # building in a subdirectory of the source tree
                 srctree := ..
         else
Signature · 1 line
1.9.3
#3 lore raw

Re: kbuild: support of new KBUILD_FULL_PATH

Quoted 13 lines · Boaz Harrosh

The commit:

commit 9da0763bdd82572be243fcf5161734f11568960f
Author: Michal Marek <[email protected]>
Date: Fri Apr 25 23:25:18 2014 +0200

kbuild: Use relative path when building in a subdir of the source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

Quoted 7 lines

Broke IDEs and other tools which analyze the make output. Introduce a new KBUILD_FULL_PATH switch to Makefile that will revert to the old output if KBUILD_FULL_PATH=1 is specified.
The default is KBUILD_FULL_PATH=0

Parsing make output is a use case I did not think of, so the knob seems inevitable :-/.

Quoted 1 line

Is there a document I need to edit for this new parameter?

That would be Documentation/kbuild/kbuild.txt

Quoted 15 lines
---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Makefile +2 -0
index 97b2861..778732a 100644
@@ -149,11 +149,17 @@ else
 _all: modules
 endif
 
+# put KBUILD_FULL_PATH=1 if relative path to sources breaks your system
+ifneq ($(KBUILD_FULL_PATH), 1)

Makefile else · line 162

Quoted 10 lines
Makefile +5 -1
+	KBUILD_FULL_PATH=""
+endif
+
 ifeq ($(KBUILD_SRC),)
         # building in the source tree
         srctree := .
 else
-        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+        # if KBUILD_FULL_PATH is not empty then condition will fail
+        ifeq ($(KBUILD_FULL_PATH)$(KBUILD_SRC)/,$(dir $(CURDIR)))

This is an ugly way to express the logic.

Makefile else · line 165

Quoted 3 lines
Makefile +0 -0
                 # building in a subdirectory of the source tree
                 srctree := ..
         else

How about generated sources like asm-offsets.s or the lexer and parser in scripts/kconfig, does kdevelop figure out where the files live? If not, you might need to add

-objtree := .
+ifeq ($(KBUILD_FULL_PATH),1)
+ objtree := $(CURDIR)
+else
+ objtree := .
+endif

to use the full path also for the O= directory.

Michal

#4 lore raw

Re: kbuild: support of new KBUILD_FULL_PATH

On 06/19/2014 01:41 PM, Michal Marek wrote:
<>

Quoted 4 lines
Quoted 1 line

Is there a document I need to edit for this new parameter?

That would be Documentation/kbuild/kbuild.txt

Will send a VER2 thanks

Quoted 14 lines
Quoted 14 lines
---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Makefile +0 -0
index 97b2861..778732a 100644
@@ -149,11 +149,17 @@ else
 _all: modules
 endif
 
Quoted 15 lines

Makefile else · line 162

Quoted 12 lines
Makefile +7 -1
+# put KBUILD_FULL_PATH=1 if relative path to sources breaks your system
+ifneq ($(KBUILD_FULL_PATH), 1)
+	KBUILD_FULL_PATH=""
+endif
+
 ifeq ($(KBUILD_SRC),)
         # building in the source tree
         srctree := .
 else
-        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+        # if KBUILD_FULL_PATH is not empty then condition will fail
+        ifeq ($(KBUILD_FULL_PATH)$(KBUILD_SRC)/,$(dir $(CURDIR)))

This is an ugly way to express the logic.

I kind of agree. My Makefile foo is not very strong any other way I know would duplicate code. What would you suggest?

[ Best I can think of is:

        srctree := $(KBUILD_SRC)

        # if KBUILD_FULL_PATH=1 then do not use relative path
	ifneq ($(KBUILD_FULL_PATH), 1)
                ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
                        # building in a subdirectory of the source tree
                        srctree := ..
                endif
        endif

Is this better?
]

Quoted 16 lines

Makefile else · line 165

Quoted 4 lines
Makefile +0 -0
                 # building in a subdirectory of the source tree
                 srctree := ..
         else

How about generated sources like asm-offsets.s or the lexer and parser in scripts/kconfig, does kdevelop figure out where the files live? If not, you might need to add

(quoted diff) +5 -1
-objtree                := .
+ifeq ($(KBUILD_FULL_PATH),1)
+       objtree := $(CURDIR)
+else
+        objtree        := .
+endif
Quoted 2 lines

to use the full path also for the O= directory.

I would not care for those at all. The important is those files that you need to point and edit to fix stuff. The generated files I better not edit usually. The edit is in some other place, right?

Quoted 2 lines

Michal

I saw that this patch caused other breakage as well. Will you be fixing those? Do you want to own this or you still need a ver2 of this patch?

Thanks
Boaz

#5 lore raw

Re: kbuild: support of new KBUILD_FULL_PATH

Dne 19.6.2014 14:01, Boaz Harrosh napsal(a):

Quoted 25 lines · Michal Marek
Quoted 7 lines

Makefile else · line 162

Quoted 4 lines
Makefile +2 -1
-        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+        # if KBUILD_FULL_PATH is not empty then condition will fail
+        ifeq ($(KBUILD_FULL_PATH)$(KBUILD_SRC)/,$(dir $(CURDIR)))

This is an ugly way to express the logic.

I kind of agree. My Makefile foo is not very strong any other way I know would duplicate code. What would you suggest?

[ Best I can think of is:

        srctree := $(KBUILD_SRC)

        # if KBUILD_FULL_PATH=1 then do not use relative path
	ifneq ($(KBUILD_FULL_PATH), 1)
                ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
                        # building in a subdirectory of the source tree
                        srctree := ..
                endif
        endif
Quoted 1 line

Is this better?

Definitely.

Quoted 11 lines
Quoted 11 lines

How about generated sources like asm-offsets.s or the lexer and parser in scripts/kconfig, does kdevelop figure out where the files live? If not, you might need to add

(quoted diff) +5 -1
-objtree                := .
+ifeq ($(KBUILD_FULL_PATH),1)
+       objtree := $(CURDIR)
+else
+        objtree        := .
+endif
Quoted 6 lines
Quoted 2 lines

to use the full path also for the O= directory.

I would not care for those at all. The important is those files that you need to point and edit to fix stuff. The generated files I better not edit usually. The edit is in some other place, right?

Fair enough.

Quoted 3 lines

I saw that this patch caused other breakage as well. Will you be fixing those? Do you want to own this or you still need a ver2 of this patch?

I already sent three fixes to Linus:
https://lkml.org/lkml/2014/6/18/664. There is one more brekage that Alexei is seeing with deb-pkg, but this needs further investigation. Anyway, either send a v2 or tell me and I will fold the above change to the first version of your patch.

Michal

#6 lore raw

PATCH 1/1 kbuild: support of new KBUILD_FULL_PATH

The commit 9da0763bdd82572be243fcf5161734f11568960f

kbuild: Use relative path when building in a subdir of the source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

Broke IDEs and other tools which analyze the make output. Introduce a new KBUILD_FULL_PATH switch to Makefile that will revert to the old output if KBUILD_FULL_PATH=1 is specified.
The default is KBUILD_FULL_PATH=0

---
 Documentation/kbuild/kbuild.txt |  9 +++++++++
 Makefile                        | 13 ++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
Documentation/kbuild/kbuild.txt +9 -0
index 6466704..9133b47 100644
@@ -77,6 +77,15 @@ Specify the output directory when building the kernel.
 The output directory can also be specified using "O=...".
 Setting "O=..." takes precedence over KBUILD_OUTPUT.
 
+KBUILD_FULL_PATH
+--------------------------------------------------
+Since Linux v3.16-rc1 the Kernel build system prefers to use
+relative paths when supplying file-paths to gcc and other
+tools. This will break IDEs and other environments that would
+parse the gcc output to find files and lines.
+Use KBUILD_FULL_PATH=1 on make command line to revert to old
+way of feeding tools with full-paths.
+
 KBUILD_DEBARCH
 --------------------------------------------------
 For the deb-pkg target, allows overriding the normal heuristics deployed by
Makefile +8 -5
index 97b2861..51fcebd 100644
@@ -153,11 +153,14 @@ ifeq ($(KBUILD_SRC),)
         # building in the source tree
         srctree := .
 else
-        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
-                # building in a subdirectory of the source tree
-                srctree := ..
-        else
-                srctree := $(KBUILD_SRC)
+        srctree := $(KBUILD_SRC)
+
+        # if KBUILD_FULL_PATH=1 then do not use relative path
+	ifneq ($(KBUILD_FULL_PATH), 1)
+                ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+                        # building in a subdirectory of the source tree
+                        srctree := ..
+                endif
         endif
 endif
 objtree		:= .
Signature · 1 line
1.9.3
#7 lore raw

Re: [PATCH] kbuild: support of new KBUILD_FULL_PATH

Quoted 12 lines · Boaz Harrosh

The commit 9da0763bdd82572be243fcf5161734f11568960f

kbuild: Use relative path when building in a subdir of the source tree

When doing make O=<subdir>, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter.

Quoted 6 lines

Broke IDEs and other tools which analyze the make output. Introduce a new KBUILD_FULL_PATH switch to Makefile that will revert to the old output if KBUILD_FULL_PATH=1 is specified.
The default is KBUILD_FULL_PATH=0

Thanks Sir Michal

Please feel free to check out my broken grammar and change what you see fit.

BTW: The old system was sensitive to absolute paths so if I compile on local machine say at:

	/home/boaz/dev/lin/

but then go to a network station and do "make install" in:
/mnt/boaz/home/boaz/dev/lin/

The build would attempt to rebuild everything what I do is cd /net/boaz/home/boaz/dev on local and remote so the make just works. Your patch actually fixed that ;-)

Thanks
Boaz

Quoted 50 lines
---
 Documentation/kbuild/kbuild.txt |  9 +++++++++
 Makefile                        | 13 ++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
Documentation/kbuild/kbuild.txt +9 -0
index 6466704..9133b47 100644
@@ -77,6 +77,15 @@ Specify the output directory when building the kernel.
 The output directory can also be specified using "O=...".
 Setting "O=..." takes precedence over KBUILD_OUTPUT.
 
+KBUILD_FULL_PATH
+--------------------------------------------------
+Since Linux v3.16-rc1 the Kernel build system prefers to use
+relative paths when supplying file-paths to gcc and other
+tools. This will break IDEs and other environments that would
+parse the gcc output to find files and lines.
+Use KBUILD_FULL_PATH=1 on make command line to revert to old
+way of feeding tools with full-paths.
+
 KBUILD_DEBARCH
 --------------------------------------------------
 For the deb-pkg target, allows overriding the normal heuristics deployed by
Makefile +8 -5
index 97b2861..51fcebd 100644
@@ -153,11 +153,14 @@ ifeq ($(KBUILD_SRC),)
         # building in the source tree
         srctree := .
 else
-        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
-                # building in a subdirectory of the source tree
-                srctree := ..
-        else
-                srctree := $(KBUILD_SRC)
+        srctree := $(KBUILD_SRC)
+
+        # if KBUILD_FULL_PATH=1 then do not use relative path
+	ifneq ($(KBUILD_FULL_PATH), 1)
+                ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
+                        # building in a subdirectory of the source tree
+                        srctree := ..
+                endif
         endif
 endif
 objtree		:= .