ptt / pttbbs

PTT BBS source code
GNU General Public License v2.0
1.11k stars 139 forks source link

unable to compile boardd / mand in debian:bookworm due to libgrpc29. #133

Open chhsiao1981 opened 7 months ago

chhsiao1981 commented 7 months ago
bbs@946d4dbea71b:~/pttbbs/daemon/boardd$ pmake clean all
rm -f boardc.o boardd.o convert.o article.o strings.o board_service_impl.o bbs++.o evbuffer.o board.pb.cc board.grpc.pb.cc board.pb.h board.grpc.pb.h board.pb.o board.grpc.pb.o boardc boardd
protoc -I. --cpp_out=. --grpc_out=. --plugin=protoc-gen-grpc=/usr/bin/grpc_cpp_plugin board.proto
ccache clang++ -g -Os -W -Wall -Wunused  -Wno-missing-field-initializers -Wno-address-of-packed-member -pipe -DBBSHOME='"/home/bbs"' -I../../include -Wno-invalid-source-encoding  -std=c++17 -I../.. -I. -Wno-unused-parameter  -c board.pb.cc
ccache clang++ -g -Os -W -Wall -Wunused  -Wno-missing-field-initializers -Wno-address-of-packed-member -pipe -DBBSHOME='"/home/bbs"' -I../../include -Wno-invalid-source-encoding  -std=c++17 -I../.. -I. -Wno-unused-parameter  -c board.grpc.pb.cc
ccache clang++ -g -Os -W -Wall -Wunused  -Wno-missing-field-initializers -Wno-address-of-packed-member -pipe -DBBSHOME='"/home/bbs"' -I../../include -Wno-invalid-source-encoding  -std=c++17 -I../.. -I. -Wno-unused-parameter  -c boardc.cpp
ccache clang++ -g -Os -W -Wall -Wunused  -Wno-missing-field-initializers -Wno-address-of-packed-member -pipe -DBBSHOME='"/home/bbs"' -I../../include -Wno-invalid-source-encoding  -std=c++17 -I../.. -I. -Wno-unused-parameter -o boardc board.pb.o board.grpc.pb.o boardc.o -Os -Wl,--as-needed  ../../util/util_var.o  ../../common/bbs/libcmbbs.a  ../../common/sys/libcmsys.a  ../../common/osdep/libosdep.a  -levent   -pthread -lstdc++  -lgrpc++ -lprotobuf -lgflags
/usr/bin/ld: board.grpc.pb.o: undefined reference to symbol 'gpr_log'
/usr/bin/ld: /lib/x86_64-linux-gnu/libgpr.so.29: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
bmake: stopped in /home/bbs/pttbbs/daemon/boardd
bbs@946d4dbea71b:~/pttbbs/daemon/boardd$ dpkg -l|grep grpc
ii  libgrpc++-dev:amd64             1.51.1-3+b1                    amd64        high performance general RPC framework (development)
ii  libgrpc++1.51:amd64             1.51.1-3+b1                    amd64        high performance general RPC framework
ii  libgrpc-dev:amd64               1.51.1-3+b1                    amd64        high performance general RPC framework (development)
ii  libgrpc29:amd64                 1.51.1-3+b1                    amd64        high performance general RPC framework
ii  protobuf-compiler-grpc          1.51.1-3+b1                    amd64        high performance general RPC framework - protobuf plugin
bbs@946d4dbea71b:~/pttbbs/daemon/boardd$
chhsiao1981 commented 4 months ago

Can be resolved by adding -lgpr -labsl_synchronization

Need to check the side-effect after adding these flags though~

https://github.com/grpc/grpc/issues/36832

chhsiao1981 commented 4 months ago

A better configure for grpc/grpc++:

`pkg-config --libs protobuf grpc++`

https://github.com/grpc/grpc/blob/v1.30.2/examples/cpp/helloworld/Makefile https://github.com/grpc/grpc/blob/v1.51.1/examples/cpp/helloworld/Makefile