NdkCxxPlatforms relies on removed ndk functionality
Created by: kageiit
When running a simple buck targets
command on a project which does not use the ndk, but the ANDROID_NDK
env var is set, buck throws this error
Parsing buck files... 0.8 sec
UNKNOWN ERROR: com.google.common.util.concurrent.ExecutionError: java.lang.AssertionError: /Users/kage/android-ndk/platforms/android-9/arch-arm doesn't exist.
com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.AssertionError: /Users/kage/android-ndk/platforms/android-9/arch-arm doesn't exist.
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2216)
at com.google.common.cache.LocalCache.get(LocalCache.java:4147)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.getOrCreate(DefaultToolchainProvider.java:191)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.getByName(DefaultToolchainProvider.java:157)
at com.facebook.buck.toolchain.BaseToolchainProvider.getByName(BaseToolchainProvider.java:24)
at com.facebook.buck.cxx.CxxLibraryDescription.getCxxPlatformsProvider(CxxLibraryDescription.java:298)
at com.facebook.buck.cxx.CxxLibraryDescription.findDepsForTargetFromConstructorArgs(CxxLibraryDescription.java:257)
at com.facebook.buck.cxx.CxxLibraryDescription.findDepsForTargetFromConstructorArgs(CxxLibraryDescription.java:1)
at com.facebook.buck.rules.TargetNodeFactory.create(TargetNodeFactory.java:107)
at com.facebook.buck.rules.TargetNodeFactory.createFromObject(TargetNodeFactory.java:61)
at com.facebook.buck.parser.DefaultParserTargetNodeFactory.createTargetNode(DefaultParserTargetNodeFactory.java:195)
at com.facebook.buck.parser.DefaultParserTargetNodeFactory.createTargetNode(DefaultParserTargetNodeFactory.java:1)
at com.facebook.buck.parser.TargetNodeParsePipeline.computeNode(TargetNodeParsePipeline.java:124)
at com.facebook.buck.parser.TargetNodeParsePipeline.computeNode(TargetNodeParsePipeline.java:1)
at com.facebook.buck.parser.ConvertingPipeline.dispatchComputeNode(ConvertingPipeline.java:160)
at com.facebook.buck.parser.ConvertingPipeline.lambda$2(ConvertingPipeline.java:80)
at com.facebook.buck.parser.PipelineNodeCache.getJobWithCacheLookup(PipelineNodeCache.java:70)
at com.facebook.buck.parser.ConvertingPipeline.lambda$0(ConvertingPipeline.java:73)
at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:206)
at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:195)
at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:115)
at com.google.common.util.concurrent.MoreExecutors$5$1.run(MoreExecutors.java:999)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.AssertionError: /Users/kage/android-ndk/platforms/android-9/arch-arm doesn't exist.
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2216)
at com.google.common.cache.LocalCache.get(LocalCache.java:4147)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.getOrCreate(DefaultToolchainProvider.java:191)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.getByName(DefaultToolchainProvider.java:157)
at com.facebook.buck.toolchain.BaseToolchainProvider.getByName(BaseToolchainProvider.java:24)
at com.facebook.buck.cxx.toolchain.CxxPlatformsProviderFactory.createToolchain(CxxPlatformsProviderFactory.java:46)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.createToolchain(DefaultToolchainProvider.java:210)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.access$1(DefaultToolchainProvider.java:202)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider$1.load(DefaultToolchainProvider.java:106)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider$1.load(DefaultToolchainProvider.java:1)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3708)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2416)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
... 26 more
Caused by: java.lang.AssertionError: /Users/kage/android-ndk/platforms/android-9/arch-arm doesn't exist.
at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
at com.facebook.buck.android.NdkCxxPlatforms$NdkCxxToolchainPaths.processPathPattern(NdkCxxPlatforms.java:951)
at com.facebook.buck.android.NdkCxxPlatforms$NdkCxxToolchainPaths.processPathPattern(NdkCxxPlatforms.java:964)
at com.facebook.buck.android.NdkCxxPlatforms$NdkCxxToolchainPaths.getSysroot(NdkCxxPlatforms.java:984)
at com.facebook.buck.android.NdkCxxPlatforms.getCommonIncludes(NdkCxxPlatforms.java:745)
at com.facebook.buck.android.NdkCxxPlatforms.getCPreprocessorFlags(NdkCxxPlatforms.java:773)
at com.facebook.buck.android.NdkCxxPlatforms.build(NdkCxxPlatforms.java:479)
at com.facebook.buck.android.NdkCxxPlatforms.getPlatforms(NdkCxxPlatforms.java:286)
at com.facebook.buck.android.NdkCxxPlatforms.getPlatforms(NdkCxxPlatforms.java:251)
at com.facebook.buck.android.NdkCxxPlatforms.getPlatforms(NdkCxxPlatforms.java:228)
at com.facebook.buck.android.toolchain.ndk.impl.NdkCxxPlatformsProviderFactory.getNdkCxxPlatforms(NdkCxxPlatformsProviderFactory.java:63)
at com.facebook.buck.android.toolchain.ndk.impl.NdkCxxPlatformsProviderFactory.createToolchain(NdkCxxPlatformsProviderFactory.java:42)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.createToolchain(DefaultToolchainProvider.java:210)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider.access$1(DefaultToolchainProvider.java:202)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider$1.load(DefaultToolchainProvider.java:106)
at com.facebook.buck.toolchain.impl.DefaultToolchainProvider$1.load(DefaultToolchainProvider.java:1)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3708)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2416)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
... 41 more
This happens with the latest android ndk install because android-9
is no longer available as a platform as configured in https://github.com/facebook/buck/blob/master/src/com/facebook/buck/android/NdkCxxPlatforms.java#L93
This should either be configured lazily i.e if a project does not use the ndk, buck should not resolve any of the ndk paths just because the ANDROID_NDK
env var is set or the default should be switched to something modern like android-16
in the short term
cc @dreiss @styurin