问题标签 [bazel]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
2585 浏览

tensorflow - 语法网 bazel 测试失败

我跑了bazel test syntaxnet/... util/utf8/...,它给了我这个输出:

如果您想要 的输出--test_verbose_timeout_warnings,请询问。

Test.log 输出如下,因为 Stackoverflow 告诉我我的帖子中有太多代码:/

谢谢!


test.log 输出:

0 投票
1 回答
952 浏览

bazel - How to write a bazel select macro that works inside or outside of defining workspace?

In a workspace @base, suppose I have a "macro" in main/macros.bzl such as:

And in main/BUILD:

Now I want to be able to load this macro from a different workspace, @child, e.g.:

Then it will fail because //main:development is not resolved against the @base workspace, it's resolved against the @child workspace.

However, if I fully qualify it, as in:

Then it will work in @child, but fail when used inside the defining workspace, @base, because apparently you can't refer to your own workspace using the @main notation:

How can I refer to @base//main:development in the macro in a way that will work inside and outside the defining workspace?

0 投票
1 回答
3424 浏览

linux - “gcc:尝试执行'cc1plus'时出错:execvp:没有这样的文件或目录”在CentOS 6.7上

我的电脑上发生了一件非常奇怪的事情。我确实查找了类似的问题,但那里的解决方案并没有帮助我。

我正在尝试在 Cent OS 6.7 上安装 bazel 0.2.2b。Bazel 需要 gcc 4.8 或更高版本才能编译,因此我使用此处给出的步骤将我的 gcc 升级到 4.8.2 。

我在安装后启用了 scl ,但没有任何改变。我的默认 gcc 仍然是 4.4.7。所以我做了以下步骤:

由于删除 gcc 很危险,我将其移至另一个文件并将新文件复制到 /usr/bin/gcc。

现在,我的默认 gcc 和 g++ 都是 4.8.2 但我仍然收到错误:

当我./compile安装 Bazel 时。

我尝试了其他类似问题中发布的解决方案,要求升级/重新安装但没有用。

我担心如果我做错任何事可能会破坏系统核心。我现在该怎么办?

0 投票
2 回答
724 浏览

android - Tensorflow android 示例不会构建

我正在尝试从 tensorflow 构建 android 示例,但一直遇到烦人的构建错误。到目前为止我的步骤:

  • 为 SDK 安装了 android studio。(v24)
  • 下载了android NDK 10e(其他版本好像不行)
  • 另外安装了 SDK 构建工具 23.0.1(v24 似乎不起作用)
  • 使用 inception 模型在 android 示例中添加了一个 assets 文件夹
  • 编辑 WORKSPACE 文件以指向 NDK/SDK 位置。

我尝试了几个版本的 TF,但我一直收到错误消息。有任何想法吗?

错误:

0 投票
1 回答
2776 浏览

tensorflow - 从源代码安装 Bazel Tensorflow:无法识别的选项:--host_force_python=py2

我正在尝试从源代码安装 tensorflow。运行配置文件时,我选择了所有默认参数,然后在尝试运行时:

我收到消息:

然后当我尝试运行 build_pip_package 命令时,找不到 build_pip_package 命令:

虽然里面确实存在一个 build_pip_package 文件bazel-bin/tensorflow/tools/pip_package

0 投票
2 回答
2597 浏览

c++ - Bazel 在文件通配方面与 CMake 有相同的问题吗?

我正在开始一个新项目,需要选择一个构建系统。我讨厌必须手动将每个 C++ 源文件添加到我的构建规则中,因为这种事情应该在 2016 年实现自动化,并且在重构时会增加额外的工作量(重命名标题中的类和源文件,以及构建系统文件...)。

当我遇到这篇文章时,我开始将 CMake 与递归文件通配一起使用:使用 GLOB 全局指定源文件?

这表明 globbing 是邪恶的,因为 CMake 使用两个阶段进行构建(cmake 和 make),而在正常使用中,用户只重新运行第二个阶段(make)。

乍一看,Bazel 还允许文件通配。与 Bazel 一起使用是不是很邪恶?在代码库上运行是find一个构建系统真的需要避免的扩展问题吗?

0 投票
1 回答
1043 浏览

java - 带有 java 的 AWS Lambda 抛出由 ClassNotFoundException 引起的 NoClassDefFoundError,它不是在本地抛出的

我最近开始在 Java 中使用 AWS Lambda。

一直进展顺利,直到我开始使用 Dagger 2 进行注射。

现在 Lambda 抛出以下错误:

java -jar myjar.jar但是,在本地运行时不会发生这种情况。我还使用jar tvf myjar.jar.

我使用 Bazel 构建。

我检查过的其他问题表明这可能是由于依赖项不可用,但是,该类的内容没有依赖项。

取自Dagger 回购

运行独立 jar 时,可能导致 AWS 上出现的问题在我的本地环境中没有出现?

提前致谢

编辑 1:这是最小的 BUILD 文件:

这是工作空间文件:

这是 Action.java (注意,我直接使用 Preconditions 使其成为最小实现,在我的实际代码中,它在尝试构建组件时失败):

如果您运行bazel build //src/main/com/company:bin_deploy.jar并将其上传到 AWS Lambda 函数,它应该会失败。如果您在本地运行bazel run //src/main/com/company:bin,否则java -jar bazel-bin/src/main/com/company/bin_deploy.jar它将正常工作。

0 投票
2 回答
1096 浏览

android - TensorFlow Android 演示:无法使用 Bazel 构建,无法读取 RELEASE.TXT

最近我一直在学习如何使用 TensorFlow,并想在我的计算机上设置 Android 演示,看看它们是如何工作的。我按照此处提供的说明进行操作,唯一的区别是我通过 Android Studio 安装了 Android SDK,并通过 SDK Manager 安装了 Android NDK。直到$ bazel build //tensorflow/examples/android:tensorflow_demo,一切正常,但在那之后,我从终端收到了这个错误:

通过查看类似问题,我的理解是此错误是因为 RELEASE.TXT 文件未包含在最新版本的 Android NDK 中。此问题建议降级到包含 RELEASE.TXT 文件的先前版本的 NDK,并提供下载此类版本的链接。但是,我遵循的链接(https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin)下载了一个 .bin 文件,这对我来说是不可用的。该帖子还建议注释掉 WORKSPACE 文件中的 NDK 条目,但我还没有尝试过,因为我不知道这是否会导致进一步的复杂化。

我尝试过的另一种方法是转到错误日志 ( /home/me/.cache/bazel/_bazel_me/f3471be34d1e62bf21975aa777cedaa3/external/androidndk/ndk) 指示的路径并创建一个空白的 RELEASE.TXT 文件,这没有任何区别。(我无法在我安装的 NDK 中创建一个,因为它是路径中的 .jar 文件的形式/home/me/android-studio/android-studio/plugins/android-ndk/lib,因此我能看到的唯一方法就是这条路径。)

就目前而言,我处于死胡同。是否有其他方法可以在不降级或注释掉 NDK 条目的情况下解决此问题?如果没有,我该如何安装以前版本的 Android NDK?

0 投票
2 回答
1522 浏览

ruby - 在 OSX El Capitan 上构建和链接共享 Tensorflow 库以通过 Swig 从 Ruby 调用

我正在尝试使用Swig帮助构建围绕Tensorflow的 Ruby 包装器。目前,我坚持制作共享构建,并将其 C/C++ 标头暴露给 Ruby。所以问题是:如何构建一个包含完整 Tensorflow 库的共享构建,以便它可以作为 OSX El Capitan 上的共享库使用(注意:在 El Capitan 上是只读的)?.solibtensorflow.so/usr/lib/

背景

在这个ruby​​-tensorflow项目中,我需要打包一个 Tensorflow.bundle文件,但是每当我irb -Ilib -rtensorflow或尝试运行规范rspec时,我都会收到错误,即基本数字类型未定义,但它们在这里明确定义。

我猜这是因为我的.so-file 没有正确创建,或者某些东西没有按应有的方式链接。C++/Swig/Bazel 不是我的强项,我想专注于学习 Tensorflow 并在 Ruby 中构建一个好的包装器,但在这一点上我很难进入那个有趣的部分!

我做了什么:

  1. git clone --recurse-submodules https://github.com/tensorflow/tensorflow
  2. cd tensorflow
  3. bazel build //tensorflow:libtensorflow.so(在我的机器上等待 10-15 分钟)
  4. 将生成的libtensorflow.so(166.6 MB)复制到-/ext文件夹
  5. 运行项目中描述ruby extconf.rb的, make, 和make install
  6. rspec

无奈之下,我也多次从源头进行官方安装,但我不知道最后sudo pip install /tmp/tensorflow_pkg/tensorflow-0.9.0-py2-none-any.whl一步是否创建了共享构建或只是公开了一个 Python 接口。

制作原始存储库并按照我遵循的说明进行操作的人 Arafat说,他在他的 Linux 机器上libtensorflow.so4.5 GB - 所以超过我的 OSX 机器上共享构建的大小的 20 倍。UPDATE1:他说他的libtensorflow.so-build 是302.2 MB, 4.5GB 是整个 tensorflow 文件夹的大小。

非常感谢任何帮助或替代方法!

0 投票
1 回答
2111 浏览

c++ - How to use environment variables in bazel/googletest

So I want to use bazel and the googletest framework for running unittests of a simulation. For this, I want to have sample-inputfiles ans sample-outputfiles. I want to get the absolute path of the source file, the test file or any file in the repository, so I can create a relative path to input files from there.
E.g.:

So after a lot of searching, I found out that you can define constants straight from the BUILD file for bazel like so:

The important line is in copts, where I am using $(workspace).
I read here, that you can specify copts (or alternatively defines) like this, which does work.
This page, which the first page links to, tells me, I can use environment variables like this: $(FOO)
It also tells me, that I can run bazel info --show_make_env to get all availabe environment variables.

When I run it, I get a big list of environment variables, which contains workspace, next to alot of others.
Now here comes the problem:
But when I use the $(workspace) variable, bazel tells me, that $(workspace) is not defined.
I would also work for me if I could use the $PWD variable, but I couldn't get this to work either.

I hope someone can help me.
Greetings,
Romeo

Edit:
I now use the 'data' option in the bazel build file. This works mostly