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

Turning off linkstatic = 1 does not produce dynamic libraries. #71

Closed
jaidayal opened this issue Feb 24, 2021 · 2 comments
Closed

Turning off linkstatic = 1 does not produce dynamic libraries. #71

jaidayal opened this issue Feb 24, 2021 · 2 comments

Comments

@jaidayal
Copy link

I followed the guidance listed here (#27) on how to build a static library. In the various BUILD files, I commented out the linkstatic = 1 lines, however, I can't find any .so files produced:

find tcmalloc/ -name *.so

Since I'm on a SLES 15 HPC cluster, I can't install packages through zypper/apt/yum (no root access) so I am not sure how I can generate a .so file.

@ckennelly
Copy link
Collaborator

Bazel places binaries in bazel-bin.

$ git diff | cat
diff --git a/tcmalloc/BUILD b/tcmalloc/BUILD
index 97e2f72..523d742 100644
--- a/tcmalloc/BUILD
+++ b/tcmalloc/BUILD
@@ -88,7 +88,6 @@ cc_library(
         "tcmalloc.h",
     ],
     copts = TCMALLOC_DEFAULT_COPTS,
-    linkstatic = 1,
     visibility = ["//visibility:public"],
     deps = tcmalloc_deps + [
         ":common",
$ bazel build //tcmalloc:tcmalloc
Starting local Bazel server and connecting to it...
INFO: Analyzed target //tcmalloc:tcmalloc (32 packages loaded, 442 targets configured).
INFO: Found 1 target...
Target //tcmalloc:tcmalloc up-to-date:
  bazel-bin/tcmalloc/libtcmalloc.lo
  bazel-bin/tcmalloc/libtcmalloc.so
INFO: Elapsed time: 19.190s, Critical Path: 5.23s
INFO: 108 processes: 108 processwrapper-sandbox.
INFO: Build completed successfully, 111 total actions
$ find bazel-bin/tcmalloc/ -name '*.so'
bazel-bin/tcmalloc/libtcmalloc.so

That said, the libtcmalloc.so will have further deps (like on Abseil), so those will need to be findable by the loader.

@karanaggarwal1994
Copy link

How to link abseil in tcmalloc.so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants