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

Building grpc-java on POWER8 #2487

Closed
bbelgodere opened this issue Dec 6, 2016 · 5 comments
Closed

Building grpc-java on POWER8 #2487

bbelgodere opened this issue Dec 6, 2016 · 5 comments

Comments

@bbelgodere
Copy link

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
@ejona86
Copy link
Member

ejona86 commented Dec 6, 2016

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
Copy link
Author

bbelgodere commented Dec 6, 2016

@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
Copy link
Member

ejona86 commented Dec 7, 2016

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
Copy link
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
Copy link
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>

@ejona86 ejona86 closed this as completed Dec 18, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants