bazel

Alternate to “`--whole-archive`” in bazel

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 01:06:19
问题 I want to link an external static lib in one of my bazel based c++ project. I need " whole-archive " option for linking the library like gcc or g++ build: g++ main.cc -Wl,--whole-archive -lhttp -Wl,--no-whole-archive Can anybody suggest what is the alternate to " --whole-archive " in bazel? 回答1: Sadly, alwayslink doesn't work with precompiled libraries, only with cc_library compiled and linked by Bazel. There is one undocumented hack (I guess I'm just documenting it by mentioning it here),

Is there verbose logging for Bazel?

╄→гoц情女王★ 提交于 2019-12-10 21:39:51
问题 I dig around Bazel source code, there aren't much logging it seems. Is there a way to enable some kind of verbose mode so I can see what bazel is doing? Also there seems to be various kind of debug options but I cant seem to comprehend yet, if I want to debug say java_library how should I do it? 回答1: To debug what Bazel does and why: To list the commands Bazel executes, use the "--[no]subcommands" flag. To request listing just the failing commands, use the "--[no]verbose_failures" flag. To

How to upgrade bazel?

試著忘記壹切 提交于 2019-12-10 16:44:38
问题 I built bazel-0.4.0 successfully. Then I tried upgrading it to the latest version bazel-0.5.1 using $ ./compile.sh compile ../bazel-0.4.0/output/bazel.exe It's giving me an error, bazel-0.5.0 , bazel-0.4.5 gave me same error ERROR LOG: $ ./compile.sh compile ../bazel-0.4.0/output/bazel.exe 🍃 Building Bazel with Bazel. ERROR: Illegal javabase value 'C:/Program Files/Java/jdk', javabase must be an absolute path or label. INFO: Elapsed time: 0.246s ERROR: Could not build Bazel bazel-0.4.4 gave

Can I use Python Debugger In Bazel Test

旧巷老猫 提交于 2019-12-10 15:10:04
问题 I am trying to debug my tests using pdb (Python debugger) while running them with bazel. This is a sample test I have: class TestMembersResource(TestCase): def test_get(self): response = self.client.get('/api/v1/members/') import ipdb; ipdb.set_trace() self.assertEqual(response.status_code) When I try to run it with bazel test ... I get the following output: Traceback (most recent call last): File "/root/.cache/bazel/_bazel_root/ae988d93859d448ae36776fcb135b36c/execroot/__main__/bazel-out/k8

Bazel failed to include a external static library .a

て烟熏妆下的殇ゞ 提交于 2019-12-10 11:38:38
问题 -- Question solved -- This question is solved. Thanks for all the help! The problem and the reason is briefly stated as following for other readers in the future: [Environment] Ubuntu 14.04, Bazel, C++ [Question] I want to include an external library. So I download the source file and make it as as a static lib .a. I correctly set the BUILD, WORKSPACE and related files. However, when compile, it alerts the error: Linking of rule '//main' failed (Exit 1) main: error: undefined reference to

Tensorflow “undefined symbol” when loading custom GPU op

时光毁灭记忆、已成空白 提交于 2019-12-09 21:22:29
问题 I am using Tensorflow 1.9rc0 compiled from sources using bazel version 0.15.0. I'm using cuda support with cuda version 9.2 and cudnn version 7. I am trying to build a custom op which executes a cuda kernel. I've followed the doumentation regarding that matter and checked a few implemented ops in order to develop it. I ended up with the following code: kernel_example.h: #ifndef KERNEL_EXAMPLE_H_ #define KERNEL_EXAMPLE_H_ #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" #include

output 'external/name/x/lib/lib.so' was not created using bazel make

╄→尐↘猪︶ㄣ 提交于 2019-12-08 09:12:30
问题 I was trying to follow the example provided by Building Makefile using bazel post to build an external package in envoy. In the WORKSPACE file I added the following: new_git_repository( name = "name", remote = "remote.git", build_file = "//foo/bazel/external:x.BUILD", ) And foo/bazel/external/x.BUILD has the following contents: load("@rules_foreign_cc//tools/build_defs:make.bzl", "make") filegroup( name = "m_srcs", srcs = glob(["code/**"]), ) make( name = "foo_bar", make_commands = ["make lib

How to compile google-fhir proto files

大憨熊 提交于 2019-12-08 07:12:51
问题 Looking at the readme for google-fhir it says to run bazel build , which works, however none of the protocol files have been compiled. Running protoc --proto_path=. --java_out=. proto/stu3/resources.proto returns a bunch of error about other protos not being found. This goes backwards until 'descriptor.proto' which is not a proto in the folder. None of the protocol files in that directory will manually compile into java files. *On another note, I was able to take other example protos from

How can I build custom rules using the output of workspace_status_command?

只谈情不闲聊 提交于 2019-12-08 03:47:30
The bazel build flag --workspace_status_command supports calling a script to retrieve e.g. repository metadata, this is also known as build stamping and available in rules like java_binary . I'd like to create a custom rule using this metadata. I want to use this for a common support function. It should receive the git version and some other attributes and create a version.go output file usable as a dependency. So I started a journey looking at rules in various bazel repositories. Rules like rules_docker support stamping with stamp in container_image and let you reference the status output in

How to compile google-fhir proto files

六眼飞鱼酱① 提交于 2019-12-08 03:21:26
Looking at the readme for google-fhir it says to run bazel build , which works, however none of the protocol files have been compiled. Running protoc --proto_path=. --java_out=. proto/stu3/resources.proto returns a bunch of error about other protos not being found. This goes backwards until 'descriptor.proto' which is not a proto in the folder. None of the protocol files in that directory will manually compile into java files. *On another note, I was able to take other example protos from other sources and compile those successfully. UPDATE Running the command protoc --proto_path=proto/stu3/ -