Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Compile Protobuf for QNX aarch64 #7794

Closed
bosssaurav opened this issue Aug 11, 2020 · 8 comments
Closed

Unable to Compile Protobuf for QNX aarch64 #7794

bosssaurav opened this issue Aug 11, 2020 · 8 comments

Comments

@bosssaurav
Copy link

bosssaurav commented Aug 11, 2020

What version of protobuf and what language are you using?
Version: master
Language: C++

What operating system (Linux, Windows, ...) and version?
Linux x86
Target OS : QNX aarch64

What runtime / compiler are you using (e.g., python version or gcc version)
CC=ntoaarch64-g++-5.4.0
CXX=ntoaarch64-gcc-5.4.0

What did you do?
Try to cross- compile protobuf for aarch64
Steps to reproduce the behavior:

  1. Command run : ../configure --host=aarch64 --prefix=$HOME/google/qnx_arm64 --with-protoc=$HOME/google/x86_64_pb_install/bin/protoc

Executed Successfully.

  1. Command 2: make

    See error

What did you expect to see
> Protobuf libraries for aarch64 qnx
What did you see instead?

libtool: compile: ntoaarch64-g++-5.4.0 -std=c++11 -DHAVE_CONFIG_H -I. -I../../src -I.. -DHAVE_PTHREAD=1 -DHAVE_ZLIB=1 -Wall -Wno-sign-compare -O2 -g -DNDEBUG -MT google/protobuf/io/zero_copy_stream_impl.lo -MD -MP -MF google/protobuf/io/.deps/zero_copy_stream_impl.Tpo -c ../../src/google/protobuf/io/zero_copy_stream_impl.cc -o google/protobuf/io/zero_copy_stream_impl.o
../../src/google/protobuf/io/zero_copy_stream_impl.cc: In function 'int google::protobuf::io::{anonymous}::close_no_eintr(int)':
../../src/google/protobuf/io/zero_copy_stream_impl.cc:75:22: error: 'close' was not declared in this scope
result = close(fd);
^
../../src/google/protobuf/io/zero_copy_stream_impl.cc: In member function 'virtual int google::protobuf::io::FileInputStream::CopyingFileInputStream::Read(void*, int)':
../../src/google/protobuf/io/zero_copy_stream_impl.cc:147:38: error: 'read' was not declared in this scope
result = read(file_, buffer, size);
^
../../src/google/protobuf/io/zero_copy_stream_impl.cc: In member function 'virtual int google::protobuf::io::FileInputStream::CopyingFileInputStream::Skip(int)':
../../src/google/protobuf/io/zero_copy_stream_impl.cc:162:35: error: 'lseek' was not declared in this scope
lseek(file_, count, SEEK_CUR) != (off_t)-1) {
^
../../src/google/protobuf/io/zero_copy_stream_impl.cc: In member function 'virtual bool google::protobuf::io::FileOutputStream::CopyingFileOutputStream::Write(const void*, int)':
../../src/google/protobuf/io/zero_copy_stream_impl.cc:250:77: error: 'write' was not declared in this scope
bytes = write(file_, buffer_base + total_written, size - total_written);
^
../../src/google/protobuf/io/zero_copy_stream_impl.cc: In member function 'virtual int google::protobuf::io::FileInputStream::CopyingFileInputStream::Skip(int)':
../../src/google/protobuf/io/zero_copy_stream_impl.cc:175:1: warning: control reaches end of non-void function [-Wreturn-type]

Anything else we should know about your project / environment
CC=ntoaarch64-g++-5.4.0
CXX=ntoaarch64-gcc-5.4.0

@TeBoring
Copy link
Contributor

Sorry, I think this is not our officially supported platform. Could you help send a fix?

@TeBoring TeBoring added the c++ label Aug 20, 2020
@journey175
Copy link

I got the same question when cross-compile protobuf c++ 3.11.4 for arm-linux,
it describe the error : ./.libs/libprotoc.so : error: undefined reference to 'scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto', I met the simliar question in other bloack , but it can not fix my question

@bosssaurav
Copy link
Author

@TeBoring
Maybe I could find a fix. You should invite me for an interview though ;)

@xuwenping
Copy link

xuwenping commented Sep 7, 2020

@bosssaurav @journey175 I got the same question, I have fixed.

  1. imput input configure cmd
    ./configure --prefix=/home/protobuf --host=arm --build=i686-pc-linux CC=/qnx700/host/linux/x86_64/usr/bin/ntoaarch64-gcc CXX=/qnx700/host/linux/x86_64/usr/bin/ntoaarch64-g++ --with-protoc=protoc --enable-shared=yes --enable-static=no
  2. modify src/makefile, on 1119 line
    the old content is :
    LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS)
    $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS)
    $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
    $(AM_CXXFLAGS) $(CXXFLAGS)
    after modification:
    LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS)
    $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS)
    $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
    $(AM_CXXFLAGS) $(CXXFLAGS) -D_XOPEN_SOURCE=500

the reason can see https://stackoverflow.com/questions/5378778/what-does-d-xopen-source-do-mean

@bosssaurav
Copy link
Author

@xuwenping
Your method : 👍
Although it generates the protoc of aarch64 type, it does not produce libprotobuf.so.*

In my method :
At the last stage : "it doesnot generate libprotobuf.so.*"

by giving follow error:
libtool: link: /root/Out/ML-examples/opt/qnx700_2/host/linux/x86_64/usr/bin/ntoaarch64-c++-5.4.0 -DHAVE_PTHREAD=1 -Wall -Wno-sign-compare -E -std=c++11 -Wall -pedantic -Wno-sign-compare -o protoc google/protobuf/compiler/main.o ./.libs/libprotobuf.a ./.libs/libprotoc.a /root/google/protobuf-3.5.1/qnx_build/src/.libs/libprotobuf.a
/usr/bin/install -c -m 644 ../../src/google/protobuf/compiler/php/php_generator.h '/root/armnn-devenv/google/qnx_arm64/include/google/protobuf/compiler/php'
ntoaarch64-c++-5.4.0: warning: google/protobuf/compiler/main.o: linker input file unused because linking not done
ntoaarch64-c++-5.4.0: warning: ./.libs/libprotobuf.a: linker input file unused because linking not done
ntoaarch64-c++-5.4.0: warning: ./.libs/libprotoc.a: linker input file unused because linking not done
ntoaarch64-c++-5.4.0: warning: /root/google/protobuf-3.5.1/qnx_build/src/.libs/libprotobuf.a: linker input file unused because linking not done

Any work around this ?

@xuwenping
Copy link

@bosssaurav
I have not encountered this error,
I run this command:
./configure CFLAGS='-fPIC' CXXFLAGS='-fPIC' --prefix=/home/xuwenping/qnx700/protobuf --host=aarch64-unknown-nto-qnx7.0.0 --build=i686-pc-linux CC=/home/xuwenping/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc CXX=/home/xuwenping/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-g++ CPPFLAGS='-D_XOPEN_SOURCE=500'
then execute: make and make install, can genereate .so and .a

@jtattermusch jtattermusch changed the title Unable to Compile Protobuf for aarch64 Unable to Compile Protobuf for QNX aarch64 Jun 25, 2021
@jtattermusch
Copy link
Contributor

was this fixed by #8637?

@deannagarcia
Copy link
Member

Closing due to no response, feel free to reopen if you are still seeing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants