* [B.A.T.M.A.N.] [PATCH maint] batman-adv: Only use compat.h for kernel builds
@ 2018-02-26 12:51 Sven Eckelmann
2018-02-26 16:35 ` Simon Wunderlich
0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2018-02-26 12:51 UTC (permalink / raw)
To: b.a.t.m.a.n
The compat.h will be included by default via the -include gcc parameter.
This is done by appending the incude information to NOSTDINC_FLAGS in the
Makefile. But Debian decided [1] that this NOSTDINC_FLAGS must also be used
when not compiling kernel sources. This for example happens when the
gcc-version.sh script is executed. This results in error messages like
In file included from <command-line>:0:0:
/usr/src//batman-adv/build/../compat.h:25:52: fatal error: linux/version.h: No such file or directory
#include <linux/version.h> /* LINUX_VERSION_CODE */
^
compilation terminated.
In file included from <command-line>:0:0:
/usr/src//batman-adv/build/../compat.h:25:52: fatal error: linux/version.h: No such file or directory
#include <linux/version.h> /* LINUX_VERSION_CODE */
^
compilation terminated.
/usr/src/linux-headers-4.14.0-0.bpo.3-common/scripts/gcc-version.sh: line 32: printf: #: invalid number
/usr/src/linux-headers-4.14.0-0.bpo.3-common/scripts/gcc-version.sh: line 32: printf: #: invalid number
/bin/sh: 1: [: 0001: unexpected operator
This can be avoided by disabling the compat.h whenever the preprocessor
define __KERNEL__ is not set.
[1] https://patchwork.kernel.org/patch/5238591/
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
compat.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/compat.h b/compat.h
index c10ad589..759829f9 100644
--- a/compat.h
+++ b/compat.h
@@ -21,6 +21,8 @@
#ifndef _NET_BATMAN_ADV_COMPAT_H_
#define _NET_BATMAN_ADV_COMPAT_H_
+#ifdef __KERNEL__
+
#include <linux/version.h> /* LINUX_VERSION_CODE */
#include <linux/kconfig.h>
#include <generated/autoconf.h>
@@ -159,4 +161,6 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
#endif /* < KERNEL_VERSION(4, 15, 0) */
+#endif /* __KERNEL__ */
+
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: Only use compat.h for kernel builds
2018-02-26 12:51 [B.A.T.M.A.N.] [PATCH maint] batman-adv: Only use compat.h for kernel builds Sven Eckelmann
@ 2018-02-26 16:35 ` Simon Wunderlich
0 siblings, 0 replies; 2+ messages in thread
From: Simon Wunderlich @ 2018-02-26 16:35 UTC (permalink / raw)
To: b.a.t.m.a.n
[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]
On Monday, February 26, 2018 1:51:32 PM CET Sven Eckelmann wrote:
> The compat.h will be included by default via the -include gcc parameter.
> This is done by appending the incude information to NOSTDINC_FLAGS in the
> Makefile. But Debian decided [1] that this NOSTDINC_FLAGS must also be used
> when not compiling kernel sources. This for example happens when the
> gcc-version.sh script is executed. This results in error messages like
>
> In file included from <command-line>:0:0:
> /usr/src//batman-adv/build/../compat.h:25:52: fatal error:
> linux/version.h: No such file or directory #include <linux/version.h> /*
> LINUX_VERSION_CODE */
> ^
> compilation terminated.
> In file included from <command-line>:0:0:
> /usr/src//batman-adv/build/../compat.h:25:52: fatal error:
> linux/version.h: No such file or directory #include <linux/version.h> /*
> LINUX_VERSION_CODE */
> ^
> compilation terminated.
> /usr/src/linux-headers-4.14.0-0.bpo.3-common/scripts/gcc-version.sh: line
> 32: printf: #: invalid number
> /usr/src/linux-headers-4.14.0-0.bpo.3-common/scripts/gcc-version.sh: line
> 32: printf: #: invalid number /bin/sh: 1: [: 0001: unexpected operator
>
> This can be avoided by disabling the compat.h whenever the preprocessor
> define __KERNEL__ is not set.
>
> [1] https://patchwork.kernel.org/patch/5238591/
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Applied in 934b3884.
Thank you!
Simon
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-26 16:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 12:51 [B.A.T.M.A.N.] [PATCH maint] batman-adv: Only use compat.h for kernel builds Sven Eckelmann
2018-02-26 16:35 ` Simon Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).