How can I link a system library statically in Bazel? How can I link a system library statically in mostly static mode (linkstatic=1)? I tried to use "-Wl,-Bstatic -lboost_thread -Wl,-Bdynamic" or "-Wl,-Bstatic", "-lboost_thread", "-Wl,-Bdynamic", but none of them worked I don't want to hard code the path of libboost_thread a in the system
LibraryToLink - Bazel Whether to link the static library objects in the --whole_archive block dynamic_library
Practical Bazel: Depending on a System-Provided C C++ Library However, if we use cc_import to import libcurl and use a dependency, we can make linkstatic work as intended The main trick is to figure out how to reference the system-provided library This can be done with a little trick using an external repository using new_local_repository(), as follows: name = "libcurl", path = " usr",
LibraryToLink - Bazel 3. 6. 0 File LibraryToLink pic_static_library Artifact of pic static library to be linked May return None resolved_symlink_dynamic_library File LibraryToLink resolved_symlink_dynamic_library The resolved Artifact of the dynamic library to be linked if dynamic_library is a symlink, otherwise this is None May return None resolved_symlink_interface
C C++ Rules - Bazel For a C++ library, linkstatic=True indicates that only static linking is allowed, so no so will be produced linkstatic=False does not prevent static libraries from being created The attribute is meant to control the creation of dynamic libraries
gcc - Create a fully static C++ binary in Bazel - Stack Overflow The fully_static_link parameter adds the linkstatic and the -static to the linkopts which is why I didn't specify it above I've edited the question to show other versions of the build file (including explicit linkstatic and -shared )
c++ - Link archive to shared library with Bazel - Stack Overflow Using Bazel, I'd like to link a position independent static archive directly to a shared library (not to the application using the shared library) Something like: g++ -shared mylib cpp archive a -o
build a complete static library with some deps using bazel? A static library is not linked like a shared library (or an executable program), and doesn't have references to its own dependencies If you want to link with a static library, you need to link with all its dependencies as well