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

Bazel run doesn't work on local machine - Ubuntu 22.0.4 #582

Closed
steedmicro opened this issue Dec 28, 2023 · 4 comments · Fixed by #590
Closed

Bazel run doesn't work on local machine - Ubuntu 22.0.4 #582

steedmicro opened this issue Dec 28, 2023 · 4 comments · Fixed by #590
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@steedmicro
Copy link
Contributor

I tried to do an extensive testing on my local VPS machine which is Ubuntu 22.0.4 installed.
When I ran the nativelink application with cargo run command, it works out well and bazel test ran successfully.
But I try to run the application with bazel run command, it shows the following message.
I think the application says it can't load the config file.
Maybe the path settings issue?
I followed the default steps which is mentioned in the documentation and I wonder what external settings I have also.

Capture

@aaronmondal
Copy link
Member

I can reproduce. The following work:

bazel run nativelink $(pwd)/nativelink-config/examples/basic_cas.json 
bazel run nativelink ~/some/subdir/nativelink-config/examples/basic_cas.json
bazel run /absolute/path/to/basic_cas.json

But the ./ syntax doesn't. I'm not sure whether we should flag this as a bug or as incorrect documentation. The ./ syntax seems kind of odd to me since we're not "invoking" the config file. I don't think we should support that usecase (and apparently we never did, so removing this from the docs wouldn't be a breaking change 😅)

Another example that doesn't work is nativelink-config/examples/basic_cas.json without any leading symbols. I believe this is what we actually want.

@aaronmondal aaronmondal added bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers labels Dec 29, 2023
@MarcusSorealheis
Copy link
Collaborator

Good catch @steed924 and thank you for reproducing. Can you link to where this command is documented or open a PR to remove it so we can resolve quickly?

@MarcusSorealheis
Copy link
Collaborator

cc @blakehatch

@adam-singer
Copy link
Member

Updating documentation/code points is appropriate. The reason for this is that bazel run current directory is the bazel out/runfiles, it is a common trip up (bazelbuild/bazel#2579 (comment), bazelbuild/bazel#3325, Bazel + C++ project: how to specify working directory for 'run' command). There are a few ways to deal with it depending on the context of what is being run. Absolute paths is generally the easiest way, depending on how deep or relative the paths to expand are, might be cumbersome. Embedding resources / data fields for bazel BUILD is common, usually good for things that have resource resolvers where everything is relative (such as jvm or transpiled code). Last option I can think of is using --run-under , it allows for arbitrary script prefix, so one could cd into a new directory of choice (such as the root of a project).

In cases where bazel is not executed from the root of a repo, the following command is a slightly more precise, but $(pwd) should be simple enough.

bazel run nativelink $(git rev-parse --show-toplevel)/nativelink-config/examples/basic_cas.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants