Error : wrong ELF class: ELFCLASS32

16 views
Skip to first unread message

Mac Pham

unread,
Jan 28, 2020, 6:31:37 PM1/28/20
to Protocol Buffers
Hi everyone,

I got version protobuf-cpp-3.10.0.tar.gz and protoc-3.10.0-linux-aarch_64.zip from https://github.com/protocolbuffers/protobuf/releases

I tried to cross-compile  protobuf-cpp-3.10.0 on Linux  SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux 
The steps I did are

$ ./configure --host=x86-linux --target=aarch64-linux-gnu  CXX=arm-linux-gnueabihf-g++ --with-protoc=../protoc-3.10.0/bin/protoc
$ make
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
$ sudo ldconfig

It did build the libprotobuf.so.21.0.0 shared lib under  ../ protobuf-3.10.0/src/.libs   and installed under /usr/local/lib
It also create protoc under  ../ protobuf-3.10.0/src/.libs


$ file libprotobuf.so.21.0.0
libprotobuf.so.21.0.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (GNU/Linux), dynamically linked,

$ file protoc
protoc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked
 
When I tried to use protoc to compile proto file I got the following ERROR

$ protoc BIT.proto
protoc: error while loading shared libraries: libprotobuf.so.21: wrong ELF class: ELFCLASS32

I can't use the protoc from protoc-3.10.0-linux-aarch_64.zip as it is ELF 64bits

What do I missed here? What wrong with ELFCLASS32.  My libprotobuf.so and protoc are both ELF 32 bits

Any help are very appreciated.   

Is there any protobuf compiler for ARM 32 bits?  I found only protoc-3.10.0-linux-aarch_64.zip

Thanks

-Tom
 
 



Mac Pham

unread,
Jan 31, 2020, 12:38:41 PM1/31/20
to Protocol Buffers
I figured out my problem. I have to use specify --with-protoc=protoc and use the protoc from the linux-x86_32.zip for the host., After unzip I have to install the protoc under user/local/bin

Thanks

-Tom
Reply all
Reply to author
Forward
0 new messages