-
Notifications
You must be signed in to change notification settings - Fork 509
How to use static library artifacts in another build system #48
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
Comments
Side point: If you're using Bazel for the TCMalloc build, https://github.com/bazelbuild/buildtools/tree/master/buildozer can help with manipulations of the I think the issue is that TCMalloc is comprised of multiple libraries which ordinarily all get pulled in by statically linking the main TCMalloc target. Most of this is an implementation detail, for ease of testing ( The broader issue, though, is with a fully static |
Ah, I see. Thank you for the explanation. There are pros and cons of depending on third party libraries, I guess. I was hoping to use this version in some projects I'm working on, but I can continue to use the latest version from gperftools since my projects use autotools for building. How is this tcmalloc different from the one that's included in gperftools? Is the one in gperftools planned to be EOL'd? Does this tcmalloc have API changes or maybe more recent cleanup/performance work that the one in gperftools doesn't have? |
gperftools was released by Google as Google Performance Tools many years ago. It diverged from Google's internal version--at the time, it was hard to keep things in-sync as described by Titus Winters in his 2017 CppCon talk and the "Software Engineering at Google Book"--and ended up being adopted by the community. There's further background here. This version follows the one used in Google production and has a number of new features and optimizations. |
Why didn't I Google that? :D Long day after work maybe. Thank you so much for the help and fast response here. We might want to revisit trying to get this version of tcmalloc into our projects again, perhaps by spending time to contribute an Abesil-like CMake build as discussed in #4. As far as I'm concerned, this can be closed from my end. I think I have everything I need for now. |
Hi, @ckennelly Can you comment on the performance impact on single-threaded benchmarks (such as SPEC2006, SPEC2017) of these two tcmalloc versions (i.e. tcmalloc in gperftools and the newer git-tcmalloc)? There are a couple of SPEC benchmarks that benefit noticeably from tcmalloc. Does the newer tcmalloc have significant advantage over gperftools tcmallocs on these single-threaded use cases? Thanks |
I am attempting to create a static redistributable libtcmalloc.a with the Bazel build so that the library may be brought into a different build system via the -I and -L options to gcc, but I'm not having much luck.
I can coerce Bazel to produce static libraries for everything by running from the root of the repo directory (hacky, and probably slightly wrong):
But when I run on the libtcmalloc.a that is produced:
I only see tcmalloc.pic.o. If I compare this to the libtcmalloc_minimal.a that is produced from gperftools, I see a number of additional object files; which is more along the lines of what I was epxecting.
I've also written a rough CMake build with the help of a bazel-to-cmake conversation tool, and I saw the same problem with the produced libtcmalloc.a as well.
What would be the recommended way to handle this while also accounting for tcmalloc's new dependency on Abseil? Or is there maybe a Bazel option I'm missing? I'm interested in statically linking everything, and ideally, libtcmalloc.a would include all objects that are needed for it to be consumed by another program and not get
undefined reference to 'tcmalloc::Static::transfer_cache_'
for example during the linking stage.The text was updated successfully, but these errors were encountered: