joshivineet / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

Not Able to compile protobuf for mips platform #670

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. executed ./configure  --prefix=/home/inigo/  --with-protoc=../bin/protoc  
--host=mips-linux --build=mips-linux-uclibc 
CC=/home/inigo/bin/mips-linux-uclibc-gcc 
CXX=/home/inigo/bin/mips-linux-uclibc-g++
2.make
3.

What is the expected output? 

it should compile without any issues.

What do you see instead?
In file included from ./google/protobuf/stubs/atomicops.h:59,
                 from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:
./google/protobuf/stubs/platform_macros.h:61:2: error: #error Host architecture 
was not detected as supported by protobuf
In file included from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:
./google/protobuf/stubs/atomicops.h:188: error: stray '#' in program
./google/protobuf/stubs/atomicops.h:188: error: expected constructor, 
destructor, or type conversion before string constant
make[3]: *** [atomicops_internals_x86_gcc.lo] Error 1

Please use labels and text to provide additional information.
Help me to resolve the issue.

Original issue reported on code.google.com by inigonir...@gmail.com on 9 Sep 2014 at 10:26

GoogleCodeExporter commented 9 years ago
What's the version you are using? I believe we just added mips support in the 
latest 2.6.0 release.

Original comment by xiaof...@google.com on 9 Sep 2014 at 8:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for the reply. I was using 2.5.0 and as per your reply, now I downloaded 
the 2.6.0 protobuf and I am seeing the same above issue issue.1. 

If manually define the __MIPSEL__ then the compilation is failing with the 
following errors. Please help me to resolve this problem.

libtool: compile:  /home/inigonirmal/bin/mips-linux-uclibc-g++ -DHAVE_CONFIG_H 
-I. -I.. -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare 
-D__MIPSEL__ -MT google/protobuf/stubs/common.lo -MD -MP -MF 
google/protobuf/stubs/.deps/common.Tpo -c google/protobuf/stubs/common.cc  
-fPIC -DPIC -o google/protobuf/stubs/.libs/common.o
/tmp/ccmM2iGe.s: Assembler messages:
/tmp/ccmM2iGe.s:232: Error: opcode not supported on this processor: mips1 
(mips1) `sync'
make[3]: *** [google/protobuf/stubs/common.lo] Error 1

Original comment by inigonir...@gmail.com on 10 Sep 2014 at 5:55

GoogleCodeExporter commented 9 years ago
Can you check whether your compilation has hit this header file?
https://github.com/google/protobuf/blob/master/src/google/protobuf/stubs/atomico
ps_internals_mips_gcc.h

Original comment by xiaof...@google.com on 10 Sep 2014 at 6:47

GoogleCodeExporter commented 9 years ago
After I manually define the __MIPSEL__ in the compilation then the above .h 
file is getting included in the compilation and I am getting the following 
error. Please let me know if there is any issue with my compilation. If I dont 
define then the above .h file didnt get included in the compilation.
Steps
./configure  --prefix=/home/inigo/gbp/  --with-protoc=../bin/protoc  
--host=mips-linux CC=/home/inigo/bin/mips-linux-uclibc-gcc 
CXX=/home/inigo/bin/mips-linux-uclibc-g++ CXXFLAGS=-D__MIPSEL__

make

and getting the following compilation error.
./configure  --prefix=/home/inigo/gbp/  --with-protoc=../bin/protoc  
--host=mips-linux CC=/home/inigo/bin/mips-linux-uclibc-gcc 
CXX=/home/inigo/bin/mips-linux-uclibc-g++ CXXFLAGS=-D__MIPSEL__

libtool: compile:  /home/inigo/bin/mips-linux-uclibc-g++ -DHAVE_CONFIG_H -I. 
-I.. -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare 
-D__MIPSEL__ -MT google/protobuf/stubs/common.lo -MD -MP -MF 
google/protobuf/stubs/.deps/common.Tpo -c google/protobuf/stubs/common.cc  
-fPIC -DPIC -o google/protobuf/stubs/.libs/common.o
/tmp/ccXLEEIv.s: Assembler messages:
/tmp/ccXLEEIv.s:232: Error: opcode not supported on this processor: mips1 
(mips1) `sync'
make[3]: *** [google/protobuf/stubs/common.lo] Error 1
make[3]: Leaving directory `/home/inigo/gbp/protobuf-2.6.0/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/inigo/gbp/protobuf-2.6.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/inigo/gbp/protobuf-2.6.0'
make: *** [all] Error 2
-bash-3.2$  

Original comment by inigonir...@gmail.com on 11 Sep 2014 at 9:56

GoogleCodeExporter commented 9 years ago
> Error: opcode not supported on this processor: mips1 (mips1) `sync'

What platform would you like to use it on?
Can you take a recent MIPS cross-toolchain and build it with it?
If your platform is MIPS32 or MIPS32R2, passing -mips32 or -mips32r2 will help 
too, in case your compiler defaults to mips1.

Original comment by pet...@mips.com on 11 Sep 2014 at 6:50

GoogleCodeExporter commented 9 years ago
Note that protobuf 2.4.1 seems to cross-compile fine to MIPS

2.5.0 and 2.6.1 both fail for me as well with the reported error

I used gcc 4.4 toolchain on debian, similar to instructions here:
https://moozing.wordpress.com/2011/04/05/cross-compile-in-debian/

And:
configure -host=mips --disable-shared CC=mips-linux-gnu-gcc 
CXX=mips-linux-gnu-g++

Original comment by osu...@gmail.com on 29 Dec 2014 at 4:39

GoogleCodeExporter commented 9 years ago
After more digging it appears to build to MIPS32 (2.4.1, 2.5.0, 2.6.1):

./configure -host=mips32 CXX=mips-linux-gnu-g++ CXXFLAGS="-D__MIPSEL__ 
-march=mips32" --disable-shared

After make:

file src/protoc
src/protoc: ELF 32-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.18, 
BuildID[sha1]=0x25cf7add05893f48e8c5bd2b256bd784d81045e4, with unknown 
capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70401, 
not stripped

Original comment by osu...@gmail.com on 29 Dec 2014 at 5:01