Skip to content

build_pip_package_with_bazel: add support of Bazel startup option - #47690

Merged
copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
justeph:build_pip_package_with_bazel-add-support-of-bazel-startup-option
Mar 22, 2021
Merged

copybara-service[bot] merged 1 commit into
tensorflow:masterfrom
justeph:build_pip_package_with_bazel-add-support-of-bazel-startup-option

Conversation

@justeph

@justeph justeph commented Mar 10, 2021

Copy link
Copy Markdown
Contributor

Bazel startup options must appear before the name of the Bazel command.

This commit adds a BAZEL_ARGS variable to be able to specify startup option.

Signed-off-by: Julien STEPHAN [email protected]

@google-ml-butler google-ml-butler Bot added the size:XS CL Change Size: Extra Small label Mar 10, 2021
@google-cla google-cla Bot added the cla: yes label Mar 10, 2021
@justeph

justeph commented Mar 10, 2021

Copy link
Copy Markdown
Contributor Author

Hi all,

I am writing a bitbake tensorflow lite recipe based on meta-tensorflow. In order to correctly cross compile tensorflow a BAZEL_ARGS variable is added defining startup options such as --output_user_root or --output_base.

I was not able to correctly compile the tflite_runtime using build_pip_package_with_bazel.sh script because startup options were not given to the script.

I submit this merge request, because I think it can be useful to be able to specify startup option in other situation as well, not only in the case of the bitbake recipe. I added the variable as BAZEL_ARGS because it is defined this way in meta-tensorflow but I am open to a different name.

Julien

@gbaned gbaned self-assigned this Mar 10, 2021
@gbaned gbaned added the comp:lite TF Lite related issues label Mar 10, 2021
@gbaned
gbaned requested a review from terryheo March 10, 2021 14:28
@terryheo

Copy link
Copy Markdown
Member

Can't you use CUSTOM_BAZEL_FLAGS instead?

CUSTOM_BAZEL_FLAGS=--output_user_root tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh

@justeph

justeph commented Mar 11, 2021

Copy link
Copy Markdown
Contributor Author

Hi @terryheo

Can't you use CUSTOM_BAZEL_FLAGS instead?

CUSTOM_BAZEL_FLAGS=--output_user_root tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh

no I can't use CUSTOM_BAZEL_FLAGS instead. According to the bazel manual startup options must appear before the bazel command:

Also, these options must appear before the name of the Bazel command.

CUSTOM_BAZEL_FLAGS appear after the build command inside tensorflow/lite/tools/pip_package/build_pip_package_with_bazel.sh, so it cannot be used to pass such arguments (I do use CUSTOM_BAZEL_FLAGS in my recipe to pass other arguments such as --jobs= or --cpu=)

Anyway, I tried to put it inside the CUSTOM_BAZEL_ARGS and I got the following error:

Unrecognized option: --output_user_root=

I explained it in the commit message, but maybe it needs to be more clear?

Bazel startup options must appear before the name of the Bazel command.

This commit adds a BAZEL_STARTUP_OPTIONS variable to be able to specify startup option.

Signed-off-by: Julien STEPHAN <[email protected]>
@justeph
justeph force-pushed the build_pip_package_with_bazel-add-support-of-bazel-startup-option branch from 4589e41 to cfa101d Compare March 11, 2021 10:14

@terryheo terryheo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@google-ml-butler google-ml-butler Bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 19, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 19, 2021
@gbaned gbaned added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Mar 22, 2021
@copybara-service
copybara-service Bot merged commit 5c48337 into tensorflow:master Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes comp:lite TF Lite related issues ready to pull PR ready for merge process size:XS CL Change Size: Extra Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants