[OpenWrt-Devel] protobuf broken in BB

Guillaume Déflache guillaume.deflache at ibwag.com
Wed May 20 07:05:33 EDT 2015

Guillaume Déflache <guillaume.deflache <at> ibwag.com> writes:

> Hi all
> Sorry obconseil and John for the delay, my work priorities got shifted 
> to other things...

Again paid work took over...

> > [...]
> > 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.
> [...]

Those needing only Protocol Buffers 2,4.1 may still use that patch, it 
works fine and has been serving us very well.

In the meantime I was able to devise a patch for 2.6.1 that also works for 
me and should for everyone else. I sent it as a GitHub pull request (1st 
one ever for me, so please be kind) for Chaos Calmer: 

(Note that 2.6.1 is still the best version for OpenWrt as 3 is still alpha 
ATM: <https://github.com/google/protobuf/blob/master/CHANGES.txt>.)

I think I now have a better understanding of all issues, so I'll just 
correct myself and give some more Details from here:

> [...]
> 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 <at> 
> ("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.

This thread continued in December 2014 with more useful Information which 
allowed me to fix the reamining problems (AFAICU).

All they say there is that a ./configure [...] -host=mips32 [instead of 
mips] CXXFLAGS="-D__MIPSEL__- march=mips32" [...] solves the issue.

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

It is not strictly speaking a regression but actually the result of 
performance optimizations which now require a MIPS ISA > 2, whereas OpenWrt 
defaults to MIPS ISA = 1.

A better solution (the one I shamelessly borrowed for the patch) is 
actually to switch the ISA locally for the problematic 'sync' assembler 
opcode(s), see the whole "small fix for mips" thread at 

An even better solution could be to conditionally declare protobuf as 
@BROKEN on MIPS1, but I could not find in 
http://wiki.openwrt.org/doc/devel/dependencies or 
http://wiki.openwrt.org/doc/hardware/cpu if this is at all possible

> What works for us is the patch below:
> - as I said only 2.4.1 worked

Is fixed by the (2.6.1-specific) new patch.

> - removing the src/google/protobuf/stubs/platform_macros.h patch chunk 
>   also did help *IIRC*

In fact the code plain did not exist in 2.4.1, that's why it helped! :)

> - PKG_USE_MIPS16:=0 or 1 made no difference *IIRC*

Correct for unoptimized 2.4.1, but the above optimizations and their use of 
sync lacked by the MIPS16 ISA now demand PKG_USE_MIPS16:=0, see also for 
another example https://dev.openwrt.org/ticket/15220

Also the host build is fixed in the new patch in the same way as in the old 
2.4.1 one.
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list