[OpenWrt-Devel] protobuf broken in BB

Guillaume Déflache guillaume.deflache at ibwag.com
Wed Nov 19 07:24:20 EST 2014


Hi all

Sorry obconseil and John for the delay, my work priorities got shifted 
to other things...
@John: good idea to ping me personally! ;)


Am 06.11.2014 10:23, schrieb obconseil:
> Le 05/11/2014 22:43, Guillaume Déflache a écrit :
> 
>>
>> Fine, but that's not the problem as I said before (see the very 1st
>> quoted text in this message): *installing protoc at the right location*
>> (that is .../build_dir/host/bin/protoc IIRC) is the problem.
> 
> 
>> I checked that with our pre-BB snapshot it was installed where expected
>> and that with the BB release it is not. You can try executing `make
>> install` from the host build directory to convince yourself that that
>> does what is required from the OpenWrt Makefile but currently missing in
>> BB's. That's what I did and then the problem was gone.
>>
>> So you have to try using protoc to generate some source code files in
>> order to really stumble on the problem. Apart from that everything works
>> fine indeed.
> 
> Oh. I admit I overlooked this in your previous message. Thanks.
> 
> What about the attached patch ?

I had no time to test it unfortunately but I made one myself (see below) 
in parallel to get something working for us internally.


> By the way, maybe somebody else could enlighten me on this but in BB, it 
> seems that the
> "host" tools directory is .../staging_dir/host/bin rather than 
> .../build_dir/host/bin .
> 
> I have no .../build_dir/host/bin directory on my build tree.

You are right, .../staging_dir/host/bin is correct: AFAICU only staging_dir/ 
sports global filesystem hierarchies for all packages with bin/, include/, lib/, ...
(one for the host, two per compiled target for the toolchain and the device itself).


> The patch do install protoc in .../staging_dir/host/bin , along with all 
> other programs like bison,...

I think this is the correct thing to do, and that's also what I do in my patch.


>>>> Since the snapshot we used previously PKG_USE_MIPS16:=0 also got added,
>>>> does that mean we should also use that on all packages that compile
>>>> Protocol Buffer generated code and/or link with the PB library?
> 
> After a second though I think this line was to avoid an assembler error
> on some plateform.
> I still need to test the current compiler/assembler on a MIPS16 platform,
> but for now you can safely leave this line out for your platform.
> [...]
>> I would have no objections to 2.6.1 if it also works for us too (I can
>> test that at the same time).
> 
> Yes, please test & report : I would much better push upstream a patch 
> with the newest version of protobuf.

For us 2.6.0 and 2.5.0 definitely do not work (I think I also tested 
with 2.6.1, not sure anymore).

When I made the patch I stumbled upon <https://www.mail-archive.com/protobuf@googlegroups.com/msg10536.html> 
("Re: [protobuf] Re: Issue 670 in protobuf: Not Able to compile protobuf for mips platform") 
which looks exactly like the problem I had.
Alas I did not notify either of OpenWrt or protobuf of the others' problem then.

I guess there was some kind of regression from 2.4.1, probably someone 
should point the upstream protobuf developers to this thread.


What works for us is the patch below:
- as I said only 2.4.1 worked
- removing the src/google/protobuf/stubs/platform_macros.h patch chunk 
  also did help *IIRC*
- PKG_USE_MIPS16:=0 or 1 made no difference *IIRC*


##\brief protobuf 2.4.1 without MIPS16
##
## For the full rationale see <https://lists.openwrt.org/pipermail/openwrt-devel/2014-November/029107.html>.
##
## This is a Git patch against GitHub OpenWrt's 'packages' feed v14.07.
#
diff --git a/libs/protobuf/Makefile b/libs/protobuf/Makefile
index 1553a7e..1411a82 100644
--- a/libs/protobuf/Makefile
+++ b/libs/protobuf/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk

 PKG_NAME:=protobuf
-PKG_VERSION:=2.5.0
+PKG_VERSION:=2.4.1
 PKG_RELEASE:=1

 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://protobuf.googlecode.com/files
-PKG_MD5SUM:=a72001a9067a4c2c4e0e836d0f92ece4
+PKG_MD5SUM:=ed436802019c9e1f40cc750eaf78f318

 PKG_BUILD_DEPENDS:=protobuf/host
 PKG_USE_MIPS16:=0
@@ -38,14 +38,7 @@ define Package/protobuf/description
  of its internal RPC protocols and file formats.
 endef

-define Host/Compile
-       $(MAKE) -C $(HOST_BUILD_DIR)
-endef
-
-define Host/Install
-endef
-
-CONFIGURE_ARGS += --with-protoc=$(HOST_BUILD_DIR)/src/protoc
+CONFIGURE_ARGS += --with-protoc=$(STAGING_DIR_HOST)/bin/protoc

 define Build/InstallDev
        $(INSTALL_DIR) \
diff --git a/libs/protobuf/patches/001-mipseb-compile.patch b/libs/protobuf/patches/001-mipseb-compile.patch
deleted file mode 100644
index 6eb0590..0000000
--- a/libs/protobuf/patches/001-mipseb-compile.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/google/protobuf/stubs/platform_macros.h
-+++ b/src/google/protobuf/stubs/platform_macros.h
-@@ -49,7 +49,7 @@
- #elif defined(__ARMEL__)
- #define GOOGLE_PROTOBUF_ARCH_ARM 1
- #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
--#elif defined(__MIPSEL__)
-+#elif defined(__MIPSEL__) || defined(__MIPSEB__)
- #define GOOGLE_PROTOBUF_ARCH_MIPS 1
- #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
- #elif defined(__pnacl__)

-- 
Cheers
   Guillaume

ibw ag software, Aarestrasse 17, CH-5412 Vogelsang, http://www.ibwag.com
Guillaume Déflache, Projektingenieur, Telefon: +41 56 201 07 30 

---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list