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

Python package build fails with --cpp_implementation on ARM #5419

Closed
jskang94 opened this issue Dec 4, 2018 · 2 comments
Closed

Python package build fails with --cpp_implementation on ARM #5419

jskang94 opened this issue Dec 4, 2018 · 2 comments
Assignees

Comments

@jskang94
Copy link

jskang94 commented Dec 4, 2018

What version of protobuf and what language are you using?
Version: 3.6.1
Language: Python3

What operating system (Linux, Windows, ...) and version?
QEMU-emulated ARM docker image (on x86 linux host). resin/raspberrypi3-python:3.7-stretch

What runtime / compiler are you using (e.g., python version or gcc version)

$ python --version
Python 3.7.0
$ gcc --version
gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What did you do?
I downloaded protobuf 3.6.1 and tried to build Python package.

$ wget -O protobuf.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-python-3.6.1.tar.gz && tar xvf protobuf.tar.gz
$ cd protobuf-3.6.1
$ ./autogen.sh && ./configure
$ make && make install && ldconfig
$ cd python
$ python setup.py build --cpp_implementation

But this fails with

running build_ext
building 'google.protobuf.pyext._message' extension
creating build/temp.linux-armv7l-3.7
creating build/temp.linux-armv7l-3.7/google
creating build/temp.linux-armv7l-3.7/google/protobuf
creating build/temp.linux-armv7l-3.7/google/protobuf/pyext
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I../src -I/usr/local/include/python3.7m -c google/protobuf/pyext/message_factory.cc -o build/temp.linux-armv7l-3.7/google/protobuf/pyext/message_factory.o -Wno-write-strings -Wno-invalid-offsetof -Wno-sign-compare
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I../src -I/usr/local/include/python3.7m -c google/protobuf/pyext/extension_dict.cc -o build/temp.linux-armv7l-3.7/google/protobuf/pyext/extension_dict.o -Wno-write-strings -Wno-invalid-offsetof -Wno-sign-compare
google/protobuf/pyext/extension_dict.cc: In function ‘PyObject* google::protobuf::python::extension_dict::_FindExtensionByName(google::protobuf::python::ExtensionDict*, PyObject*)’:
google/protobuf/pyext/extension_dict.cc:56:45: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
        ((*(charpp) = PyUnicode_AsUTF8AndSize(ob, (sizep))) == NULL? -1: 0): \
                      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
google/protobuf/pyext/extension_dict.cc:184:7: note: in expansion of macro ‘PyString_AsStringAndSize’
   if (PyString_AsStringAndSize(arg, &name, &name_size) < 0) {
       ^~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1

You can try with this dockerfile.

FROM resin/raspberrypi3-python:3.7-stretch
WORKDIR /root

RUN apt-get update \
    && apt-get install -y \
        automake libtool libtool-bin \
    && wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-python-3.6.1.tar.gz \
        -O protobuf.tar.gz \
    && tar xvf protobuf.tar.gz \
    && rm protobuf.tar.gz \
    && cd protobuf-3.6.1 \
    && ./autogen.sh && ./configure \
    && make -j`grep -c ^processor /proc/cpuinfo` && make install \
    && ldconfig \
    && cd python \
    && python setup.py build --cpp_implementation \
    && python setup.py install \
    && cd /root \
    && rm -rf /root/protobuf-3.6.1 \
    && apt-get autoremove -y \
        automake libtool libtool-bin \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

What did you expect to see
Python protobuf package with --cpp_implementation

What did you see instead?
Build failure.

@acozzette acozzette self-assigned this Dec 4, 2018
@acozzette
Copy link
Member

This is an issue that's new with Python 3.7. #4862 fixes it on master but we need to create a new release with that fix.

@jskang94
Copy link
Author

jskang94 commented Dec 5, 2018

3.6.1.2 seems to be okay now. thanks!

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

No branches or pull requests

2 participants