bazel icon indicating copy to clipboard operation
bazel copied to clipboard

"Android IDL generation" action misses environment variables

Open yogurtearl opened this issue 3 years ago • 0 comments

Description of the bug:

"Android IDL generation" action does not pick up TMPDIR and LD_LIBRARY_PATH.

need to add something like setEnv(actionEnvironment) here: https://github.com/bazelbuild/bazel/blob/2361e7492ba94f1faea69fdbc559d4e712bba457/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java#L403

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  • Set LD_LIBRARY_PATH=/lib:/usr/lib:/custom_lib Environment var.
  • Run the build androidx.test build. https://github.com/android/android-test
  • you will see something like this:
  (cd /root/.cache/bazel/_bazel_root/abcd/sandbox/processwrapper-sandbox/392/execroot/android_test_support && \
  exec env - \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/abcd/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/aarch64-opt-exec-2B5CBBC6/bin/external/androidsdk/aidl_binary -b -Iservices/events/java -pexternal/androidsdk/platforms/android-31/framework.aidl services/events/java/androidx/test/services/events/platform/ITestPlatformEvent.aidl bazel-out/android-armeabi-v7a-fastbuild/bin/services/events/java/androidx/test/services/events/events_aidl/services/events/java/androidx/test/services/events/platform/ITestPlatformEvent.java)

you SHOULD see this, but it doesn't pass along the LD_LIBRARY_PATH env var.

...
  exec env - \
    TMPDIR=/tmp \
     LD_LIBRARY_PATH=/lib:/usr/lib:/custom_lib \ 
...

Which operating system are you running Bazel on?

linux

What is the output of bazel info release?

release 4.2.2

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

This is important to be able to use the needed lib files for a build inside Docker on an ARM based apple silicon mac.

All other actions pass along LD_LIBRARY_PATH and --action_env so this should be consistent with those.

yogurtearl avatar Aug 01 '22 19:08 yogurtearl