You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2021/05/02 07:33:12 UTC

[GitHub] [incubator-brpc] yuan-luo opened a new issue #1392: brpc编译错误

yuan-luo opened a new issue #1392:
URL: https://github.com/apache/incubator-brpc/issues/1392


   **Describe the bug (描述bug)**
   按照文档编译brpc
   https://github.com/apache/incubator-brpc/blob/master/docs/cn/getting_started.md
   但是发生如下错误:
   
   ```
   yluo@ubuntu:~/incubator-brpc$ sh config_brpc.sh --headers=/usr/include --libs=/usr/lib
   yluo@ubuntu:~/incubator-brpc$ make
   > Linking protoc-gen-mcpack
   g++ -o protoc-gen-mcpack -I./src -I/usr/include/ -L/usr/lib/x86_64-linux-gnu -std=c++0x -Xlinker "-(" src/idl_options.pb.cc src/mcpack2pb/generator.o libbrpc.a -Wl,-Bstatic -lgflags -lprotobuf -lleveldb -lsnappy -lprotoc -Wl,-Bdynamic -Xlinker "-)" -lpthread -lssl -lcrypto -ldl -lz -lrt
   /usr/bin/ld: libbrpc.a(logging.o): in function `_GLOBAL__sub_I_logging.cc':
   /home/yluo/incubator-brpc/src/butil/logging.cc:23: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: libbrpc.a(logging.o): in function `__static_initialization_and_destruction_0':
   /home/yluo/incubator-brpc/src/butil/logging.cc:119: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: /home/yluo/incubator-brpc/src/butil/logging.cc:121: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: /home/yluo/incubator-brpc/src/butil/logging.cc:124: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: /home/yluo/incubator-brpc/src/butil/logging.cc:126: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: libbrpc.a(logging.o):/home/yluo/incubator-brpc/src/butil/logging.cc:132: more undefined references to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)' follow
   /usr/bin/ld: /tmp/ccBHCVLX.o: in function `ConvertibleIdlType_descriptor()':
   idl_options.pb.cc:(.text+0x26): undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'
   /usr/bin/ld: /tmp/ccBHCVLX.o: in function `__static_initialization_and_destruction_0(int, int)':
   idl_options.pb.cc:(.text+0xc7): undefined reference to `google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)'
   /usr/bin/ld: /tmp/ccBHCVLX.o:(.data.rel.ro+0x0): undefined reference to `descriptor_table_google_2fprotobuf_2fdescriptor_2eproto'
   collect2: error: ld returned 1 exit status
   make: *** [Makefile:241: protoc-gen-mcpack] Error 1
   
   ```
   
   **To Reproduce (复现方法)**
   
   ```
   yluo@ubuntu:~$ sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev
   Reading package lists... Done
   Building dependency tree       
   Reading state information... Done
   g++ is already the newest version (4:9.3.0-1ubuntu2).
   libleveldb-dev is already the newest version (1.22-3ubuntu2).
   libprotobuf-dev is already the newest version (3.6.1.3-2ubuntu5).
   libprotoc-dev is already the newest version (3.6.1.3-2ubuntu5).
   make is already the newest version (4.2.1-1.2).
   libgflags-dev is already the newest version (2.2.2-1build1).
   protobuf-compiler is already the newest version (3.6.1.3-2ubuntu5).
   git is already the newest version (1:2.25.1-1ubuntu3.1).
   libssl-dev is already the newest version (1.1.1f-1ubuntu2.3).
   0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
   
   yluo@ubuntu:~$ sudo apt-get install -y libsnappy-dev
   Reading package lists... Done
   Building dependency tree       
   Reading state information... Done
   libsnappy-dev is already the newest version (1.1.8-1build1).
   0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
   
   yluo@ubuntu:~$ sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd -
   Reading package lists... Done
   Building dependency tree       
   Reading state information... Done
   cmake is already the newest version (3.16.3-1ubuntu1).
   libgtest-dev is already the newest version (1.10.0-2).
   0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
   CMake Warning at CMakeLists.txt:54 (project):
     VERSION keyword not followed by a value or was followed by a value that
     expanded to nothing.
   -- Configuring done
   -- Generating done
   -- Build files have been written to: /usr/src/googletest/googletest
   [ 50%] Built target gtest
   [100%] Built target gtest_main
   mv: cannot stat 'libgtest*': No such file or directory
   yluo@ubuntu:/usr/src/gtest$ cd -
   /home/yluo
   
   yluo@ubuntu:~/incubator-brpc$ sh config_brpc.sh --headers=/usr/include --libs=/usr/lib
   yluo@ubuntu:~/incubator-brpc$ make
   > Linking protoc-gen-mcpack
   g++ -o protoc-gen-mcpack -I./src -I/usr/include/ -L/usr/lib/x86_64-linux-gnu -std=c++0x -Xlinker "-(" src/idl_options.pb.cc src/mcpack2pb/generator.o libbrpc.a -Wl,-Bstatic -lgflags -lprotobuf -lleveldb -lsnappy -lprotoc -Wl,-Bdynamic -Xlinker "-)" -lpthread -lssl -lcrypto -ldl -lz -lrt
   /usr/bin/ld: libbrpc.a(logging.o): in function `_GLOBAL__sub_I_logging.cc':
   /home/yluo/incubator-brpc/src/butil/logging.cc:23: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: libbrpc.a(logging.o): in function `__static_initialization_and_destruction_0':
   /home/yluo/incubator-brpc/src/butil/logging.cc:119: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: /home/yluo/incubator-brpc/src/butil/logging.cc:121: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: /home/yluo/incubator-brpc/src/butil/logging.cc:124: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: /home/yluo/incubator-brpc/src/butil/logging.cc:126: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
   /usr/bin/ld: libbrpc.a(logging.o):/home/yluo/incubator-brpc/src/butil/logging.cc:132: more undefined references to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)' follow
   /usr/bin/ld: /tmp/ccBHCVLX.o: in function `ConvertibleIdlType_descriptor()':
   idl_options.pb.cc:(.text+0x26): undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'
   /usr/bin/ld: /tmp/ccBHCVLX.o: in function `__static_initialization_and_destruction_0(int, int)':
   idl_options.pb.cc:(.text+0xc7): undefined reference to `google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)'
   /usr/bin/ld: /tmp/ccBHCVLX.o:(.data.rel.ro+0x0): undefined reference to `descriptor_table_google_2fprotobuf_2fdescriptor_2eproto'
   collect2: error: ld returned 1 exit status
   make: *** [Makefile:241: protoc-gen-mcpack] Error 1
   
   
   ```
   
   **Expected behavior (期望行为)**
   编译正确
   
   **Versions (各种版本)**
   OS: Ubuntu 20.04.2 LTS \n \l
   Compiler: gcc version 9.3.0
   brpc: master
   protobuf: 
   libprotobuf-dev is already the newest version (3.6.1.3-2ubuntu5).
   libprotoc-dev is already the newest version (3.6.1.3-2ubuntu5).
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] namelij commented on issue #1392: brpc编译错误

Posted by GitBox <gi...@apache.org>.
namelij commented on issue #1392:
URL: https://github.com/apache/incubator-brpc/issues/1392#issuecomment-851333322


   按照提示,编译时候,需要指定gflags gtest库


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] sangli00 commented on issue #1392: brpc编译错误

Posted by GitBox <gi...@apache.org>.
sangli00 commented on issue #1392:
URL: https://github.com/apache/incubator-brpc/issues/1392#issuecomment-1085476562


   老哥,问题解决了吗


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] lorinlee commented on issue #1392: brpc编译错误

Posted by GitBox <gi...@apache.org>.
lorinlee commented on issue #1392:
URL: https://github.com/apache/incubator-brpc/issues/1392#issuecomment-867626524


   看到是用了master,不过这边在ubuntu20.04的docker容器中并没有复现出来,是不是本地装了其他版本的gflags库?你可以用docker环境尝试编译一下吗,排除下是本地环境的问题


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] lorinlee commented on issue #1392: brpc编译错误

Posted by GitBox <gi...@apache.org>.
lorinlee commented on issue #1392:
URL: https://github.com/apache/incubator-brpc/issues/1392#issuecomment-867619622


   请问brpc是用了哪个版本


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org