Protobuf: build only c++ (protoc)

Created on 29 Aug 2015  路  7Comments  路  Source: protocolbuffers/protobuf

Is there a way to only build protoc, not the java or python systems?

Most helpful comment

The above Readme specified in the link builds protoc with all the java and other language compilers, along with c++.
Is there any way to just build protoc cpp compiler?

All 7 comments

Follow instructions here to build protoc (and also proto C++ runtime):
https://github.com/google/protobuf/blob/master/README.md

The above Readme specified in the link builds protoc with all the java and other language compilers, along with c++.
Is there any way to just build protoc cpp compiler?

Actually, build instructions say:

For example: if you only need C++, download protobuf-cpp-[VERSION].tar.gz; if you need C++ and Java, download protobuf-java-[VERSION].tar.gz (every package contains C++ source already); if you need C++ and multiple other languages, download protobuf-all-[VERSION].tar.gz.

Is there any insight into how the protobuf-cpp-[VERSION].tar.gz is constructed?

@sciencemanx If I remember right that comes from running make dist and then the post_process_dist.sh script.

I answered to my own question on stackoverflow about how to do this. Even though it is quite a rudimentary solution (grep + remove), it does work and compile quite faster. Check the link

@xfxyjwf why is this issue closed?

Following the exact instructions from your link will still build for all languages, not just C++

set -ex \
    && yum update -y \
    && yum install -y \
        autoconf \
        automake \
        g++ \
        git \
        glibc-headers \
        gzip \
        libtool \
        make \
        zlib-devel \
    && curl -Lo /opt/protobuf.tar.gz \
        "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz" \
    && tar -xzvf protobuf.tar.gz \
    && rm -f protobuf.tar.gz \
    && pushd "protobuf-${PROTOBUF_VERSION}" \
    && ./configure --with-zlib --disable-debug \
    && make \
    && make install \
    && ldconfig --verbose \
    && popd \
    && rm -rf "protobuf-${PROTOBUF_VERSION}" \
    && protoc --version \
    && pkg-config --cflags protobuf \
    && pkg-config --libs protobuf
Was this page helpful?
0 / 5 - 0 ratings