Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cyber_core should not link gflag/glog/protobuf in linkopts directly. #7797

Closed
luozhaohui opened this issue Apr 11, 2019 · 1 comment
Closed
Labels
Module: Build Indicates build related issues

Comments

@luozhaohui
Copy link

Program crashed
Program crashed because it linked to protobufes of different version.

 ldd box2d_test | grep "protobuf"
	libcyber_Smessage_Slibprotobuf_Ufactory.so => ~/.cache/bazel/_bazel_kesalin/14989fc4d6cc893e257bf3ebcca40484/execroot/gs_cyber/bazel-out/k8-fastbuild/bin/modules/common/math/./../../../_solib_k8/libcyber_Smessage_Slibprotobuf_Ufactory.so (0x00007f28c755b000)
	libexternal_Scom_Ugoogle_Uprotobuf_Slibprotobuf.so => ~/.cache/bazel/_bazel_kesalin/14989fc4d6cc893e257bf3ebcca40484/execroot/gs_cyber/bazel-out/k8-fastbuild/bin/modules/common/math/./../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Slibprotobuf.so (0x00007f28c689c000)
	libexternal_Scom_Ugoogle_Uprotobuf_Slibprotobuf_Ulite.so => ~/.cache/bazel/_bazel_kesalin/14989fc4d6cc893e257bf3ebcca40484/execroot/gs_cyber/bazel-out/k8-fastbuild/bin/modules/common/math/./../../../_solib_k8/libexternal_Scom_Ugoogle_Uprotobuf_Slibprotobuf_Ulite.so (0x00007f28c67f9000)
	libprotobuf.so.13 => /usr/local/lib/libprotobuf.so.13 (0x00007f28c6261000)
	libprotobuf.so.9 => /usr/lib/x86_64-linux-gnu/libprotobuf.so.9 (0x00007f28c3c96000)

Environment
1, Build apollo(master branch) without docker.
2, Have different protobufes installed.

Solution
Build target 'cyber_core' should not link gflag/glog/protobuf in linkopts directly:
file: cyber/BUILD

    linkopts = [
        "-lglog",
        "-lgflags",
        "-lprotobuf",
        "-luuid",
    ],

Please add them in 'deps'.
file: cyber/BUILD

    deps = [
        "@fastrtps",
        "@gflags",
        "@glog",
        "@com_google_protobuf//:protobuf",
    ],
@muleisheng
Copy link
Contributor

This may have some problems if version of -lprotobuf and "@com_google_protobuf//:protobuf" are different. Thanks

@Zhenni17 Zhenni17 added the Module: Build Indicates build related issues label Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module: Build Indicates build related issues
Projects
None yet
Development

No branches or pull requests

3 participants