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

ERROR: Unrecognized option: --define=key=value #120

Closed
schoren opened this issue Feb 8, 2018 · 7 comments
Closed

ERROR: Unrecognized option: --define=key=value #120

schoren opened this issue Feb 8, 2018 · 7 comments

Comments

@schoren
Copy link

schoren commented Feb 8, 2018

I'm trying to setup ibazel to work with my current bazel workspace. I have a toos/bazel.rc that looks like this:

common --define=key=value --workspace_status_command=./tools/build/status.bash

Then I run ibazel run //mytarget and I get the following error:

State: QUERY
Querying for BUILD files...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'query' from /dev/myproject/tools/bazel.rc:
  Inherited 'common' options: --define=key=value --workspace_status_command=./tools/build/status.bash
ERROR: Unrecognized option: --define=key=value
Error running Bazel exit status 2

Is there anything I'm doing wrong? Thanks

@achew22
Copy link
Member

achew22 commented Feb 8, 2018

What happens when you run bazel run //mytarget?

@schoren
Copy link
Author

schoren commented Feb 8, 2018

It runs fine. I set my workspace using bazel, and now I'm trying to set ibazel as a convenience for developers.

Do you need any bazel log/output?

@achew22
Copy link
Member

achew22 commented Feb 8, 2018

What do you mean by you set your workspace using bazel? ibazel is a wrapper around bazel that just repeatedly invokes it on the command line for you. I guess I'm confused by this because ibazel and bazel should emit the same errors (generated by bazel in the first place). Is there anything else abnormal about your system? How are you invoking ibazel? How are you installing ibazel? What version is installed? If it isn't the latest version, does it still behave this way? What if you use build --define key=value and what about common --define key=value?

@schoren
Copy link
Author

schoren commented Feb 8, 2018

Sorry if I wasn't clear. What I meant to say is that I'm using regular bazel and it works fine. I downloaded the latest release from github, built with the bazel command from the docs, and then copied the binary into my path.

I'll try to change the bazel.rc settings as you suggest and see if that works.

@achew22
Copy link
Member

achew22 commented Feb 9, 2018

Any luck with the bazel.rc changes?

@schoren
Copy link
Author

schoren commented Feb 9, 2018

Yes, I changed it to look like this:

build --define key=value --workspace_status_command=./tools/status.bash

And it's working!

I'm confused however on how does the system knows what the value of key while runing. Just in case I've tried to clean the workspace and then run ibazel again, and it still works fine.

Thanks!

@achew22
Copy link
Member

achew22 commented Feb 9, 2018

Not actually an expert here, but I hypothesize that the run is just a build command followed by invoking the produced binary. Since the --define flag is set on build, the produced binary has the appropriate definitions and when you run it either manually or through the run command, it works.

@achew22 achew22 closed this as completed Feb 9, 2018
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

2 participants