lightseq icon indicating copy to clipboard operation
lightseq copied to clipboard

error in compilation: can't import protobuf header file when protobuf is installed in a different location.

Open frankang opened this issue 2 years ago • 2 comments

Protobuf is installed under the folder /usr/local/protobuf, I manually set the CMAKE_PREFIX_PATH environment variable in the lightseq/inference/proto/CMakeLists.txt file to include the above installation path. However I still get error during installation (error log pasted below). Could you suggest a way to adapt the code to this new protobuf location? Thanks.

-- Build using fp16 precision
-- pybind11 v2.5.0
-- Found Protobuf: /usr/local/protobuf/lib/libprotobuf.a;-lpthread (found version "3.19.1")
-- Found CUDAToolkit: /usr/local/cuda-11.6/include (found version "11.6.124")
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success

.... (omitted)

[ 74%] Building CUDA object lightseq/inference/model/CMakeFiles/moe_model.dir/moe_encoder.cc.cu.o
In file included from /root/lightseq/lightseq/inference/model/vit_encoder.h:15,
                 from /root/lightseq/lightseq/inference/model/vit_encoder.cc.cu:1:
/root/lightseq/lightseq/inference/model/../proto/vit_weight.h:4:10: fatal error: google/protobuf/io/zero_copy_stream.h: No such file or directory
 #include <google/protobuf/io/zero_copy_stream.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /root/lightseq/lightseq/inference/model/moe_encoder.h:15,
                 from /root/lightseq/lightseq/inference/model/moe_encoder.cc.cu:1:
/root/lightseq/lightseq/inference/model/../proto/moe_weight.h:4:10: fatal error: google/protobuf/io/zero_copy_stream.h: No such file or directory
 #include <google/protobuf/io/zero_copy_stream.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

frankang avatar Apr 26 '22 09:04 frankang

You can try to reinstall protobuf and make sure to set CXXFLAGS:

curl -O -L -C - https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protobuf-cpp-3.13.0.tar.gz tar xf protobuf-cpp-3.13.0.tar.gz cd protobuf-3.13.0 && ./autogen.sh ./configure "CFLAGS=-fPIC" "CXXFLAGS=-fPIC" make -j && make install && ldconfig && cd .. && rm -rf protobuf-3.13.0

neopro12 avatar May 30 '22 07:05 neopro12

You can try to reinstall protobuf and make sure to set CXXFLAGS:

curl -O -L -C - https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protobuf-cpp-3.13.0.tar.gz tar xf protobuf-cpp-3.13.0.tar.gz cd protobuf-3.13.0 && ./autogen.sh ./configure "CFLAGS=-fPIC" "CXXFLAGS=-fPIC" make -j && make install && ldconfig && cd .. && rm -rf protobuf-3.13.0

Thanks,protubuf is installed with "CXXFLAGS=-fPIC" enabled. The above error happens after protobuf is configured to install in a different location.

frankang avatar Jun 08 '22 11:06 frankang