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

Bazel build #174

Merged
merged 5 commits into from
Jan 18, 2017
Merged

Bazel build #174

merged 5 commits into from
Jan 18, 2017

Conversation

teodor-pripoae
Copy link
Contributor

Hi,

I've added Bazel config files to allow reproductible builds. I tested them on OS X and Linux (Ubuntu).

When building using Bazel, it will download all required dependencies and will compile static binaries for host platform.

To build sofa-pbrpc-client, run:

$ bazel build sofa-pbrpc-client

To build examples:

$ bazel build sample/compress_sample:server
$ bazel build sample/compress_sample:client

$ bazel-bin/sample/compress_sample/server
$ bazel-bin/sample/compress_sample/client

@cyshi
Copy link
Collaborator

cyshi commented Dec 28, 2016

@zd-double @qinzuoyan

@cyshi
Copy link
Collaborator

cyshi commented Dec 28, 2016

Thanks for your pr, very convenience.

@teodor-pripoae
Copy link
Contributor Author

I'm still having a small problem with boost libs, it seems I can't include them as header only libs, I need to compile them into a static .a. I will fix it later today.

@teodor-pripoae
Copy link
Contributor Author

Fixed compiling boost files.

@zd-double
Copy link
Collaborator

zd-double commented Dec 30, 2016

@teodor-pripoae Thanks very much for your code ! I build successfully on Ubuntu12.04, but failed on centos7.3

ERROR: /root/code/sofa-pbrpc/BUILD:34:1: C++ compilation of rule '//:sofa-pbrpc' failed: process-wrapper failed: error executing command /root/.cache/bazel/_bazel_root/4bb7f7aaaf8e6e59126eced3ac1ea215/execroot/sofa-pbrpc/_bin/process-wrapper -1 5 - - /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall ... (remaining 77 argument(s) skipped).
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux/bits/os_defines.h:39:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux/bits/c++config.h:2097,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/utility:68,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/algorithm:60,
                 from src/sofa/pbrpc/rpc_client_impl.cc:5:

gcc version: 4.8.5
kernel: 2.6.32

Thanks :)

@teodor-pripoae
Copy link
Contributor Author

Can you send me the full output of bazel build please ?

I succesfully built it on centos 7.3 inside docker, using the following Dockerfile for bazel:

FROM centos:7.3.1611

# Build tools
RUN yum install gcc gcc-c++ kernel-devel wget unzip zlib-devel zip \
    git automake cmake patch libtool which glibc-static libstdc++-static \
    java-1.8.0-openjdk-devel

# Bazel
RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/0.4.2/bazel-0.4.2-installer-linux-x86_64.sh && \
    chmod +x /tmp/bazel.sh && \
    /tmp/bazel.sh

@zd-double
Copy link
Collaborator

@teodor-pripoae I found it's something wrong with my build environment and I succesfully built now. Thanks.
I find there's no bazel BUILD file in unit-test and test, would you mind adding these in this pr? :)

@teodor-pripoae
Copy link
Contributor Author

teodor-pripoae commented Jan 3, 2017

I've added build file for unit-test, for test I will try in the following days. I tried using cc_test macros from bazel but there is an issue with protobuf beeing registered multiple times, so I've made a script to build and run the tests.

I will try to find a solution later this week.

@cyshi
Copy link
Collaborator

cyshi commented Jan 16, 2017

Can we merge this pull request first? @zd-double @qinzuoyan @bluebore

@cyshi cyshi merged commit 636920b into baidu:master Jan 18, 2017
@teodor-pripoae teodor-pripoae deleted the bazel-build branch February 17, 2017 20:52
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

Successfully merging this pull request may close these issues.

4 participants