openocd: avoid documentation rebuild to fix build issues
[buildroot-gz.git] / package / ola / 0002-Remove-replacing-I-with-isystem.patch
blob010c99a3bc147fd3c739d3e221d13d28cd99f18f
1 From bbb03794def326c2e8ad2de523c5a61a4c8cb464 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
3 Date: Thu, 22 Sep 2016 00:58:58 +0200
4 Subject: [PATCH] Remove replacing -I with -isystem
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Building OLA with a GCC 6 cross-toolchain fails:
11 ```
12 /usr/bin/arm-linux-g++ -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE
13 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I./include -I./include
14 -Wall -Wformat -W -isystem
15 /usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include -pthread
16 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os
17 -pthread -c -o libs/acn/e131_transmit_test.o
18 libs/acn/e131_transmit_test.cpp
19 /usr/bin/arm-linux-g++ -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE
20 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I./include -I./include
21 -Wall -Wformat -W -isystem
22 /usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include -pthread
23 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os
24 -pthread -c -o libs/acn/E131TestFramework.o
25 libs/acn/E131TestFramework.cpp
26 In file included from
27 /opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/6.1.0/ext/string_conversions.h:41:0,
28 from
29 /opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/6.1.0/bits/basic_string.h:5402,
30 from
31 /opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/6.1.0/string:52,
32 from ./tools/ola_trigger/config.ypp:2:
33 /opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/6.1.0/cstdlib:75:25:
34 fatal error: stdlib.h: No such file or directory
35 #include_next <stdlib.h>
37 compilation terminated.
38 ```
40 The C++ library in GCC 6 now provides its own `<stdlib.h>` header that
41 wraps the C library header of the same name, so in `<cstdlib>` the
42 header include
44 ```
45 #include <stdlib.h>
46 ```
48 has become
50 ```
51 #include_next <stdlib.h>
52 ```
54 `#include_next` is sensitive to the order of directories in the
55 preprocessor's search path, so if that order is changed with `-isystem`
56 then the compiler can't find the right header:
58 ```
59 [1] /usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include
60 [2] /opt/ext-toolchain/arm-buildroot-linux-gnueabihf/include/c++/6.1.0
61 [..]
62 End of search list.
63 ```
65 `<cstdlib>` is located in [2] whereas `<stdlib.h>` (C library header) is
66 in [1]. In this case, the `#include_next <stdlib.h>` statement in
67 `<cstdlib>`, located in [2], is evaluated **after** the search path [1],
68 so the compiler does not find the right system header.
70 The problem is that the OLA build system replaces the `-I` in the CFLAGS
71 from libprotobuf with `-isystem` to fix some warnings treated as errors
72 in the libprotobuf header files.
74 `-isystem` should be used to suppress warnings in system headers only
75 and the libprotobuf header files are not system files.
77 The correct fix is to compile with less restrictions and remove
78 `-Werror` for the build.
80 As using `-isystem` is reordering GCCs search path and using `-isystem`
81 is really not necessary, remove the faulty replacement of `-I`.
83 Upstream status: https://github.com/OpenLightingProject/ola/pull/1126
85 Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
86 ---
87 config/ola.m4 | 3 ---
88 1 file changed, 3 deletions(-)
90 diff --git a/config/ola.m4 b/config/ola.m4
91 index 2796cfb..d3b8cc8 100644
92 --- a/config/ola.m4
93 +++ b/config/ola.m4
94 @@ -24,9 +24,6 @@ AC_DEFUN([PROTOBUF_SUPPORT],
95 AC_REQUIRE_CPP()
96 PKG_CHECK_MODULES(libprotobuf, [protobuf >= $1])
98 -# We want to replace -I with -isystem here to disable errors in the .h files
99 -# See https://groups.google.com/forum/#!topic/open-lighting/39Mj0KXlCIk
100 -libprotobuf_CFLAGS=`echo $libprotobuf_CFLAGS | sed 's/-I/-isystem /'`
101 AC_SUBST([libprotobuf_CFLAGS])
103 AC_ARG_WITH([protoc],
105 2.10.0