* [Buildroot] [PATCH 1/1] New package: gRPC, Google's remote procedue calss protocol.
@ 2018-09-17 19:34 Mark Fine
2018-09-18 20:00 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Mark Fine @ 2018-09-17 19:34 UTC (permalink / raw)
To: buildroot
Introduces support for gRPC, Google's remote procedure call
protocol. Includes a patch for supporting cross compilation.
Also patches the c-ares package for host support.
Signed-off-by: Mark Fine <mark.fine@gmail.com>
---
package/c-ares/c-ares.mk | 1 +
package/grpc/0001-fixup-cross-compile.patch | 20 +++++++
package/grpc/Config.in | 19 +++++++
package/grpc/grpc.mk | 85 +++++++++++++++++++++++++++++
4 files changed, 125 insertions(+)
create mode 100644 package/grpc/0001-fixup-cross-compile.patch
create mode 100644 package/grpc/Config.in
create mode 100644 package/grpc/grpc.mk
diff --git a/package/c-ares/c-ares.mk b/package/c-ares/c-ares.mk
index 67254244a1..76e9687b37 100644
--- a/package/c-ares/c-ares.mk
+++ b/package/c-ares/c-ares.mk
@@ -15,3 +15,4 @@ C_ARES_LICENSE = MIT
C_ARES_LICENSE_FILES = ares_mkquery.c
$(eval $(autotools-package))
+$(eval $(host-autotools-package))
diff --git a/package/grpc/0001-fixup-cross-compile.patch b/package/grpc/0001-fixup-cross-compile.patch
new file mode 100644
index 0000000000..eaf262a95a
--- /dev/null
+++ b/package/grpc/0001-fixup-cross-compile.patch
@@ -0,0 +1,20 @@
+diff -ur grpc_custom-v1.12.0/Makefile grpc_custom-v1.12.0.new/Makefile
+--- grpc_custom-v1.12.0/Makefile 2018-05-15 17:10:37.000000000 +0000
++++ grpc_custom-v1.12.0.new/Makefile 2018-08-30 20:28:31.357410038 +0000
+@@ -439,11 +439,11 @@
+ DEFINES += $(EXTRA_DEFINES)
+ LDLIBS += $(EXTRA_LDLIBS)
+
+-HOST_CPPFLAGS = $(CPPFLAGS)
+-HOST_CFLAGS = $(CFLAGS)
+-HOST_CXXFLAGS = $(CXXFLAGS)
+-HOST_LDFLAGS = $(LDFLAGS)
+-HOST_LDLIBS = $(LDLIBS)
++HOST_CPPFLAGS += $(CPPFLAGS)
++HOST_CFLAGS += $(CFLAGS)
++HOST_CXXFLAGS += $(CXXFLAGS)
++HOST_LDFLAGS += $(LDFLAGS)
++HOST_LDLIBS += $(LDLIBS)
+
+ # These are automatically computed variables.
+ # There shouldn't be any need to change anything from now on.
diff --git a/package/grpc/Config.in b/package/grpc/Config.in
new file mode 100644
index 0000000000..237a9d5a15
--- /dev/null
+++ b/package/grpc/Config.in
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_GRPC
+ bool "grpc"
+ depends on BR2_INSTALL_LIBSTDCPP
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ select BR2_PACKAGE_C_ARES
+ select BR2_PACKAGE_GFLAGS
+ select BR2_PACKAGE_GTEST
+ select BR2_PACKAGE_GTEST_GMOCK
+ select BR2_PACKAGE_OPENSSL
+ select BR2_PACKAGE_PROTOBUF
+ select BR2_PACKAGE_ZLIB
+ help
+ gRPC is Google's protocol buffer based implementation of a
+ remote procedure call protocol.
+
+ http://www.grpc.io
+
+comment "grpc needs a toolchain w/ C++, threads"
+ depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
\ No newline at end of file
diff --git a/package/grpc/grpc.mk b/package/grpc/grpc.mk
new file mode 100644
index 0000000000..a74dece713
--- /dev/null
+++ b/package/grpc/grpc.mk
@@ -0,0 +1,85 @@
+################################################################################
+#
+# grpc
+#
+################################################################################
+
+GRPC_VERSION = v1.14.0
+GRPC_SITE = https://github.com/grpc/grpc.git
+GRPC_SITE_METHOD = git
+GRPC_LICENSE = BSD-3-Clause
+GRPC_LICENSE_FILES = LICENSE
+
+GRPC_DEPENDENCIES = host-grpc gflags gtest c-ares openssl protobuf zlib
+HOST_GRPC_DEPENDENCIES = host-c-ares host-protobuf host-openssl
+
+GRPC_INSTALL_STAGING = YES
+
+GRPC_MAKE_ENV = \
+ CC="$(TARGET_CC)" \
+ CXX="$(TARGET_CXX)" \
+ LD="$(TARGET_CC)" \
+ LDXX="$(TARGET_CXX)" \
+ STRIP="$(TARGET_STRIP)" \
+ PROTOC="$(HOST_DIR)/bin/protoc" \
+ PATH="$(HOST_DIR)/bin:$(PATH)" \
+ GRPC_CROSS_COMPILE=true \
+ GRPC_CROSS_LDOPTS="$(TARGET_LDFLAGS)" \
+ GRPC_CROSS_AROPTS="$(LTO_PLUGIN)" \
+ HAS_PKG_CONFIG=false \
+ PROTOBUF_CONFIG_OPTS="--host=$(GNU_TARGET_NAME) --with-protoc=$(HOST_DIR)/bin/protoc" \
+ HOST_CC="$(HOSTCC)" \
+ HOST_CXX="$(HOSTCXX)" \
+ HOST_LD="$(HOSTCC)" \
+ HOST_LDXX="$(HOSTCXX)" \
+ HOST_CPPFLAGS="$(HOST_CPPFLAGS)" \
+ HOST_CFLAGS="$(HOST_CFLAGS)" \
+ HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
+ HOST_LDFLAGS="$(HOST_LDFLAGS)"
+
+GRPC_MAKE_OPTS = \
+ LD_LIBRARY_PATH="$(STAGING_DIR)/usr/lib" \
+ PROTOC="$(HOST_DIR)/bin/protoc"
+
+GRPC_INSTALL_TARGET_OPTS = \
+ prefix="$(TARGET_DIR)/usr"
+
+GRPC_INSTALL_STAGING_OPTS = \
+ prefix="$(STAGING_DIR)/usr"
+
+define GRPC_BUILD_CMDS
+ $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_MAKE_OPTS) -C $(@D) \
+ shared
+endef
+
+define GRPC_INSTALL_STAGING_CMDS
+ $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_INSTALL_STAGING_OPTS) -C $(@D) \
+ install-headers install-shared_c install-shared_cxx
+endef
+
+define GRPC_INSTALL_TARGET_CMDS
+ $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_INSTALL_TARGET_OPTS) -C $(@D) \
+ install-shared_c install-shared_cxx
+endef
+
+HOST_GRPC_MAKE_ENV = \
+ $(HOST_MAKE_ENV) \
+ CFLAGS="$(HOST_CFLAGS)" \
+ LDFLAGS="$(HOST_LDFLAGS)"
+
+HOST_GRPC_MAKE_OPTS = \
+ LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib" \
+ prefix="$(HOST_DIR)/usr"
+
+define HOST_GRPC_BUILD_CMDS
+ $(HOST_GRPC_MAKE_ENV) $(MAKE) $(HOST_GRPC_MAKE_OPTS) -C $(@D) \
+ plugins
+endef
+
+define HOST_GRPC_INSTALL_CMDS
+ $(HOST_GRPC_MAKE_ENV) $(MAKE) $(HOST_GRPC_MAKE_OPTS) -C $(@D) \
+ install-plugins
+endef
+
+$(eval $(generic-package))
+$(eval $(host-generic-package))
--
2.14.3 (Apple Git-98)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/1] New package: gRPC, Google's remote procedue calss protocol.
2018-09-17 19:34 [Buildroot] [PATCH 1/1] New package: gRPC, Google's remote procedue calss protocol Mark Fine
@ 2018-09-18 20:00 ` Thomas Petazzoni
2018-09-18 20:26 ` Mark Fine
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2018-09-18 20:00 UTC (permalink / raw)
To: buildroot
Hello Mark,
Thanks for this contribution! I believe I should mention that there was
a previous attempt at adding a package for "grpc":
https://patchwork.ozlabs.org/patch/917779/
https://patchwork.ozlabs.org/patch/917778/
Perhaps there are some useful things to re-use from this previous
contribution.
On Mon, 17 Sep 2018 12:34:55 -0700, Mark Fine wrote:
> Introduces support for gRPC, Google's remote procedure call
> protocol. Includes a patch for supporting cross compilation.
> Also patches the c-ares package for host support.
>
> Signed-off-by: Mark Fine <mark.fine@gmail.com>
The commit title should be just:
grpc: new package
> ---
> package/c-ares/c-ares.mk | 1 +
This change should be a separate patch, coming before the patch adding
grpc.
> diff --git a/package/grpc/0001-fixup-cross-compile.patch b/package/grpc/0001-fixup-cross-compile.patch
> new file mode 100644
> index 0000000000..eaf262a95a
> --- /dev/null
> +++ b/package/grpc/0001-fixup-cross-compile.patch
All patches need to have a description and Signed-off-by. Also, since
the upstream project is using Git, we want the patches to be
Git-formatted (i.e be generated by 'git format-patch').
> + # These are automatically computed variables.
> + # There shouldn't be any need to change anything from now on.
> diff --git a/package/grpc/Config.in b/package/grpc/Config.in
> new file mode 100644
> index 0000000000..237a9d5a15
> --- /dev/null
> +++ b/package/grpc/Config.in
> @@ -0,0 +1,19 @@
> +config BR2_PACKAGE_GRPC
> + bool "grpc"
> + depends on BR2_INSTALL_LIBSTDCPP
> + depends on BR2_TOOLCHAIN_HAS_THREADS
> + select BR2_PACKAGE_C_ARES
> + select BR2_PACKAGE_GFLAGS
> + select BR2_PACKAGE_GTEST
Due to this select, you also need to replicate the following
dependencies:
depends on BR2_USE_WCHAR
depends on BR2_USE_MMU
> + select BR2_PACKAGE_GTEST_GMOCK
> + select BR2_PACKAGE_OPENSSL
> + select BR2_PACKAGE_PROTOBUF
Due to this select, you also need to replicate the following
dependencies:
depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
depends on BR2_HOST_GCC_AT_LEAST_4_8 # C++11
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
depends on !BR2_STATIC_LIBS
> + select BR2_PACKAGE_ZLIB
> + help
> + gRPC is Google's protocol buffer based implementation of a
> + remote procedure call protocol.
> +
> + http://www.grpc.io
> +
> +comment "grpc needs a toolchain w/ C++, threads"
> + depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
Make sure to update this comment with the new dependencies. Also, I
personally prefer:
depends on !A || !B || !C
instead of
depends on !(A && B && C)
> \ No newline at end of file
Please make sure the file ends with a newline.
> diff --git a/package/grpc/grpc.mk b/package/grpc/grpc.mk
> new file mode 100644
> index 0000000000..a74dece713
> --- /dev/null
> +++ b/package/grpc/grpc.mk
> @@ -0,0 +1,85 @@
> +################################################################################
> +#
> +# grpc
> +#
> +################################################################################
> +
> +GRPC_VERSION = v1.14.0
> +GRPC_SITE = https://github.com/grpc/grpc.git
> +GRPC_SITE_METHOD = git
Please use the tarball at
https://github.com/grpc/grpc/archive/v1.15.0.tar.gz instead.
See
https://buildroot.org/downloads/manual/manual.html#github-download-url
for more details about this.
> +GRPC_LICENSE = BSD-3-Clause
> +GRPC_LICENSE_FILES = LICENSE
> +
> +GRPC_DEPENDENCIES = host-grpc gflags gtest c-ares openssl protobuf zlib
> +HOST_GRPC_DEPENDENCIES = host-c-ares host-protobuf host-openssl
> +
> +GRPC_INSTALL_STAGING = YES
> +
> +GRPC_MAKE_ENV = \
> + CC="$(TARGET_CC)" \
> + CXX="$(TARGET_CXX)" \
> + LD="$(TARGET_CC)" \
> + LDXX="$(TARGET_CXX)" \
> + STRIP="$(TARGET_STRIP)" \
> + PROTOC="$(HOST_DIR)/bin/protoc" \
> + PATH="$(HOST_DIR)/bin:$(PATH)" \
Use BR_PATH instead.
> + GRPC_CROSS_COMPILE=true \
> + GRPC_CROSS_LDOPTS="$(TARGET_LDFLAGS)" \
> + GRPC_CROSS_AROPTS="$(LTO_PLUGIN)" \
> + HAS_PKG_CONFIG=false \
Why ?
> + PROTOBUF_CONFIG_OPTS="--host=$(GNU_TARGET_NAME) --with-protoc=$(HOST_DIR)/bin/protoc" \
Seems weird, is grpc going to build its own protobuf ?
> + HOST_CC="$(HOSTCC)" \
> + HOST_CXX="$(HOSTCXX)" \
> + HOST_LD="$(HOSTCC)" \
> + HOST_LDXX="$(HOSTCXX)" \
> + HOST_CPPFLAGS="$(HOST_CPPFLAGS)" \
> + HOST_CFLAGS="$(HOST_CFLAGS)" \
> + HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
> + HOST_LDFLAGS="$(HOST_LDFLAGS)"
> +
> +GRPC_MAKE_OPTS = \
> + LD_LIBRARY_PATH="$(STAGING_DIR)/usr/lib" \
This looks very bad. LD_LIBRARY_PATH will be used by the dynamic loader
on your build machine to look for libraries... and you point it to
libraries built for the target. Not good at all.
> + PROTOC="$(HOST_DIR)/bin/protoc"
> +
> +GRPC_INSTALL_TARGET_OPTS = \
> + prefix="$(TARGET_DIR)/usr"
> +
> +GRPC_INSTALL_STAGING_OPTS = \
> + prefix="$(STAGING_DIR)/usr"
These two variables are not needed, just use the value directly in the
install staging/target commands.
> +
> +define GRPC_BUILD_CMDS
> + $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_MAKE_OPTS) -C $(@D) \
> + shared
> +endef
> +
> +define GRPC_INSTALL_STAGING_CMDS
> + $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_INSTALL_STAGING_OPTS) -C $(@D) \
> + install-headers install-shared_c install-shared_cxx
> +endef
> +
> +define GRPC_INSTALL_TARGET_CMDS
> + $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_INSTALL_TARGET_OPTS) -C $(@D) \
> + install-shared_c install-shared_cxx
> +endef
> +
> +HOST_GRPC_MAKE_ENV = \
> + $(HOST_MAKE_ENV) \
> + CFLAGS="$(HOST_CFLAGS)" \
> + LDFLAGS="$(HOST_LDFLAGS)"
> +
> +HOST_GRPC_MAKE_OPTS = \
> + LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib" \
This also shouldn't be needed.
> + prefix="$(HOST_DIR)/usr"
Use just $(HOST_DIR), not $(HOST_DIR)/usr
Could you rework your patch according to those comments? Perhaps the
previous attempt at adding grpc will provide some hints/help on how to
improve things.
Do not hesitate to let us know if you need more explanation about those
comments. You are the second person trying to add grpc to Buildroot, so
we definitely want to add it :-)
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/1] New package: gRPC, Google's remote procedue calss protocol.
2018-09-18 20:00 ` Thomas Petazzoni
@ 2018-09-18 20:26 ` Mark Fine
2018-09-18 20:37 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Mark Fine @ 2018-09-18 20:26 UTC (permalink / raw)
To: buildroot
Hi Thomas,
Thanks for the feedback! Our patch started out based on the earlier
referenced patch from Charles Hardin - we tried to incorporate your
comments on that patch, as well as resolve cross compiling issues we ran
into on our embedded ARM device with the grpc Makefile:
https://groups.google.com/d/msg/grpc-io/41-i08zBG5k/sEKuYHsEAwAJ
I'll re-work the patch per your comments. See more comments and questions
in-line:
On Tue, Sep 18, 2018 at 1:00 PM, Thomas Petazzoni <
thomas.petazzoni@bootlin.com> wrote:
> Hello Mark,
>
> Thanks for this contribution! I believe I should mention that there was
> a previous attempt at adding a package for "grpc":
>
> https://patchwork.ozlabs.org/patch/917779/
> https://patchwork.ozlabs.org/patch/917778/
>
> Perhaps there are some useful things to re-use from this previous
> contribution.
>
> On Mon, 17 Sep 2018 12:34:55 -0700, Mark Fine wrote:
> > Introduces support for gRPC, Google's remote procedure call
> > protocol. Includes a patch for supporting cross compilation.
> > Also patches the c-ares package for host support.
> >
> > Signed-off-by: Mark Fine <mark.fine@gmail.com>
>
> The commit title should be just:
>
> grpc: new package
>
> > ---
> > package/c-ares/c-ares.mk | 1 +
>
> This change should be a separate patch, coming before the patch adding
> grpc.
>
> > diff --git a/package/grpc/0001-fixup-cross-compile.patch
> b/package/grpc/0001-fixup-cross-compile.patch
> > new file mode 100644
> > index 0000000000..eaf262a95a
> > --- /dev/null
> > +++ b/package/grpc/0001-fixup-cross-compile.patch
>
> All patches need to have a description and Signed-off-by. Also, since
> the upstream project is using Git, we want the patches to be
> Git-formatted (i.e be generated by 'git format-patch').
>
> > + # These are automatically computed variables.
> > + # There shouldn't be any need to change anything from now on.
> > diff --git a/package/grpc/Config.in b/package/grpc/Config.in
> > new file mode 100644
> > index 0000000000..237a9d5a15
> > --- /dev/null
> > +++ b/package/grpc/Config.in
> > @@ -0,0 +1,19 @@
> > +config BR2_PACKAGE_GRPC
> > + bool "grpc"
> > + depends on BR2_INSTALL_LIBSTDCPP
> > + depends on BR2_TOOLCHAIN_HAS_THREADS
> > + select BR2_PACKAGE_C_ARES
> > + select BR2_PACKAGE_GFLAGS
> > + select BR2_PACKAGE_GTEST
>
> Due to this select, you also need to replicate the following
> dependencies:
>
> depends on BR2_USE_WCHAR
> depends on BR2_USE_MMU
>
> > + select BR2_PACKAGE_GTEST_GMOCK
> > + select BR2_PACKAGE_OPENSSL
> > + select BR2_PACKAGE_PROTOBUF
>
> Due to this select, you also need to replicate the following
> dependencies:
>
> depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
> depends on BR2_HOST_GCC_AT_LEAST_4_8 # C++11
> depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
> depends on !BR2_STATIC_LIBS
>
> > + select BR2_PACKAGE_ZLIB
> > + help
> > + gRPC is Google's protocol buffer based implementation of a
> > + remote procedure call protocol.
> > +
> > + http://www.grpc.io
> > +
> > +comment "grpc needs a toolchain w/ C++, threads"
> > + depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
>
> Make sure to update this comment with the new dependencies. Also, I
> personally prefer:
>
> depends on !A || !B || !C
>
> instead of
>
> depends on !(A && B && C)
>
> > \ No newline at end of file
>
> Please make sure the file ends with a newline.
>
> > diff --git a/package/grpc/grpc.mk b/package/grpc/grpc.mk
> > new file mode 100644
> > index 0000000000..a74dece713
> > --- /dev/null
> > +++ b/package/grpc/grpc.mk
> > @@ -0,0 +1,85 @@
> > +###########################################################
> #####################
> > +#
> > +# grpc
> > +#
> > +###########################################################
> #####################
> > +
> > +GRPC_VERSION = v1.14.0
> > +GRPC_SITE = https://github.com/grpc/grpc.git
> > +GRPC_SITE_METHOD = git
>
> Please use the tarball at
> https://github.com/grpc/grpc/archive/v1.15.0.tar.gz instead.
>
> See
> https://buildroot.org/downloads/manual/manual.html#github-download-url
> for more details about this.
>
Initially, I tried to use tarballs off of git and a locally calculated hash
file, but had issues with BR finding and downloading the tarballs. Will try
again.
>
> > +GRPC_LICENSE = BSD-3-Clause
> > +GRPC_LICENSE_FILES = LICENSE
> > +
> > +GRPC_DEPENDENCIES = host-grpc gflags gtest c-ares openssl protobuf zlib
> > +HOST_GRPC_DEPENDENCIES = host-c-ares host-protobuf host-openssl
> > +
> > +GRPC_INSTALL_STAGING = YES
> > +
> > +GRPC_MAKE_ENV = \
> > + CC="$(TARGET_CC)" \
> > + CXX="$(TARGET_CXX)" \
> > + LD="$(TARGET_CC)" \
> > + LDXX="$(TARGET_CXX)" \
> > + STRIP="$(TARGET_STRIP)" \
> > + PROTOC="$(HOST_DIR)/bin/protoc" \
> > + PATH="$(HOST_DIR)/bin:$(PATH)" \
>
> Use BR_PATH instead.
>
> > + GRPC_CROSS_COMPILE=true \
> > + GRPC_CROSS_LDOPTS="$(TARGET_LDFLAGS)" \
> > + GRPC_CROSS_AROPTS="$(LTO_PLUGIN)" \
> > + HAS_PKG_CONFIG=false \
>
> Why ?
>
I believe this was added per the Makefile:
# The steps for cross-compiling are as follows:
# First, clone and make install of grpc using the native compilers for the host.
# Also, install protoc (e.g., from a package like apt-get)
# Then clone a fresh grpc for the actual cross-compiled build
# Set the environment variable GRPC_CROSS_COMPILE to true
# Set CC, CXX, LD, LDXX, AR, and STRIP to the cross-compiling binaries
# Also set PROTOBUF_CONFIG_OPTS to indicate cross-compilation to protobuf (e.g.,
# PROTOBUF_CONFIG_OPTS="--host=arm-linux --with-protoc=/usr/local/bin/protoc" )
# Set HAS_PKG_CONFIG=false
> > + PROTOBUF_CONFIG_OPTS="--host=$(GNU_TARGET_NAME)
> --with-protoc=$(HOST_DIR)/bin/protoc" \
>
> Seems weird, is grpc going to build its own protobuf ?
I believe this uses the host built protobuf compiler picked up from
host-protobuf.
> > + HOST_CC="$(HOSTCC)" \
> > + HOST_CXX="$(HOSTCXX)" \
> > + HOST_LD="$(HOSTCC)" \
> > + HOST_LDXX="$(HOSTCXX)" \
> > + HOST_CPPFLAGS="$(HOST_CPPFLAGS)" \
> > + HOST_CFLAGS="$(HOST_CFLAGS)" \
> > + HOST_CXXFLAGS="$(HOST_CXXFLAGS)" \
> > + HOST_LDFLAGS="$(HOST_LDFLAGS)"
> > +
> > +GRPC_MAKE_OPTS = \
> > + LD_LIBRARY_PATH="$(STAGING_DIR)/usr/lib" \
>
> This looks very bad. LD_LIBRARY_PATH will be used by the dynamic loader
> on your build machine to look for libraries... and you point it to
> libraries built for the target. Not good at all.
Will try removing this.
> > + PROTOC="$(HOST_DIR)/bin/protoc"
> > +
> > +GRPC_INSTALL_TARGET_OPTS = \
> > + prefix="$(TARGET_DIR)/usr"
> > +
> > +GRPC_INSTALL_STAGING_OPTS = \
> > + prefix="$(STAGING_DIR)/usr"
>
> These two variables are not needed, just use the value directly in the
> install staging/target commands.
>
> > +
> > +define GRPC_BUILD_CMDS
> > + $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_MAKE_OPTS) -C $(@D) \
> > + shared
> > +endef
> > +
> > +define GRPC_INSTALL_STAGING_CMDS
> > + $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_INSTALL_STAGING_OPTS) -C $(@D) \
> > + install-headers install-shared_c install-shared_cxx
> > +endef
> > +
> > +define GRPC_INSTALL_TARGET_CMDS
> > + $(GRPC_MAKE_ENV) $(MAKE) $(GRPC_INSTALL_TARGET_OPTS) -C $(@D) \
> > + install-shared_c install-shared_cxx
> > +endef
> > +
> > +HOST_GRPC_MAKE_ENV = \
> > + $(HOST_MAKE_ENV) \
> > + CFLAGS="$(HOST_CFLAGS)" \
> > + LDFLAGS="$(HOST_LDFLAGS)"
> > +
> > +HOST_GRPC_MAKE_OPTS = \
> > + LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib" \
>
> This also shouldn't be needed.
>
> > + prefix="$(HOST_DIR)/usr"
>
> Use just $(HOST_DIR), not $(HOST_DIR)/usr
>
> Could you rework your patch according to those comments? Perhaps the
> previous attempt at adding grpc will provide some hints/help on how to
> improve things.
>
> Do not hesitate to let us know if you need more explanation about those
> comments. You are the second person trying to add grpc to Buildroot, so
> we definitely want to add it :-)
>
Yes, we'd love to have this get into upstream! Thanks for your response!
Mark
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180918/fefaf98a/attachment.html>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH 1/1] New package: gRPC, Google's remote procedue calss protocol.
2018-09-18 20:26 ` Mark Fine
@ 2018-09-18 20:37 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2018-09-18 20:37 UTC (permalink / raw)
To: buildroot
Hello Mark,
On Tue, 18 Sep 2018 13:26:06 -0700, Mark Fine wrote:
> > See
> > https://buildroot.org/downloads/manual/manual.html#github-download-url
> > for more details about this.
>
> Initially, I tried to use tarballs off of git and a locally calculated hash
> file, but had issues with BR finding and downloading the tarballs. Will try
> again.
OK, let me know if you run into specific issues.
> > > +GRPC_LICENSE = BSD-3-Clause
> > > +GRPC_LICENSE_FILES = LICENSE
> > > +
> > > +GRPC_DEPENDENCIES = host-grpc gflags gtest c-ares openssl protobuf zlib
> > > +HOST_GRPC_DEPENDENCIES = host-c-ares host-protobuf host-openssl
> > > +
> > > +GRPC_INSTALL_STAGING = YES
> > > +
> > > +GRPC_MAKE_ENV = \
> > > + CC="$(TARGET_CC)" \
> > > + CXX="$(TARGET_CXX)" \
> > > + LD="$(TARGET_CC)" \
> > > + LDXX="$(TARGET_CXX)" \
> > > + STRIP="$(TARGET_STRIP)" \
> > > + PROTOC="$(HOST_DIR)/bin/protoc" \
> > > + PATH="$(HOST_DIR)/bin:$(PATH)" \
> >
> > Use BR_PATH instead.
> >
> > > + GRPC_CROSS_COMPILE=true \
> > > + GRPC_CROSS_LDOPTS="$(TARGET_LDFLAGS)" \
> > > + GRPC_CROSS_AROPTS="$(LTO_PLUGIN)" \
> > > + HAS_PKG_CONFIG=false \
> >
> > Why ?
> >
>
> I believe this was added per the Makefile:
>
> # The steps for cross-compiling are as follows:
> # First, clone and make install of grpc using the native compilers for the host.
> # Also, install protoc (e.g., from a package like apt-get)
> # Then clone a fresh grpc for the actual cross-compiled build
> # Set the environment variable GRPC_CROSS_COMPILE to true
> # Set CC, CXX, LD, LDXX, AR, and STRIP to the cross-compiling binaries
> # Also set PROTOBUF_CONFIG_OPTS to indicate cross-compilation to protobuf (e.g.,
> # PROTOBUF_CONFIG_OPTS="--host=arm-linux --with-protoc=/usr/local/bin/protoc" )
> # Set HAS_PKG_CONFIG=false
Looks weird. Perhaps it's simply to make sure the system-provided
pkg-config doesn't get used. But in Buildroot, we provide in
$(HOST_DIR)/bin, a special pkg-config that returns results that are
valid when cross-compiling.
> > > + PROTOBUF_CONFIG_OPTS="--host=$(GNU_TARGET_NAME)
> > --with-protoc=$(HOST_DIR)/bin/protoc" \
> >
> > Seems weird, is grpc going to build its own protobuf ?
>
> I believe this uses the host built protobuf compiler picked up from
> host-protobuf.
But why --host=$(GNU_TARGET_NAME) is needed ?
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-18 20:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-17 19:34 [Buildroot] [PATCH 1/1] New package: gRPC, Google's remote procedue calss protocol Mark Fine
2018-09-18 20:00 ` Thomas Petazzoni
2018-09-18 20:26 ` Mark Fine
2018-09-18 20:37 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox