You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To provide some context, we are building a memory management framework written in Rust. We are experimenting with different malloc/free implementations.
We tried the following two approaches of linking with tcmalloc.
First, we tried to statically link with tcmalloc. We use the libtcmalloc.lo produced by bazel build tcmalloc.
We got the following error.
Error: failed <executable> because /path/to/OurLibrary.so: undefined symbol: _ZN8tcmalloc17tcmalloc_internal10Parameters23per_cpu_caches_enabled_E
Second, we tried to dynamically link with tcmalloc. Specifically, we deleted linkstatic=1 (https://github.com/google/tcmalloc/blob/f4a573f/tcmalloc/BUILD#L91) and used libtcmalloc.so produced by Bazel.
We got the following error when run our executable linked with tcmalloc.
Error: failed <executable> because /path/to/libtcmalloc.so: undefined symbol: _ZN4absl19str_format_internal13FormatArgImpl8DispatchINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEbNS1_4DataENS0_24FormatConversionSpecImplEPv
We are just wondering what the best practice of using tcmalloc standalone is (ODR is not a big issue for us as the project is in Rust #16#48).
_ZN8tcmalloc17tcmalloc_internal10Parameters23per_cpu_caches_enabled_E is defined in the //tcmalloc:common target. _ZN4absl19str_format_internal13FormatArgImpl8DispatchINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEbNS1_4DataENS0_24FormatConversionSpecImplEPv is defined by one of the libraries provided by Abseil.
I think the issue here is that the build isn't linking against all of the dependencies.
@ckennelly Thanks for the reply! Do you have any recommendation on how we can go about producing a standalone library for our use case (presumably by changing the BUILD file)? Sorry, I'm not familiar enough with Bazel.
To provide some context, we are building a memory management framework written in Rust. We are experimenting with different malloc/free implementations.
We tried the following two approaches of linking with tcmalloc.
First, we tried to statically link with tcmalloc. We use the
libtcmalloc.lo
produced bybazel build tcmalloc
.We got the following error.
Second, we tried to dynamically link with tcmalloc. Specifically, we deleted
linkstatic=1
(https://github.com/google/tcmalloc/blob/f4a573f/tcmalloc/BUILD#L91) and usedlibtcmalloc.so
produced by Bazel.We got the following error when run our executable linked with tcmalloc.
We are just wondering what the best practice of using tcmalloc standalone is (ODR is not a big issue for us as the project is in Rust #16 #48).
cc @caizixian
The text was updated successfully, but these errors were encountered: