Skip to content

Building grpc-java on POWER8 #2487

Closed
Closed
@bbelgodere

Description

@bbelgodere

Please answer these questions before submitting your issue.

What version of gRPC are you using?

v0.15.0

What JVM are you using (java -version)?

openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)

What did you do?

Install protoc to /opt/share

If possible, provide a recipe for reproducing the error.
cd /tmp
git clone https://github.com/google/protobuf.git && cd protobuf
git checkout v3.1.0
./autogen.sh
./configure --prefix=/opt/share/protobuf/ppc64le/
make && make install
export PATH=/opt/share/protobuf/ppc64le/bin/:$PATH
export LD_LIBRARY_PATH=/opt/share/protobuf/ppc64le/lib/:$LD_LIBRARY_PATH

Install grpc-java

cd tmp
git clone https://github.com/grpc/grpc-java.git && cd grpc-java
export CXXFLAGS="-I/opt/share/protobuf/ppc64le/include"
./gradlew build

What did you expect to see?

Build Successful

What did you see instead?

:grpc-compiler:compileJava_pluginExecutableJava_pluginCpp/tmp/src/grpc-java/compiler/src/java_plugin/cpp/java_generator.cpp:7:54: fatal error: google/protobuf/compiler/java/java_names.h: No such file or directory
#include <c>

even though

ls -la /opt/share/protobuf/ppc64le/include/google/protobuf/compiler/java/
total 12
drwxr-xr-x  2 bmbelgod users   48 Dec  1 22:06 .
drwxr-xr-x 11 bmbelgod users 4096 Dec  1 22:06 ..
-rw-r--r--  1 bmbelgod users 2945 Dec  1 22:06 java_generator.h
-rw-r--r--  1 bmbelgod users 2931 Dec  1 22:06 java_names.h

Activity

ejona86

ejona86 commented on Dec 6, 2016

@ejona86
Member

Hmm... That's strange. You can debug the build a little bit by running ./gradlew :grpc-compiler:assemble --info. It will show that g++ is being passed arguments via a file. The file should probably be compiler/build/tmp/compileJava_pluginExecutableJava_pluginCpp/options.txt. Normally the file is deleted, but if the build fails it is left in-place for debugging. Do the contents of options.txt include the -I?

bbelgodere

bbelgodere commented on Dec 6, 2016

@bbelgodere
Author

@ejona86 Now getting another error. started with a fresh install of Master. v1.0.2 throws an architecture error.

# Run ====================================================================================
cd /tmp                                                                                                                                 
git clone https://github.com/grpc/grpc-java.git && cd grpc-java                                                                                                                    
export CXXFLAGS="-I/opt/share/protobuf/ppc64le/include -L/opt/share/protobuf/ppc64le/lib/"                                              
export PROTOC=/opt/share/protobuf/ppc64le/bin/protoc                                                                                    
./gradlew                                                                                                                               
./gradlew :grpc-compiler:assemble --info
# Output ====================================================================================
Successfully started process 'command '/opt/share/gcc-6.2.0/ppc64le/bin/g++''
/usr/bin/ld: cannot find -lprotoc
/usr/bin/ld: cannot find -lprotobuf

Execution failed for task ':grpc-compiler:linkJava_pluginExecutable'
> A build operation failed.
    Linker failed while linking protoc-gen-grpc-java.
# options.txt ============================================================================== 
cat grpc-java/compiler/build/tmp/compileJava_pluginExecutableJava_pluginCpp/options.txt
-x
c++
-c
-DGRPC_VERSION=1.1.0-SNAPSHOT
--std=c++0x
-I/opt/share/protobuf/ppc64le/include
-I
/tmp/grpc-java/compiler/src/java_plugin/headers
echo $LD_LIBRARY_PATH
/opt/share/gcc-6.2.0/ppc64le/lib64/:/opt/share/gcc-6.2.0/ppc64le/lib64/:/opt/share/protobuf/ppc64le/lib/:/opt/share/leveldb/ppc64le/lib/:/opt/share/boost/ppc64le/lib/:/opt/share/torch/ppc64le/install/lib:/opt/share/Python-2.7.12/ppc64le/lib:/opt/share/cuDNN-v5.1-8/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64
ejona86

ejona86 commented on Dec 7, 2016

@ejona86
Member

You should also specify LDFLAGS. Something like -L/opt/share/protobuf/ppc64le/lib. LD_LIBRARY_PATH is used during protoc execution, LDFLAGS is used during our plugin linking.

bbelgodere

bbelgodere commented on Dec 7, 2016

@bbelgodere
Author

@ejona86 Options being passed now look correct but running into a new error

# Run ====================================================================================
cd /tmp                                                                                                                                 
git clone https://github.com/grpc/grpc-java.git && cd grpc-java                                                                                                                    
export CXXFLAGS="-I/opt/share/protobuf/ppc64le/include -L/opt/share/protobuf/ppc64le/lib/"                                              
export LDFLAGS="-L/opt/share/protobuf/ppc64le/lib"
export PROTOC=/opt/share/protobuf/ppc64le/bin/protoc                                                                                    
./gradlew                                                                                                                               
./gradlew :grpc-compiler:assemble --info

Options being passed now look good.

# options.txt ==============================================================================
cat /tmp/grpc-java/compiler/build/tmp/compileJava_pluginExecutableJava_pluginCpp/options.txt
-x
c++
-c
-DGRPC_VERSION=1.1.0-SNAPSHOT
--std=c++0x
-I/opt/share/protobuf/ppc64le/include
-L/opt/share/protobuf/ppc64le/lib/
-I
/tmp/grpc-java/compiler/src/java_plugin/headers

Now getting a new Error

/tmp/grpc-java/compiler/build/objs/java_plugin/java_pluginCpp/7alcwmgsqxy5urerrz0jkdez0/java_plugin.o:(.data.rel.ro._ZTV17JavaGrpcGenerator[_ZTV17JavaGrpcGenerator]+0x28): undefined reference to `google::protobuf::compiler::CodeGenerator::GenerateAll(std::vector<google::protobuf::FileDescriptor const*, std::allocator<google::protobuf::FileDescriptor const*> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::compiler::GeneratorContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const'
collect2: error: ld returned 1 exit status

Finished linkJava_pluginExecutable, see full log file:///tmp/grpc-java/compiler/build/tmp/linkJava_pluginExecutable/output.txt.
:grpc-compiler:linkJava_pluginExecutable FAILED
:grpc-compiler:linkJava_pluginExecutable (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.347 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':grpc-compiler:linkJava_pluginExecutable'.
> A build operation failed.
      Linker failed while linking protoc-gen-grpc-java.
npanpaliya

npanpaliya commented on Dec 8, 2016

@npanpaliya
Contributor

grpc-java 15.0 needs protobuf v3.0.0-beta-3. I think that is the cause of the issue you are seeing. Please try with protobuf v3.0.0-beta-3.
Then for grpc-java, export CXXFLAGS to include folder where protobuf headers are installed and LDFLAGS to protobuf's libs folder.
To build grpc-java, run below command -
./gradlew build -Pprotoc=<path/to/protoc binary>

locked as resolved and limited conversation to collaborators on Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bbelgodere@ejona86@npanpaliya

        Issue actions

          Building grpc-java on POWER8 · Issue #2487 · grpc/grpc-java