Skip to contentSkip to conversation

kdbus/samples: skip on CROSS_COMPILE

PATCH In review David Herrmann 4 participants 5 messages Jul 30, 2015 – Jul 31, 2015 ABI/API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kdbus/samples: skip on CROSS_COMPILE

Apparently we cannot rely on up-to-date kernel headers to be available when cross-compiling, not even for HOSTCC. That's sad, but it's how it is. Skip samples on cross-compiles as suggested by Paul, so allmodconfig runs smoothly again.

---
 samples/kdbus/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
samples/kdbus/Makefile +4 -0
index 137f842..dbd9de8 100644
@@ -1,9 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef CROSS_COMPILE
+
 hostprogs-$(CONFIG_SAMPLE_KDBUS) += kdbus-workers
 
 always := $(hostprogs-y)
 
 HOSTCFLAGS_kdbus-workers.o += -I$(objtree)/usr/include
 HOSTLOADLIBES_kdbus-workers := -lrt
+
+endif
Signature · 1 line
2.5.0
#1 lore raw
Quoted 16 lines · David Herrmann

Apparently we cannot rely on up-to-date kernel headers to be available when cross-compiling, not even for HOSTCC. That's sad, but it's how it is. Skip samples on cross-compiles as suggested by Paul, so allmodconfig runs smoothly again.

---
 samples/kdbus/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
samples/kdbus/Makefile +0 -0
index 137f842..dbd9de8 100644

samples/kdbus/Makefile line 4

Quoted 4 lines
samples/kdbus/Makefile +1 -0
@@ -1,9 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef CROSS_COMPILE

This really feels like the wrong solution.

samples/kdbus/Makefile line 13

Quoted 9 lines
samples/kdbus/Makefile +3 -0
+
 hostprogs-$(CONFIG_SAMPLE_KDBUS) += kdbus-workers
 
 always := $(hostprogs-y)
 
 HOSTCFLAGS_kdbus-workers.o += -I$(objtree)/usr/include
 HOSTLOADLIBES_kdbus-workers := -lrt
+
+endif

Shuah, how should we fix this "properly"? How is this resolved for the kernel test scripts, it should have the same issue that the samples do.

thanks,

greg k-h

#2 lore raw

Hi

Quoted 29 lines · Greg Kroah-Hartman
Quoted 16 lines · David Herrmann

Apparently we cannot rely on up-to-date kernel headers to be available when cross-compiling, not even for HOSTCC. That's sad, but it's how it is. Skip samples on cross-compiles as suggested by Paul, so allmodconfig runs smoothly again.

---
 samples/kdbus/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
samples/kdbus/Makefile +0 -0
index 137f842..dbd9de8 100644

samples/kdbus/Makefile line 4

Quoted 4 lines
samples/kdbus/Makefile +1 -0
@@ -1,9 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef CROSS_COMPILE

This really feels like the wrong solution.

Quoted 5 lines
samples/kdbus/Makefile +1 -0
+
 hostprogs-$(CONFIG_SAMPLE_KDBUS) += kdbus-workers
 
 always := $(hostprogs-y)
 
Quoted 7 lines

samples/kdbus/Makefile line 13

Quoted 4 lines
samples/kdbus/Makefile +2 -0
 HOSTCFLAGS_kdbus-workers.o += -I$(objtree)/usr/include
 HOSTLOADLIBES_kdbus-workers := -lrt
+
+endif

Shuah, how should we fix this "properly"? How is this resolved for the kernel test scripts, it should have the same issue that the samples do.

./samples/ is built as part of "make vmlinux", tests are not. Therefore, tests don't break allmodconfig and friends. The underlying issue is, that ./samples/ provides both: examples for kernel modules *and* examples for user-space code.

Maybe the real fix is to eventually split user-space examples from kernel-module-examples (./samples/kernel/ and ./samples/user/). But I don't want to include such split in the kdbus tree. Instead, I tried to follow the recent fixes that are already upstream: 65f6f092a6987, f59514b6a8c5ca6dd, and 6a407a81a9abcf.

Suggestions welcome!

Thanks
David

#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 29 lines · [Re: [PATCH] kdbus/samples: skip on CROSS_COMPILE] On 30/07/2015 (Thu 09:33)…
Quoted 16 lines · David Herrmann

Apparently we cannot rely on up-to-date kernel headers to be available when cross-compiling, not even for HOSTCC. That's sad, but it's how it is. Skip samples on cross-compiles as suggested by Paul, so allmodconfig runs smoothly again.

---
 samples/kdbus/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
samples/kdbus/Makefile +0 -0
index 137f842..dbd9de8 100644

samples/kdbus/Makefile line 4

Quoted 4 lines
samples/kdbus/Makefile +1 -0
@@ -1,9 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef CROSS_COMPILE

This really feels like the wrong solution.

Quoted 5 lines
samples/kdbus/Makefile +1 -0
+
 hostprogs-$(CONFIG_SAMPLE_KDBUS) += kdbus-workers
 
 always := $(hostprogs-y)
 
Quoted 7 lines

samples/kdbus/Makefile line 13

Quoted 4 lines
samples/kdbus/Makefile +2 -0
 HOSTCFLAGS_kdbus-workers.o += -I$(objtree)/usr/include
 HOSTLOADLIBES_kdbus-workers := -lrt
+
+endif

Shuah, how should we fix this "properly"? How is this resolved for the kernel test scripts, it should have the same issue that the samples do.

If you guys want to reproduce it, in order to figure out what mips does with its headers that no other arch does, it should be as simple as:

wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/x86_64-gcc-4.6.3-nolibc_mips-linux.tar.xz

<untar somewhere>
<add resulting bin dir to your $PATH>

export CROSS_COMPILE=mips-linux-
export ARCH=mips

cd kernel-source
make allmodconfig
make -j16 samples/

Paul.
--

Quoted 4 lines

thanks,

greg k-h

#4 lore raw
In reply to Greg Kroah-Hartman
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · David Herrmann

Apparently we cannot rely on up-to-date kernel headers to be available when cross-compiling, not even for HOSTCC. That's sad, but it's how it is. Skip samples on cross-compiles as suggested by Paul, so allmodconfig runs smoothly again.

---
 samples/kdbus/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
samples/kdbus/Makefile +0 -0
index 137f842..dbd9de8 100644
@@ -1,9 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
Quoted 3 lines

samples/kdbus/Makefile line 4

Quoted 1 line
samples/kdbus/Makefile +1 -0
+ifndef CROSS_COMPILE

This really feels like the wrong solution.

I also faced the same problem while testing allmodconfig for mn10300.

regards
sudip