package/libabseil-cpp new package
PATCH 1/2 package/libabseil-cpp new package
From: Adam Duskett <[email protected]>
This package is a new dependency on grpc versions > 1.25.0
--- DEVELOPERS | 1 + package/Config.in | 1 + .../libabseil-cpp/0001-Add-fPIC-option.patch | 36 +++++++++++++++++++ package/libabseil-cpp/Config.in | 15 ++++++++ package/libabseil-cpp/libabseil-cpp.hash | 3 ++ package/libabseil-cpp/libabseil-cpp.mk | 24 +++++++++++++ 6 files changed, 80 insertions(+) create mode 100644 package/libabseil-cpp/0001-Add-fPIC-option.patch create mode 100644 package/libabseil-cpp/Config.in create mode 100644 package/libabseil-cpp/libabseil-cpp.hash create mode 100644 package/libabseil-cpp/libabseil-cpp.mk
DEVELOPERS +1 -0
@@ -43,6 +43,7 @@ F: package/gstreamer1/gst1-vaapi/ F: package/imx-usb-loader/ F: package/janus-gateway/ F: package/json-for-modern-cpp/ +F: package/libabseil-cpp/ F: package/libcpprestsdk/ F: package/libcutl/ F: package/libodb/
package/Config.in +1 -0
@@ -1823,6 +1823,7 @@ menu "Other" source "package/gtest/Config.in" source "package/jemalloc/Config.in" source "package/lapack/Config.in" + source "package/libabseil-cpp/Config.in" source "package/libargtable2/Config.in" source "package/libatomic_ops/Config.in" source "package/libavl/Config.in"
package/libabseil-cpp/0001-Add-fPIC-option.patch new file +36 -0
@@ -0,0 +1,36 @@ +From d7160d647c8f8847f3ea8d7b0eb222936962c1af Mon Sep 17 00:00:00 2001 +From: Sinan Kaya <[email protected]> +Date: Tue, 11 Feb 2020 11:58:02 -0500 +Subject: [PATCH] Add fPIC option + +Without this option, programs building for arm64 or x86-64 will fail when +attempting to link to the built libraries with the following (abbreviated) +error: + +"relocation against `.rodata' can not be used when making a shared object; +recompile with -fPIC + +Force fPIC to resolve this issue. + +Signed-off-by: Adam Duskett <[email protected]> +Signed-off-by: Sinan Kaya <[email protected]> +--- + CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74a3a4c..4f837b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,6 +79,8 @@ option(ABSL_USE_GOOGLETEST_HEAD + + option(ABSL_RUN_TESTS "If ON, Abseil tests will be run." OFF) + ++add_compile_options(-fPIC) ++ + if(${ABSL_RUN_TESTS}) + # enable CTest. This will set BUILD_TESTING to ON unless otherwise specified + # on the command line +-- +2.20.1.windows.1 +
package/libabseil-cpp/Config.in new file +15 -0
@@ -0,0 +1,15 @@ +config BR2_PACKAGE_LIBABSEIL_CPP + bool "libabseil-cpp" + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_TOOLCHAIN_HAS_THREADS + help + Abseil is an open-source collection of C++ library code + designed to augment the C++ standard library. The Abseil + library code is collected from Google's own C++ code base, has + been extensively tested and used in production, and is the + same code we depend on in our daily coding lives. + + https://github.com/abseil/abseil-cpp + +comment "grpc needs a toolchain w/ C++, threads" + depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
package/libabseil-cpp/libabseil-cpp.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed +sha256 728a813291bdec2aa46eab8356ace9f75ac2ed9dfe2df5ab603c4e6c09f1c353 libabseil-cpp-20200225.tar.gz +sha256 c79a7fea0e3cac04cd43f20e7b648e5a0ff8fa5344e644b0ee09ca1162b62747 LICENSE
package/libabseil-cpp/libabseil-cpp.mk new file +24 -0
@@ -0,0 +1,24 @@ +################################################################################ +# +# libabseil-cpp +# +################################################################################ + +LIBABSEIL_CPP_VERSION = 20200225 +LIBABSEIL_CPP_SITE = $(call github,abseil,abseil-cpp,$(LIBABSEIL_CPP_VERSION)) +LIBABSEIL_CPP_LICENSE = Apache-2.0 +LIBABSEIL_CPP_LICENSE_FILES = LICENSE +LIBABSEIL_CPP_INSTALL_STAGING = YES + +LIBABSEIL_CPP_CONF_OPTS = \ + -DABSL_ENABLE_INSTALL=ON \ + -DABSL_USE_GOOGLETEST_HEAD=OFF \ + -DABSL_RUN_TESTS=OFF + +HOST_LIBABSEIL_CPP_CONF_OPTS = \ + -DABSL_ENABLE_INSTALL=ON \ + -DABSL_USE_GOOGLETEST_HEAD=OFF \ + -DABSL_RUN_TESTS=OFF + +$(eval $(cmake-package)) +$(eval $(host-cmake-package))
Signature · 1 line
2.26.2
PATCH 2/2 package/grpc: bump version to 1.30.2
From: Adam Duskett <[email protected]>
Other changes:
- Add a dependency on libabseil-cpp
- Update the patches to apply properly.
--- .../0001-target-build-using-host-plugin.patch | 16 ++++++++-------- ...ct-the-availability-of-pthread_setname_.patch | 16 ++++++++-------- package/grpc/Config.in | 1 + package/grpc/grpc.hash | 4 ++-- package/grpc/grpc.mk | 11 +++++++---- 5 files changed, 26 insertions(+), 22 deletions(-)
package/grpc/0001-target-build-using-host-plugin.patch +8 -8
@@ -17,12 +17,12 @@ Signed-off-by: Robert Rose <[email protected]> 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt -index fc76cf5..7a22b08 100644 +index be695c2..45c2fcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -13420,6 +13420,18 @@ target_link_libraries(grpc_cli - endif (gRPC_BUILD_TESTS) - if (gRPC_BUILD_CODEGEN) +@@ -10844,6 +10844,18 @@ target_link_libraries(grpc_cli + endif() + if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CPP_PLUGIN) +if (gRPC_NATIVE_CPP_PLUGIN) +
@@ -39,14 +39,14 @@ index fc76cf5..7a22b08 100644 add_executable(grpc_cpp_plugin src/compiler/cpp_plugin.cc ) -@@ -13457,6 +13469,7 @@ if (gRPC_INSTALL) +@@ -10877,6 +10889,7 @@ if(gRPC_INSTALL) ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() +endif() - endif (gRPC_BUILD_CODEGEN) - if (gRPC_BUILD_CODEGEN) + endif() + if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CSHARP_PLUGIN) -- -2.20.0.rc0.387.gc7a69e6b6c-goog +2.26.2
package/grpc/0002-Properly-detect-the-availability-of-pthread_setname_.patch +8 -8
@@ -17,12 +17,12 @@ Signed-off-by: Thomas Petazzoni <[email protected]> 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 89e834b..c7bd2ad 100644 +index 45c2fcb..0b2be4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -97,6 +97,12 @@ endif() - - set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +@@ -177,6 +177,12 @@ if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") +include(CheckSymbolExists) +check_symbol_exists(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
@@ -30,14 +30,14 @@ index 89e834b..c7bd2ad 100644 + add_definitions(-DHAVE_PTHREAD_SETNAME_NP) +endif () + - if (MSVC) + if(MSVC) include(cmake/msvc_static_runtime.cmake) add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h -index 031c0c3..a29a9dc 100644 +index 4f213ff..55ecd9d 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h -@@ -181,7 +181,9 @@ +@@ -195,7 +195,9 @@ #endif /* _LP64 */ #ifdef __GLIBC__ #define GPR_POSIX_CRASH_HANDLER 1
@@ -48,5 +48,5 @@ index 031c0c3..a29a9dc 100644 #else /* musl libc */ #define GPR_MUSL_LIBC_COMPAT 1 -- -2.14.4 +2.26.2
package/grpc/Config.in +1 -0
@@ -7,6 +7,7 @@ config BR2_PACKAGE_GRPC depends on !BR2_STATIC_LIBS # protobuf depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC select BR2_PACKAGE_C_ARES + select BR2_PACKAGE_LIBABSEIL_CPP select BR2_PACKAGE_OPENSSL select BR2_PACKAGE_PROTOBUF select BR2_PACKAGE_ZLIB
package/grpc/grpc.hash +2 -2
@@ -1,3 +1,3 @@ # Locally computed -sha256 ffbe61269160ea745e487f79b0fd06b6edd3d50c6d9123f053b5634737cf2f69 grpc-1.25.0.tar.gz -sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE +sha256 ba74b97a2f1b4e22ec5fb69d639d849d2069fb58ea7d6579a31f800af6fe3b6c grpc-1.30.2.tar.gz +sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
package/grpc/grpc.mk +7 -4
@@ -4,7 +4,7 @@ # ################################################################################ -GRPC_VERSION = 1.25.0 +GRPC_VERSION = 1.30.2 GRPC_SITE = $(call github,grpc,grpc,v$(GRPC_VERSION)) GRPC_LICENSE = Apache-2.0 GRPC_LICENSE_FILES = LICENSE
@@ -12,8 +12,9 @@ GRPC_LICENSE_FILES = LICENSE GRPC_INSTALL_STAGING = YES # Need to use host grpc_cpp_plugin during cross compilation. -GRPC_DEPENDENCIES = c-ares host-grpc openssl protobuf zlib -HOST_GRPC_DEPENDENCIES = host-c-ares host-openssl host-protobuf host-zlib +GRPC_DEPENDENCIES = c-ares host-grpc openssl protobuf zlib libabseil-cpp +HOST_GRPC_DEPENDENCIES = host-c-ares host-openssl host-protobuf host-zlib \ + host-libabseil-cpp # gRPC_CARES_PROVIDER=package won't work because it requires c-ares to have # installed a cmake config file, but buildroot uses c-ares' autotools build,
@@ -25,6 +26,7 @@ GRPC_CONF_OPTS = \ -DgRPC_PROTOBUF_PROVIDER=package \ -DgRPC_SSL_PROVIDER=package \ -DgRPC_ZLIB_PROVIDER=package \ + -DgRPC_ABSL_PROVIDER=package \ -DgRPC_NATIVE_CPP_PLUGIN=$(HOST_DIR)/bin/grpc_cpp_plugin # grpc can use __atomic builtins, so we need to link with
@@ -65,7 +67,8 @@ HOST_GRPC_CONF_OPTS = \ -DgRPC_CARES_PROVIDER=none \ -DgRPC_PROTOBUF_PROVIDER=package \ -DgRPC_SSL_PROVIDER=package \ - -DgRPC_ZLIB_PROVIDER=package + -DgRPC_ZLIB_PROVIDER=package \ + -DgRPC_ABSL_PROVIDER=package $(eval $(cmake-package)) $(eval $(host-cmake-package))
Signature · 1 line
2.26.2
PATCH 1/2 package/libabseil-cpp new package
In reply to aduskett at gmail.comQuoted 12 lines · On Mon, 20 Jul 2020 12:23:47 -0700 aduskett at gmail.com wrote:
package/libabseil-cpp/0001-Add-fPIC-option.patch new file +6
-0@@ -0,0 +1,36 @@ +From d7160d647c8f8847f3ea8d7b0eb222936962c1af Mon Sep 17 00:00:00 2001 +From: Sinan Kaya <[email protected]> +Date: Tue, 11 Feb 2020 11:58:02 -0500 +Subject: [PATCH] Add fPIC option + +Without this option, programs building for arm64 or x86-64 will fail when
package/libabseil-cpp/0001-Add-fPIC-option.patch line 16
Quoted 10 lines
package/libabseil-cpp/0001-Add-fPIC-option.patch new file +10
-0+attempting to link to the built libraries with the following (abbreviated) +error: + +"relocation against `.rodata' can not be used when making a shared object; +recompile with -fPIC + +Force fPIC to resolve this issue. + +Signed-off-by: Adam Duskett <[email protected]> +Signed-off-by: Sinan Kaya <[email protected]>
Your SoB should go after the author's SoB. No need to resend just for that though.
package/libabseil-cpp/0001-Add-fPIC-option.patch line 29
Quoted 1 line
package/libabseil-cpp/0001-Add-fPIC-option.patch new file +1
-0++add_compile_options(-fPIC)
This feels weird, CMake is supposed to add -fPIC by itself when building shared libraries.
However, after looking briefly at the abseil CMake logic, it's not obvious what they are doing. Are they building a single static library ? One static library per "module" of abseil ? There is an ABSL_BUILD_DLL option, what does it do ?
Of course, if they build static libraries, and these static libraries then end up being included into a shared library, you would get that relocation failure.
If that's the case, it seems like the correct way to add -fPIC is not to add -fPIC, but something like this:
set_property(TARGET cpp-netlib_pic PROPERTY POSITION_INDEPENDENT_CODE ON)
according to https://cmake.org/pipermail/cmake/2016-August/064161.html.
Best regards,
Thomas Petazzoni
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com