Buck: Unable to build on Windows

Created on 15 Apr 2018  路  6Comments  路  Source: facebook/buck

Just've installed Buck on Windows (by downloading the ZIP from master,unpacking it and running ant and then - bin\buck build --show-output buck) and here's what I see whenever I try building anythig:

PS C:\Users\shybo\Downloads\irrlicht-newton-game1> ..\buck-master\bin\buck build //vendor/tinyxml:tinyxml
2018-04-15 14:30:18,414 [WARNING][buck_tool.py:402] Not using buckd because watchman isn't installed.
[2018-04-15 14:30:19.492][error][command:null][tid:01][org.pf4j.CompoundPluginDescriptorFinder] Cannot find the manifest path
[2018-04-15 14:30:19.492][error][command:null][tid:01][org.pf4j.AbstractPluginManager] No PluginDescriptorFinder for plugin 'C:\Users\shybo\Downloads\buck-master\build\buck-modules\resources'
org.pf4j.PluginException: No PluginDescriptorFinder for plugin 'C:\Users\shybo\Downloads\buck-master\build\buck-modules\resources'
        at org.pf4j.CompoundPluginDescriptorFinder.find(CompoundPluginDescriptorFinder.java:78)
        at org.pf4j.AbstractPluginManager.loadPluginFromPath(AbstractPluginManager.java:786)
        at org.pf4j.DefaultPluginManager.loadPluginFromPath(DefaultPluginManager.java:137)
        at org.pf4j.AbstractPluginManager.loadPlugins(AbstractPluginManager.java:230)
        at com.facebook.buck.plugin.impl.BuckPluginManagerFactory.createPluginManager(BuckPluginManagerFactory.java:31)
        at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:595)
        at com.facebook.buck.cli.Main.runMainThenExit(Main.java:412)
        at com.facebook.buck.cli.Main.main(Main.java:1833)
        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.facebook.buck.cli.bootstrapper.ClassLoaderBootstrapper.main(ClassLoaderBootstrapper.java:55)

PARSING BUCK FILES... 0.0s
CREATING ACTION GRAPH: FINISHED IN 0.1s
DOWNLOADED 0 ARTIFACTS, 0.00 BYTES
BUILDING: FINISHED IN 1.1s
BUILD FAILED
UNKNOWN ERROR: com.facebook.buck.util.exceptions.BuckUncheckedExecutionException: When amending path.: com.facebook.buck.util.HumanReadableException: Failed to transform Path cl to Source Path because path was not found.cl
com.facebook.buck.util.exceptions.BuckUncheckedExecutionException: When amending tool.: com.facebook.buck.util.exceptions.BuckUncheckedExecutionException: When amending path.: com.facebook.buck.util.HumanReadableException: Failed to transform Path cl to Source Path because path was not found.cl
        at com.facebook.buck.rules.keys.DefaultAlterRuleKey.amendKey(DefaultAlterRuleKey.java:34)
        at com.facebook.buck.rules.keys.AlterRuleKeys.amendKey(AlterRuleKeys.java:60)
        at com.facebook.buck.rules.keys.AlterRuleKeys.amendKey(AlterRuleKeys.java:49)
        at com.facebook.buck.rules.BuildableSupport.deriveDeps(BuildableSupport.java:41)
        at com.facebook.buck.rules.BuildableSupport.getDepsCollection(BuildableSupport.java:55)
        at com.facebook.buck.cxx.CompilerDelegate.getDeps(CompilerDelegate.java:111)
        at com.facebook.buck.cxx.DepsBuilder.add(DepsBuilder.java:68)
        at com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.createPreprocessAndCompileBuildRule(AbstractCxxSourceRuleFactory.java:522)
        at com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.lambda$9(AbstractCxxSourceRuleFactory.java:587)
        at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.computeIfAbsent(SingleThreadedBuildRuleResolver.java:78)
        at com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.requirePreprocessAndCompileBuildRule(AbstractCxxSourceRuleFactory.java:585)
        at com.facebook.buck.cxx.CxxSourceRuleFactory.requirePreprocessAndCompileBuildRule(CxxSourceRuleFactory.java:1)
        at com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.lambda$12(AbstractCxxSourceRuleFactory.java:686)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
        at com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.requirePreprocessAndCompileRules(AbstractCxxSourceRuleFactory.java:691)
        at com.facebook.buck.cxx.CxxSourceRuleFactory.requirePreprocessAndCompileRules(CxxSourceRuleFactory.java:1)
        at com.facebook.buck.cxx.CxxLibraryFactory.requireCxxObjects(CxxLibraryFactory.java:521)
        at com.facebook.buck.cxx.CxxLibraryFactory.requireObjects(CxxLibraryFactory.java:412)
        at com.facebook.buck.cxx.CxxLibraryFactory.createStaticLibraryBuildRule(CxxLibraryFactory.java:779)
        at com.facebook.buck.cxx.CxxLibraryFactory.createBuildRule(CxxLibraryFactory.java:234)
        at com.facebook.buck.cxx.CxxLibraryDescription.createBuildRule(CxxLibraryDescription.java:212)
        at com.facebook.buck.cxx.CxxLibraryDescription.createBuildRule(CxxLibraryDescription.java:1)
        at com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer.transform(DefaultTargetNodeToBuildRuleTransformer.java:81)
        at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.lambda$0(SingleThreadedBuildRuleResolver.java:106)
        at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.computeIfAbsent(SingleThreadedBuildRuleResolver.java:78)
        at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.requireRule(SingleThreadedBuildRuleResolver.java:102)
        at com.facebook.buck.rules.ActionGraphCache.requireRule(ActionGraphCache.java:500)
        at com.facebook.buck.rules.ActionGraphCache.access$0(ActionGraphCache.java:493)
        at com.facebook.buck.rules.ActionGraphCache$2.visit(ActionGraphCache.java:476)
        at com.facebook.buck.rules.ActionGraphCache$2.visit(ActionGraphCache.java:1)
        at com.facebook.buck.graph.AbstractBottomUpTraversal.traverse(AbstractBottomUpTraversal.java:51)
        at com.facebook.buck.rules.ActionGraphCache.createActionGraphSerially(ActionGraphCache.java:479)
        at com.facebook.buck.rules.ActionGraphCache.createActionGraph(ActionGraphCache.java:348)
        at com.facebook.buck.rules.ActionGraphCache.getActionGraph(ActionGraphCache.java:207)
        at com.facebook.buck.rules.ActionGraphCache.getActionGraph(ActionGraphCache.java:104)
        at com.facebook.buck.cli.BuildCommand.createActionGraphAndResolver(BuildCommand.java:1310)
        at com.facebook.buck.cli.BuildCommand.createGraphs(BuildCommand.java:522)
        at com.facebook.buck.cli.BuildCommand.executeBuildAndProcessResult(BuildCommand.java:601)
        at com.facebook.buck.cli.BuildCommand.run(BuildCommand.java:477)
        at com.facebook.buck.cli.BuildCommand.runWithoutHelp(BuildCommand.java:443)
        at com.facebook.buck.cli.AbstractCommand.run(AbstractCommand.java:236)
        at com.facebook.buck.cli.AbstractContainerCommand.run(AbstractContainerCommand.java:79)
        at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:1142)
        at com.facebook.buck.cli.Main.runMainThenExit(Main.java:412)
        at com.facebook.buck.cli.Main.main(Main.java:1833)
        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.facebook.buck.cli.bootstrapper.ClassLoaderBootstrapper.main(ClassLoaderBootstrapper.java:55)
Caused by: com.facebook.buck.util.exceptions.BuckUncheckedExecutionException: When amending path.: com.facebook.buck.util.HumanReadableException: Failed to transform Path cl to Source Path because path was not found.cl
        at com.facebook.buck.rules.keys.DefaultAlterRuleKey.amendKey(DefaultAlterRuleKey.java:34)
        at com.facebook.buck.rules.keys.AlterRuleKeys.amendKey(AlterRuleKeys.java:60)
        at com.facebook.buck.rules.keys.AlterRuleKeys.amendKey(AlterRuleKeys.java:49)
        at com.facebook.buck.rules.BuildableSupport$DepsBuilder.setAddsToRuleKey(BuildableSupport.java:132)
        at com.facebook.buck.rules.keys.AbstractRuleKeyBuilder.setReflectively(AbstractRuleKeyBuilder.java:65)
        at com.facebook.buck.rules.keys.AbstractRuleKeyBuilder.setReflectively(AbstractRuleKeyBuilder.java:53)
        at com.facebook.buck.rules.keys.AbstractRuleKeyBuilder.setReflectively(AbstractRuleKeyBuilder.java:1)
        at com.facebook.buck.rules.keys.DefaultAlterRuleKey.amendKey(DefaultAlterRuleKey.java:32)
        ... 55 more
Caused by: com.facebook.buck.util.HumanReadableException: Failed to transform Path cl to Source Path because path was not found.cl
        at com.facebook.buck.config.BuckConfig.checkPathExists(BuckConfig.java:912)
        at com.facebook.buck.config.BuckConfig.getPathSourcePath(BuckConfig.java:359)
        at com.facebook.buck.cxx.toolchain.CxxBuckConfig.getSourcePath(CxxBuckConfig.java:183)
        at com.facebook.buck.cxx.toolchain.DefaultCxxPlatforms.lambda$1(DefaultCxxPlatforms.java:171)
        at com.facebook.buck.util.MoreSuppliers$MemoizingSupplier.get(MoreSuppliers.java:54)
        at com.facebook.buck.rules.keys.AbstractRuleKeyBuilder.setReflectively(AbstractRuleKeyBuilder.java:74)
        at com.facebook.buck.rules.keys.AbstractRuleKeyBuilder.setReflectively(AbstractRuleKeyBuilder.java:53)
        at com.facebook.buck.rules.keys.AbstractRuleKeyBuilder.setReflectively(AbstractRuleKeyBuilder.java:1)
        at com.facebook.buck.rules.keys.DefaultAlterRuleKey.amendKey(DefaultAlterRuleKey.java:32)
        ... 62 more

The interesting thing is: the BUCK file for the //vendor/tinyxml looks like this:

PS C:\Users\shybo\Downloads\irrlicht-newton-game1> cat .\vendor\tinyxml\BUCK
cxx_library(
    name = "tinyxml",
    headers = glob([ "*.h" ]),
    srcs = glob([ "*.cpp" ]),
    exported_headers = glob([ "*.h" ]),
    header_namespace = "",
    compiler_flags = [
        "-xc++"
    ],
    preferred_linkage = "static",
    visibility = [ "PUBLIC" ],
)

In other words, it does not have any deps or anything extraordinary.

Most helpful comment

Okay, figured it out. Might be worth adding a few lines to the docs:

  • after installing the VisualStudio, there was/is a vcvarsall.bat, which registers the environment variables, including the paths to the linker and the compiler (CL)
  • PowerShell is not affected by those changes (for whatever reason), so it needs its own environment variables (which vcvarsall.bat does not provide)
  • there is a PowerShell module, VSSetup, which does exactly what we want - registers the environment variables for PowerShell environment

So, for PowerShell:

  1. installing the module: Install-Module -Name PSCX -AllowClobber
  2. installing the module: Install-Module -Name VSSetup -AllowClobber
  3. initializing the environment variables: Import-VisualStudioVars 2017 amd64
  4. profit!

After that, the build works.

All 6 comments

the error says, that Buck is unable to find a compiler tool (cl). Do you have a compiler installed on your system?

Damn fonts, it's CL, not C1... Re-tying now...

Okay, so I've installed Visual Studio with the C++ compiler and all-the-things; verified it works (just a simple HelloWorld program does work), but Buck still can't find the CL. Maybe I should register it in PowerShell or globally?

Okay, figured it out. Might be worth adding a few lines to the docs:

  • after installing the VisualStudio, there was/is a vcvarsall.bat, which registers the environment variables, including the paths to the linker and the compiler (CL)
  • PowerShell is not affected by those changes (for whatever reason), so it needs its own environment variables (which vcvarsall.bat does not provide)
  • there is a PowerShell module, VSSetup, which does exactly what we want - registers the environment variables for PowerShell environment

So, for PowerShell:

  1. installing the module: Install-Module -Name PSCX -AllowClobber
  2. installing the module: Install-Module -Name VSSetup -AllowClobber
  3. initializing the environment variables: Import-VisualStudioVars 2017 amd64
  4. profit!

After that, the build works.

Thanks for sharing your feedback, @shybovycha! We'll update the documentation to include your advice! cc @carljparker

@shybovycha Just tested this today and It works!

I discovered that you need to run set-executionpolicy unrestricted before running Import-VisualStudioVars 2017 amd64.

Lastly Import-VisualStudioVars 2017 amd64 needs to be executed for every new PowerShell session.
Is there a way to make this persistent?

We added your notes to our Wiki:
https://github.com/LoopPerfect/buckaroo/wiki/CPP-Development-in-PowerShell

Was this page helpful?
0 / 5 - 0 ratings