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

No such package 'tools/jdk': BUILD file not found on package path #187

Closed
kjiwa opened this issue May 11, 2015 · 12 comments
Closed

No such package 'tools/jdk': BUILD file not found on package path #187

kjiwa opened this issue May 11, 2015 · 12 comments

Comments

@kjiwa
Copy link
Contributor

kjiwa commented May 11, 2015

I tried this with a fresh Bazel installation. Steps to repro:

  • Create an empty workspace:
$ mkdir tmpworkspace
$ touch tmpworkspace/WORKSPACE
$ cd tmpworkspace
  • Add a simple project:
$ cat hello/BUILD
py_binary(
    name = "hello",
    srcs = ["hello.py"],
)

$ cat hello/hello.py
"""Hello."""

print 'hello'
  • Try to build the project:
$ bazel build hello:hello
......
ERROR: Loading of target '//tools/jdk:jdk' failed; build aborted: no such package 'tools/jdk': BUILD file not found on package path.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 0.279s
@kjiwa
Copy link
Contributor Author

kjiwa commented May 11, 2015

Note, more often than not I see an error about //tools/jdk:jdk, but some of my build targets complain about missing //tools/cpp:toolchain as well.

$ bazel build javascript/till:till
ERROR: Loading of target '//tools/cpp:toolchain' failed; build aborted: no such package 'tools/cpp': BUILD file not found on package path.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 0.035s

@pmbethe09
Copy link
Member

You either need:
a ~/.bazelrc containing:
build --package_path %workspace%:$PATH_TO_BAZEL/base_workspace

Or you need a 'tools' directory in your workspace.
This can either be a copy or a symlink of $PATH_TO_BAZEL/tools

@kjiwa
Copy link
Contributor Author

kjiwa commented May 12, 2015

I have a .bazelrc. I nuked it and recompiled Bazel and it worked after that. Maybe I got mine in a bad state or pointing to the wrong base workspace. Thanks.

@kjiwa kjiwa closed this as completed May 12, 2015
@achew22
Copy link
Member

achew22 commented Jun 1, 2015

How would you recommend handling this in a CI environment? Should I have my CI script rm the ~/.bazelrc file? Should I ensure the file exists but is empty? Right now the CI server pulls Bazel from head and rebuilds it for every run, should I do a global install on the CI user to have a fixed location for Bazel that I can manage? Maybe I should bring Bazel's tools directory into my repo, is that the preferred method?

Thanks so much

@damienmg
Copy link
Contributor

damienmg commented Jun 1, 2015

achew22: For reproducible build, I would encourage you to use a fixed
version of bazel with a tools directory either in your repo or at a fixed
location in your CI system. This will avoid breakage due to changes in
Bazel that you did not planed. You could also test integration with newer
version of Bazel more easily that way.

On Mon, Jun 1, 2015 at 7:32 AM achew22 notifications@github.com wrote:

How would you recommend handling this in a CI environment? Should I have
my CI script rm the ~/.bazelrc file? Should I ensure the file exists but is
empty? Right now the CI server pulls Bazel from head and rebuilds it for
every run, should I do a global install on the CI user to have a fixed
location for Bazel that I can manage? Maybe I should bring Bazel's tools
directory into my repo, is that the preferred method?

Thanks so much


Reply to this email directly or view it on GitHub
#187 (comment).

Damien

@ghost
Copy link

ghost commented Sep 12, 2015

Occured the same issues. shall we find the tools directory inside ~/.bazel/tools or what ever. if not present there, may we download the latest release file into that default directory?

@kchodorow
Copy link
Contributor

There should be a ~/.bazel/base_workspace/tools directory if you've run the installer with --user=$HOME. What does ls ~/.bazel show? What is in your .bazelrc (cat ~/.bazelrc)? Also, if you run which bazel, what does it show?

@jiridanek
Copy link
Contributor

It would be helpful if the installer outputted a new version of ~/.bazelrc (named say .bazelrc.new) if the file is already present. and displayed a warning about it. This works very well with the .pacnew and .pacsave files in Arch Linux https://wiki.archlinux.org/index.php/Pacnew_and_Pacsave_files.

@damienmg
Copy link
Contributor

Normally the installer does always overwrite the previous location (with --user, it is at ~/.bazel/etc/bazel.bazelrc IIRC). And the home one is just a symlink. If present, the installer check if the file contains the correct base workspace and output a warning if not.

@jiridanek
Copy link
Contributor

So the reason it did not go smoothly for me was that I was switching from git-tip to the binary release. I got the warning, got confused, found this bug ticket, corrected paths in the file (figuring out what they should be (where Bazel installed itself) is the hardest part, maybe the error message could tell me that?), done.

@mmrezaie
Copy link

so is this fixed? I am having the same problem but I have not found any solution yet!? I am using archlinux. In my ubuntu it is fine.

@damienmg
Copy link
Contributor

Is specific issue is resolved can you open a separate issue for yours?

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

7 participants