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

Building Android Support Libraries spams console with "Cannot stat file..." #2201

Closed
aj-michael opened this issue Dec 7, 2016 · 5 comments
Closed
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug
Milestone

Comments

@aj-michael
Copy link
Contributor

aj-michael commented Dec 7, 2016

As of 8d6da00, //third_party/ijar:zipper logs errors about stat_file failing.

$ cat WORKSPACE
android_sdk_repository(
    name = "androidsdk",
    path = "/home/ajmichael/Android/Sdk",
    build_tools_version = "25.0.0",
    api_level = 25,
)
$ cat java/com/foo/BUILD
android_binary(
    name = "foo",
    manifest = "AndroidManifest.xml",
    srcs = ["MainActivity.java"],
    deps = ["@androidsdk//com.android.support:mediarouter-v7-23.4.0"],
)

With Bazel built at 645dbc4

$ devbazel build --spawn_strategy=standalone //java/com/foo
INFO: Found 1 target...
Target //java/com/foo:foo up-to-date:
  bazel-bin/java/com/foo/foo_deploy.jar
  bazel-bin/java/com/foo/foo_unsigned.apk
  bazel-bin/java/com/foo/foo.apk
$

With Bazel built at 8d6da00

$ devbazel build --spawn_strategy=standalone //java/com/foo
INFO: Found 1 target...
INFO: From AarManifestFileEntriesExtractor external/androidsdk/com.android.support/_aar/unzipped/resources/mediarouter-v7-23.4.0:
Cannot stat file /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/9edb8580cd9b915d33b825372a03920e/execroot/b/bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/bin/external/androidsdk/com.android.support/_aar/unzipped/resources/mediarouter-v7-23.4.0/res: No such file or directory
Cannot stat file /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/9edb8580cd9b915d33b825372a03920e/execroot/b/bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/bin/external/androidsdk/com.android.support/_aar/unzipped/resources/mediarouter-v7-23.4.0/res/values-el: No such file or directory
Cannot stat file /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/9edb8580cd9b915d33b825372a03920e/execroot/b/bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/bin/external/androidsdk/com.android.support/_aar/unzipped/resources/mediarouter-v7-23.4.0/res/values-ms-rMY: No such file or directory
Cannot stat file /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/9edb8580cd9b915d33b825372a03920e/execroot/b/bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/bin/external/androidsdk/com.android.support/_aar/unzipped/resources/mediarouter-v7-23.4.0/res/layout: No such file or directory
[lots more spam here]
Cannot stat file /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/9edb8580cd9b915d33b825372a03920e/execroot/b/bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/bin/external/androidsdk/com.android.support/_aar/unzipped/resources/appcompat-v7-23.4.0/res/color: No such file or directory
Target //java/com/foo:foo up-to-date:
  bazel-bin/java/com/foo/foo_deploy.jar
  bazel-bin/java/com/foo/foo_unsigned.apk
  bazel-bin/java/com/foo/foo.apk
INFO: Elapsed time: 19.622s, Critical Path: 16.50s
$

However, the APKs produced are the same (modulo a known determinism issue with DSA APK signing).

In 8d6da00, we started reporting logging this message when zipper stats a file that returns a negative value, instead of just ignoring it and moving to the next. aar_import uses zipper to extract the resources from the AAR. I'm not sure what the right course of action here is.

@ahumesky ahumesky added the P2 We'll consider working on this in future. (Assignee optional) label Dec 8, 2016
@laszlocsomor
Copy link
Contributor

laszlocsomor commented Dec 9, 2016

Oh, mea culpa.

8d6da00#diff-a5eb796bd8c9663be687d472a23b48b9R41 (line 41 right) should not have been added. In later commits I started using the stat_file method to simply check for file existence. The error message here is a false positive, it should silently return false and that'd be WAI. I'll send out a fix.

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Dec 9, 2016

I think this is the actual culprit: 645dbc4#diff-69085d3849c04a65812896ac53704713R117 (line 117 right).

The problem is, I only added the error reporting to stat_file in a subsequent commit (8d6da00) but this call was never meant to report a failed stat.

@laszlocsomor
Copy link
Contributor

@aj-michael: While trying to repro this, I'm hitting problems with my environment setup so I can't build your example, and given the simplicity of the original issue and my certainty in the fix, I won't spend more time on trying to figure out the reasons. Therefore can I ask you that once the fix is out for review or even submitted, to please try it out?

@aj-michael
Copy link
Contributor Author

Thanks Laszlo! I will test the fix out now

@aj-michael
Copy link
Contributor Author

I've confirmed that https://bazel-review.googlesource.com/#/c/7810/ fixes this issue.

@ahumesky ahumesky added this to the 0.5 milestone Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: bug
Projects
None yet
Development

No branches or pull requests

3 participants