Tencent / flare

Flare是广泛投产于腾讯广告后台的现代化C++开发框架,包含了基础库、RPC、各种客户端等。主要特点为易用性强、长尾延迟低。
Other
1.33k stars 200 forks source link

调试相关 #145

Closed yinghaoyu closed 10 months ago

yinghaoyu commented 10 months ago

直接运行./blade-bin/flare/rpc/server_group_test会提示缺少动态库,通过blade build ...编译生成的二进制文件需要怎么调试啊?

0x804d8000 commented 10 months ago

cc_binary应该可以直接运行。

cc_test一般是blade test的。blade test之后会在./blade-bin/flare/rpc/server_group_test.runfiles里面建立好环境,进入这个目录然后把LD_LIBRARY_PATH指向.就可以运行这个test了,比如通过../server_group_test运行。

chen3feng commented 10 months ago

为了减少存储空间消耗,cc_test默认是动态链接的,通过test子命令运行时会提前设置环境。直接单独运行会因为找不到动态库路径而失败。可以加上dynamic_link=False强制指定静态链接。

On Fri, Jan 5, 2024, 23:31 Luo Bo @.***> wrote:

cc_binary应该可以直接运行。

cc_test一般是blade test的。blade test之后会在./blade-bin/flare/rpc/server_group_test.runfiles里面建立好环境,进入这个目录然后把LD_LIBRARY_PATH指向.就可以运行这个test了,比如通过../server_group_test运行。

— Reply to this email directly, view it on GitHub https://github.com/Tencent/flare/issues/145#issuecomment-1878854781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPH4SULXYXBNIRJ2EPHOHLYNAMFXAVCNFSM6AAAAABBOEBTVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZYHA2TINZYGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

yinghaoyu commented 10 months ago

谢谢二位。

答案补充,在flare/rpc/BUILD文件中,给具体的测试用例添加dynamic_link = False,如下:

cc_test(
  name = 'server_group_test',
  srcs = 'server_group_test.cc',
  deps = [
    ':rpc',
    ':server_group',
    '//flare/net/http:http_client',
    '//flare/rpc:server',
    '//flare/testing:echo_service_proto_flare',
    '//flare/testing:endpoint',
    '//flare/testing:main',
  ],
  dynamic_link = False
)

然后重新编译。