Skip to content

http_c++ example compile error #1759

@zengkui

Description

@zengkui

Describe the bug (描述bug)
centos 下完成brpc的编译后,编译echo_c++是正常的,但是编译http_c++的example的时候出现了编译错误,如下:

$make
> Compiling http_client.o
g++ -c -I/usr/include/ -I/usr/local/include/ -I../..//output/include -DBRPC_WITH_GLOG=1 -DGFLAGS_NS=google -D_GLIBCXX_USE_CXX11_ABI=0 -g -std=c++0x -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer -DBRPC_ENABLE_CPU_PROFILER http_client.cpp -o http_client.o
>Linking http_client
g++ -L/usr/lib64 -L/usr/local/lib -L/usr/local/lib64 -L../..//output/lib -Xlinker "-(" http_client.o -Wl,-Bstatic -lgflags -lglog -lbrpc -Wl,-Bdynamic -Xlinker "-)" -lpthread -lssl -lcrypto -ldl -lz -lrt -lprotobuf -lleveldb -o http_client
../..//output/lib/libbrpc.a(pprof_service.o): In function brpc::PProfService::profile(google::protobuf::RpcController*, brpc::ProfileRequest const*, brpc::ProfileResponse*, google::protobuf::Closure*)': /home/work/incubator-brpc-1.1.0/src/brpc/builtin/pprof_service.cpp:103: undefined reference to ProfilerStart'
/home/work/incubator-brpc-1.1.0/src/brpc/builtin/pprof_service.cpp:139: undefined reference to ProfilerStart' ../..//output/lib/libbrpc.a(hotspots_service.o): In function brpc::DoProfiling(brpc::ProfilingType, google::protobuf::RpcController*, google::protobuf::Closure*)':
/home/work/incubator-brpc-1.1.0/src/brpc/builtin/hotspots_service.cpp:732: undefined reference to ProfilerStart' /home/work/incubator-brpc-1.1.0/src/brpc/builtin/hotspots_service.cpp:749: undefined reference to ProfilerStart'
http_client.o: In function main': /home/work/incubator-brpc-1.1.0/example/http_c++/../..//output/include/brpc/details/profiler_linker.h:46: undefined reference to ProfilerStart'
collect2: error: ld returned 1 exit status
make: *** [http_client] Error 1

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本)
OS: centos
Compiler: gcc 4.8.5
brpc: 1.1.0
protobuf: 3.6.1
gflags: 2.1.1
glog : 0.6.0
cmake : 3.23.1

Additional context/screenshots (更多上下文/截图)

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

    Issue actions