Buck: Buck does not support Android NDK r11b ("Failed to read version")

Created on 18 Mar 2016  路  18Comments  路  Source: facebook/buck

When running a buck clean I get the message BUILD FAILED: Failed to read NDK version from followed by the actual path to the NDK. This doesn't happen with r10e or r10d, only with r11b.

There's also the year-old issue #306 bug that cripples Android NDK r10e too.

Most helpful comment

@winterDroid Actually the built in way of specifying the gcc-version is through the .buckconfig file in the project

[ndk]
    gcc_version = 4.9

The default is in https://github.com/facebook/buck/blob/master/src/com/facebook/buck/android/NdkCxxPlatforms.java#L81

All 18 comments

help me
When running a " buck build :conceal_android" i get message is "BUILD FAILED: Failed to read NDK version from /home/Android/Sdk/ndk-bundle"
how do?

Just wanted to add that this is still happening with the Android NDK r11c, released just recently.

Same issue here

It seems that buck depends on the file RELEASE.TXT to exist under the ANDROID_NDK path. See https://github.com/facebook/buck/blob/master/src/com/facebook/buck/android/DefaultAndroidDirectoryResolver.java#L125

To "fix" this just add the file RELEASE.TXT to the ANDROID_NDK path with the following contents

Example: /opt/android-ndk-r11c/RELEASE.TXT

r11c (64-bit)

Yes I know. But it seems Buck is not compatible with r11c because of another issue:

[2016-04-03 10:06:28.936][error][command:5a902683-ccfe-4dc2-98d1-37038c4e9c7c][tid:94][com.facebook.buck.cli.Main] Uncaught exception at top level
java.lang.IllegalStateException: /Users/marcprengemann/android-ndk-r11c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc
    at com.google.common.base.Preconditions.checkState(Preconditions.java:174)
    at com.facebook.buck.android.NdkCxxPlatforms.getToolPath(NdkCxxPlatforms.java:580)
    at com.facebook.buck.android.NdkCxxPlatforms.getCTool(NdkCxxPlatforms.java:629)
    at com.facebook.buck.android.NdkCxxPlatforms.build(NdkCxxPlatforms.java:373)
    at com.facebook.buck.android.NdkCxxPlatforms.getPlatforms(NdkCxxPlatforms.java:138)
    at com.facebook.buck.android.NdkCxxPlatforms.getPlatforms(NdkCxxPlatforms.java:105)
    at com.facebook.buck.rules.KnownBuildRuleTypes.createBuilder(KnownBuildRuleTypes.java:351)
    at com.facebook.buck.rules.KnownBuildRuleTypes.createInstance(KnownBuildRuleTypes.java:226)
    at com.facebook.buck.rules.KnownBuildRuleTypesFactory.create(KnownBuildRuleTypesFactory.java:49)
    at com.facebook.buck.rules.Cell.<init>(Cell.java:120)
    at com.facebook.buck.rules.Cell.createCell(Cell.java:182)
    at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:779)
    at com.facebook.buck.cli.Main.tryRunMainWithExitCode(Main.java:1467)
    at com.facebook.buck.cli.Main.runMainThenExit(Main.java:1552)
    at com.facebook.buck.cli.Main.nailMain(Main.java:1665)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:338)

Reason for it is that the path does not exist. It is version 4.9 and not 4.8

@winterDroid I worked around that by ln -s arm-linux-androideabi-4.9 arm-linux-androideabi-4.8 as I couldn't find where it specifies to use 4.8

@winterDroid Actually the built in way of specifying the gcc-version is through the .buckconfig file in the project

[ndk]
    gcc_version = 4.9

The default is in https://github.com/facebook/buck/blob/master/src/com/facebook/buck/android/NdkCxxPlatforms.java#L81

@flopex, thanks
[ndk] thingy works for project build, but to install buck one still need to make ln -s.

This should have been fixed by 7a6fba112f62abf865c27e3dd91d6e5d97625d95.

@vigilancer What do you mean? Does buck install not read the ndk.gcc_version? It should.

@Coneko, I ment installing Buck afresh with brew install.
Maybe there is a way to specify gcc_version at install time I'm not aware of.

@vigilancer I have not been able to reproduce that. If you still have this problem can you open a new issue with instructions on how to reproduce it?

For some reason the original bug is still up for me. I now get this error message when running a buck clean:

BUILD FAILED: could not extract version from NDK repository at com.facebook.buck.io.ProjectFilesystem@470a90de (projectRoot=/home/mihai/bin/android-ndk-r11c, whiteListedPaths=Optional.absent(), blackListedPaths=[]: /home/mihai/bin/android-ndk-r11c/RELEASE.TXT

I'm on buck commit 1d1d4a4. The source.properties file exists and is readable. It contains the text

Pkg.Desc = Android NDK Pkg.Revision = 11.2.2725575

Can you run buck kill to make sure the daemon restarts, then try again?

@Coneko
I suppose my problem relate to this issue.
If you do not agree I'll move description to new issue.
Until than, here it is:

$brew uninstall buck
$brew update && brew upgrade --all
$brew info android-ndk
android-ndk: stable r11c
...
$brew install buck
==> Installing buck from facebook/fb
==> Downloading https://api.github.com/repos/facebook/buck/tarball/v2016.03.28.01
Already downloaded: /Library/Caches/Homebrew/buck-2016.03.28.01.01
==> ant
==> ./bin/buck build buck
Last 15 lines from /Users/developer/Library/Logs/Homebrew/buck/02.buck:
at com.facebook.buck.rules.KnownBuildRuleTypes.createBuilder(KnownBuildRuleTypes.java:352)
at com.facebook.buck.rules.KnownBuildRuleTypes.createInstance(KnownBuildRuleTypes.java:226)
at com.facebook.buck.rules.KnownBuildRuleTypesFactory.create(KnownBuildRuleTypesFactory.java:49)
at com.facebook.buck.rules.Cell.(Cell.java:120)
at com.facebook.buck.rules.Cell.createCell(Cell.java:182)
at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:779)
at com.facebook.buck.cli.Main.tryRunMainWithExitCode(Main.java:1467)
at com.facebook.buck.cli.Main.runMainThenExit(Main.java:1552)
at com.facebook.buck.cli.Main.main(Main.java:1570)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.facebook.buck.cli.bootstrapper.ClassLoaderBootstrapper.main(ClassLoaderBootstrapper.java:62)


Workaround is to create and edit RELEASE.TXT and ln -s arm-linux-androideabi-4.9 arm-linux-androideabi-4.8 as @flopex suggested.

v2016.03.28.01 is not going to have the fix, FWIW. I think @ryu2 is
working on getting the most recent release out to homebrew.

@Coneko, I've tried doing a buck kill first and no changes, same error message. I've tried it with the lastest commit, 797cdf6.

@bmihai What does buck --version say?

It also gives the same error message:

BUILD FAILED: could not extract version from NDK repository at com.facebook.buck.io.ProjectFilesystem@470a90de (projectRoot=/home/mihai/bin/android-ndk-r11c, whiteListedPaths=Optional.absent(), blackListedPaths=[]: /home/mihai/bin/android-ndk-r11c/RELEASE.TXT

If I change the project's local.properties to use android-ndk-r10d (the last fully working version) it says:

buck version 797cdf60b1f26acd59bbe2b34340089107785532

Was this page helpful?
0 / 5 - 0 ratings