Skip to content
baio edited this page Jul 24, 2019 · 15 revisions

Issues

Error cloning rules when using git_repository on Windows

Related issues:

Solution:

  1. Make sure MSYS2 is installed along with it’s git package.

  2. Check git from MSYS2 is the first one in the path:

where git
C:\msys64\usr\bin\git.exe
C:\Program Files\Git\cmd\git.exe
C:\Program Files\Git\mingw64\bin\git.exe

If not, rearrange PATH environment variable values (Start → type "env" → Edit the system environment variables → Click "Environment Variables...") and make sure path to msys64\usr\bin comes first.

Build error SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE

When start build dotnet project get following error

INFO: Analyzed target //:bin (1 packages loaded, 1 target configured).
INFO: Found 1 target...
ERROR: C:/users/max/_bazel_max/x72jrr46/external/io_bazel_rules_dotnet/dotnet/tools/common/BUILD:3:1: C++ compilation of rule '@io_bazel_rules_dotnet//dotnet/tools/common:common' failed (Exit 2)
external/io_bazel_rules_dotnet/dotnet/tools/common/manifest.c(102): error C2065: 'SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE': undeclared identifier
Target //:bin failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 79.104s, Critical Path: 19.20s
INFO: 1 process: 1 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Related :

Error occurs when you have multiple instances of Visual Studio / various versions of the Windows SDK and one of them is earlier than 2014, this case bazel try to build with older version and gives this error.

Fix is the same as for related issue, add BAZEL_VC which points to the latest Visual Studio compiler.

Build error .../Tools/MSVC (No such file or directory)

If you got this error even after visual studio installation and setting up BAZEL_VC variable, make sure you checked Desktop development with C++ workload.

Add nuget packages

To add nuget packages it is recommended to use nuget2bazel tool. It is not clear from documentation how to build this tool.

Following the steps to build this tool

  • clone rules_dotnet repo
  • move to the tools/nuget2bazel folder
  • run build dotnet publish -c Release -r win10-x64 full list of supported runtimes is here
  • copy build output from tools\nuget2bazel\bin\Release\netcoreapp2.1\win10-x64 to some folder
  • add this folder to PATH environment

Now you can add nugets to bazel workspace as following nuget2bazel add -p c:/dev/scalio/bazel/bazel-dotnetcore-starter ninject 3.3.0

TBD : Probably tool could be build by bazrel itself, for now couldn't figure out how.

Nuget metapackeges

nuget2bazel tools is not handle nuget metapackages For example if you want to create asp net core app you would like add asp net core libraries as follow nuget2bazel add Microsoft.AspNetCore.App 2.2.6 but it will generate (bazel version 0.28.0)

nuget_package(
    name = "microsoft.aspnetcore.app",
    core_lib = {
        "netcoreapp2.0": "lib/netstandard2.0/Microsoft.AspNetCore.dll",
        "netcoreapp2.1": "lib/netstandard2.0/Microsoft.AspNetCore.dll",
    },
    package = "microsoft.aspnetcore.app",
    sha256 = "474cf2813b91b62a291ef99845b6839049a2a2a8498b21ca7e404686930dfd6e",
    version = "2.2.0",
)

The problem here there is no dependencies on other packages though they should be. See issue

How to add manually asp net core libraries see AspNetCore folder

Build error GZip tool not found

Try to install GZip manually and add it to PATH

Errors during execution of container_pull / docker_image rules

Confirm python installed and set in PATH by typing python --version in console if nothing happens or error try to reinstall pyhon and set it in PATH

In case of some network errors try to run build in cmder not powershell.

Using linux subsystem on windows

If you encounter DOTNET_CLI_HOME missing error, use flag --spawn_strategy=standalone

Also see how to setup and connect docker in wsl.

CreateProcessW("cat" error on windows

This could be resolved by installing additional unix tools during git install