diff options
| author | Cody P Schafer <dev@codyps.com> | 2016-09-09 16:51:42 -0400 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2016-09-15 10:22:48 +0200 |
| commit | 3b675cb672ee7141867afa1b1137da9120fd4e12 (patch) | |
| tree | ed164b23657657f8c6ca266739ea28b2a47594c8 | |
| parent | 170b5ea29ff2a5d3dcfa285a928c12219e29d084 (diff) | |
| download | meta-openembedded-3b675cb672ee7141867afa1b1137da9120fd4e12.tar.gz | |
thrift: fix build on gcc-6
thrift build issues on gcc-6 were essentially 2 issues:
- gcc-6 has stricter overflow checking on array declaration, and
thrift was using `char` when it should have used `signed char`
- gcc-6 is really picky about it's include paths (`-I`), and thrift
had a bad habbit of passing internal ones when it was cross compiled
due to how it was using `include_directories()`
This adds 2 patches (both variations of those submitted upstream, the
ones included here are rebased onto thrift-0.9.3).
https://issues.apache.org/jira/browse/THRIFT-3831
https://issues.apache.org/jira/browse/THRIFT-3828
Signed-off-by: Cody P Schafer <dev@codyps.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
3 files changed, 152 insertions, 3 deletions
diff --git a/meta-oe/recipes-connectivity/thrift/thrift-0.9.3/0001-THRIFT-3828-In-cmake-avoid-use-of-both-quoted-paths-.patch b/meta-oe/recipes-connectivity/thrift/thrift-0.9.3/0001-THRIFT-3828-In-cmake-avoid-use-of-both-quoted-paths-.patch new file mode 100644 index 0000000000..7cc8d17393 --- /dev/null +++ b/meta-oe/recipes-connectivity/thrift/thrift-0.9.3/0001-THRIFT-3828-In-cmake-avoid-use-of-both-quoted-paths-.patch | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | From bc577820ad25795543b31f123e309cdaebc7d6c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Cody P Schafer <dev@codyps.com> | ||
| 3 | Date: Mon, 16 May 2016 15:21:10 -0400 | ||
| 4 | Subject: [PATCH 1/2] THRIFT-3828 In cmake avoid use of both quoted paths and | ||
| 5 | SYSTEM with include_directories() | ||
| 6 | |||
| 7 | This allows us to avoid issues where there are no paths to be added to | ||
| 8 | the include path (include_directories() errors when given an empty | ||
| 9 | string). | ||
| 10 | |||
| 11 | Specifically, gcc-6 requires that libraries stop passing paths like | ||
| 12 | '/usr/include' (or they will get libstdc++ build errors), so these paths | ||
| 13 | will be empty more often in the future. | ||
| 14 | --- | ||
| 15 | lib/cpp/CMakeLists.txt | 8 ++++---- | ||
| 16 | lib/cpp/test/CMakeLists.txt | 2 +- | ||
| 17 | test/cpp/CMakeLists.txt | 6 +++--- | ||
| 18 | tutorial/cpp/CMakeLists.txt | 2 +- | ||
| 19 | 4 files changed, 9 insertions(+), 9 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt | ||
| 22 | index 4c7caeb..a716ac3 100755 | ||
| 23 | --- a/lib/cpp/CMakeLists.txt | ||
| 24 | +++ b/lib/cpp/CMakeLists.txt | ||
| 25 | @@ -24,7 +24,7 @@ else() | ||
| 26 | find_package(Boost 1.53.0 REQUIRED) | ||
| 27 | endif() | ||
| 28 | |||
| 29 | -include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") | ||
| 30 | +include_directories(${Boost_INCLUDE_DIRS}) | ||
| 31 | include_directories(src) | ||
| 32 | |||
| 33 | # SYSLIBS contains libraries that need to be linked to all lib targets | ||
| 34 | @@ -104,7 +104,7 @@ if(OPENSSL_FOUND AND WITH_OPENSSL) | ||
| 35 | src/thrift/transport/TSSLSocket.cpp | ||
| 36 | src/thrift/transport/TSSLServerSocket.cpp | ||
| 37 | ) | ||
| 38 | - include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") | ||
| 39 | + include_directories(${OPENSSL_INCLUDE_DIR}) | ||
| 40 | list(APPEND SYSLIBS "${OPENSSL_LIBRARIES}") | ||
| 41 | endif() | ||
| 42 | |||
| 43 | @@ -162,7 +162,7 @@ TARGET_LINK_LIBRARIES_THRIFT(thrift ${SYSLIBS}) | ||
| 44 | |||
| 45 | if(WITH_LIBEVENT) | ||
| 46 | find_package(Libevent REQUIRED) # Libevent comes with CMake support form upstream | ||
| 47 | - include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS}) | ||
| 48 | + include_directories(${LIBEVENT_INCLUDE_DIRS}) | ||
| 49 | |||
| 50 | ADD_LIBRARY_THRIFT(thriftnb ${thriftcppnb_SOURCES}) | ||
| 51 | TARGET_LINK_LIBRARIES_THRIFT(thriftnb ${SYSLIBS} ${LIBEVENT_LIBRARIES}) | ||
| 52 | @@ -171,7 +171,7 @@ endif() | ||
| 53 | |||
| 54 | if(WITH_ZLIB) | ||
| 55 | find_package(ZLIB REQUIRED) | ||
| 56 | - include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS}) | ||
| 57 | + include_directories(${ZLIB_INCLUDE_DIRS}) | ||
| 58 | |||
| 59 | ADD_LIBRARY_THRIFT(thriftz ${thriftcppz_SOURCES}) | ||
| 60 | TARGET_LINK_LIBRARIES_THRIFT(thriftz ${SYSLIBS} ${ZLIB_LIBRARIES}) | ||
| 61 | diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt | ||
| 62 | index 5de9fc4..c956c38 100644 | ||
| 63 | --- a/lib/cpp/test/CMakeLists.txt | ||
| 64 | +++ b/lib/cpp/test/CMakeLists.txt | ||
| 65 | @@ -20,7 +20,7 @@ | ||
| 66 | # Find required packages | ||
| 67 | set(Boost_USE_STATIC_LIBS ON) # Force the use of static boost test framework | ||
| 68 | find_package(Boost 1.53.0 REQUIRED COMPONENTS chrono filesystem system thread unit_test_framework) | ||
| 69 | -include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") | ||
| 70 | +include_directories(${Boost_INCLUDE_DIRS}) | ||
| 71 | |||
| 72 | #Make sure gen-cpp files can be included | ||
| 73 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") | ||
| 74 | diff --git a/test/cpp/CMakeLists.txt b/test/cpp/CMakeLists.txt | ||
| 75 | index 2d75f2e..b1409de 100755 | ||
| 76 | --- a/test/cpp/CMakeLists.txt | ||
| 77 | +++ b/test/cpp/CMakeLists.txt | ||
| 78 | @@ -22,13 +22,13 @@ include(ThriftMacros) | ||
| 79 | |||
| 80 | set(Boost_USE_STATIC_LIBS ON) | ||
| 81 | find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options system filesystem) | ||
| 82 | -include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") | ||
| 83 | +include_directories(${Boost_INCLUDE_DIRS}) | ||
| 84 | |||
| 85 | find_package(OpenSSL REQUIRED) | ||
| 86 | -include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") | ||
| 87 | +include_directories(${OPENSSL_INCLUDE_DIR}) | ||
| 88 | |||
| 89 | find_package(Libevent REQUIRED) # Libevent comes with CMake support from upstream | ||
| 90 | -include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS}) | ||
| 91 | +include_directories(${LIBEVENT_INCLUDE_DIRS}) | ||
| 92 | |||
| 93 | #Make sure gen-cpp files can be included | ||
| 94 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") | ||
| 95 | diff --git a/tutorial/cpp/CMakeLists.txt b/tutorial/cpp/CMakeLists.txt | ||
| 96 | index 2b0c143..5ecae17 100644 | ||
| 97 | --- a/tutorial/cpp/CMakeLists.txt | ||
| 98 | +++ b/tutorial/cpp/CMakeLists.txt | ||
| 99 | @@ -18,7 +18,7 @@ | ||
| 100 | # | ||
| 101 | |||
| 102 | find_package(Boost 1.53.0 REQUIRED) | ||
| 103 | -include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") | ||
| 104 | +include_directories(${Boost_INCLUDE_DIRS}) | ||
| 105 | |||
| 106 | #Make sure gen-cpp files can be included | ||
| 107 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") | ||
| 108 | -- | ||
| 109 | 2.9.3 | ||
| 110 | |||
diff --git a/meta-oe/recipes-connectivity/thrift/thrift-0.9.3/0002-THRIFT-3831-in-test-cpp-explicitly-use-signed-char.patch b/meta-oe/recipes-connectivity/thrift/thrift-0.9.3/0002-THRIFT-3831-in-test-cpp-explicitly-use-signed-char.patch new file mode 100644 index 0000000000..f13adbb6bc --- /dev/null +++ b/meta-oe/recipes-connectivity/thrift/thrift-0.9.3/0002-THRIFT-3831-in-test-cpp-explicitly-use-signed-char.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From f6cad0580e5391c37af7f60adddb71bf1a403dc4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Cody P Schafer <dev@codyps.com> | ||
| 3 | Date: Fri, 9 Sep 2016 15:50:26 -0400 | ||
| 4 | Subject: [PATCH 2/2] THRIFT-3831 in test/cpp explicitly use `signed char` | ||
| 5 | |||
| 6 | `char`'s signed-ness is implimentation dependent, and in the case where | ||
| 7 | `char` was not signed, we previously recieved errors like | ||
| 8 | |||
| 9 | thrift/0.9.3-r0/git/test/cpp/src/TestClient.cpp:404:15: error: narrowing conversion of '-127' from 'int' to 'char' inside { } [-Wnarrowing] | ||
| 10 | |||
| 11 | (This example from gcc-6 on arm) | ||
| 12 | --- | ||
| 13 | test/cpp/src/TestClient.cpp | 4 ++-- | ||
| 14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp | ||
| 17 | index e709899..4a961f8 100644 | ||
| 18 | --- a/test/cpp/src/TestClient.cpp | ||
| 19 | +++ b/test/cpp/src/TestClient.cpp | ||
| 20 | @@ -383,7 +383,7 @@ int main(int argc, char** argv) { | ||
| 21 | * BINARY TEST | ||
| 22 | */ | ||
| 23 | printf("testBinary([-128..127]) = {"); | ||
| 24 | - const char bin_data[256] | ||
| 25 | + const signed char bin_data[256] | ||
| 26 | = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114, | ||
| 27 | -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99, | ||
| 28 | -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84, | ||
| 29 | @@ -404,7 +404,7 @@ int main(int argc, char** argv) { | ||
| 30 | 127}; | ||
| 31 | try { | ||
| 32 | string bin_result; | ||
| 33 | - testClient.testBinary(bin_result, string(bin_data, 256)); | ||
| 34 | + testClient.testBinary(bin_result, string(reinterpret_cast<const char *>(bin_data), 256)); | ||
| 35 | if (bin_result.size() != 256) { | ||
| 36 | printf("}\n*** FAILED ***\n"); | ||
| 37 | printf("invalid length: %lu\n", bin_result.size()); | ||
| 38 | -- | ||
| 39 | 2.9.3 | ||
| 40 | |||
diff --git a/meta-oe/recipes-connectivity/thrift/thrift_0.9.3.bb b/meta-oe/recipes-connectivity/thrift/thrift_0.9.3.bb index ce0b492635..fdea7f1460 100644 --- a/meta-oe/recipes-connectivity/thrift/thrift_0.9.3.bb +++ b/meta-oe/recipes-connectivity/thrift/thrift_0.9.3.bb | |||
| @@ -10,6 +10,8 @@ DEPENDS = "thrift-native boost python libevent flex-native bison-native \ | |||
| 10 | 10 | ||
| 11 | SRC_URI = "git://git-wip-us.apache.org/repos/asf/thrift.git;protocol=https \ | 11 | SRC_URI = "git://git-wip-us.apache.org/repos/asf/thrift.git;protocol=https \ |
| 12 | file://0001-Forcibly-disable-check-for-Qt5.patch \ | 12 | file://0001-Forcibly-disable-check-for-Qt5.patch \ |
| 13 | file://0001-THRIFT-3828-In-cmake-avoid-use-of-both-quoted-paths-.patch \ | ||
| 14 | file://0002-THRIFT-3831-in-test-cpp-explicitly-use-signed-char.patch \ | ||
| 13 | " | 15 | " |
| 14 | SRCREV = "61b8a29b0704ccd81b520f2300f5d1bb261fea3e" | 16 | SRCREV = "61b8a29b0704ccd81b520f2300f5d1bb261fea3e" |
| 15 | S = "${WORKDIR}/git" | 17 | S = "${WORKDIR}/git" |
| @@ -32,6 +34,3 @@ EXTRA_OECMAKE_class-nativesdk = "-DWITH_QT4=OFF -DWITH_QT5=OFF \ | |||
| 32 | do_install_append () { | 34 | do_install_append () { |
| 33 | ln -sf thrift ${D}/${bindir}/thrift-compiler | 35 | ln -sf thrift ${D}/${bindir}/thrift-compiler |
| 34 | } | 36 | } |
| 35 | |||
| 36 | # http://errors.yoctoproject.org/Errors/Details/68622/ | ||
| 37 | PNBLACKLIST[thrift] ?= "BROKEN: fails to build with gcc-6" | ||
