rules_sass icon indicating copy to clipboard operation
rules_sass copied to clipboard

Build on windows getopt.h No such file or directory

Open gregbown opened this issue 8 years ago • 2 comments

On windows, following directions in README results in no such package @io_bazel_rules_sass//sass Is there a step missing? Is there an updated tag? Does this assume the sass directory is also inside my project?

Any direction welcome Thank you

Bazel

C:\Users\gbown\Documents\bazel-sass-test>bazel version Build label: 0.5.4 Build target: bazel-out/msvc_x64-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Fri Aug 25 09:59:45 2017 (1503655185) Build timestamp: 1503655185 Build timestamp as int: 1503655185

My WORKSPACE

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "io_bazel_rules_sass", remote = "https://github.com/bazelbuild/rules_sass.git", tag = "0.0.2", ) load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories") sass_repositories()

Build error

C:\Users\gbown\Documents\bazel-sass-test>bazel build //scss:bootstrap ERROR: error loading package '': Encountered error while reading extension file 'sass/sass.bzl': no such package '@io_bazel_rules_sass//sass': Traceback (most recent call last): File "C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external/bazel_tools/tools/build_defs/repo/git.bzl", line 67 _clone_or_update(ctx) File "C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external/bazel_tools/tools/build_defs/repo/git.bzl", line 42, in _clone_or_update fail(("error cloning %s:\n%s" % (ctx....))) error cloning io_bazel_rules_sass:

  • cd C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external /bin/bash: line 2: cd: C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external: No such file or directory
  • cd C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external/io_bazel_rules_sass /bin/bash: line 7: cd: C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external/io_bazel_rules_sass: No such file or directory . INFO: Elapsed time: 0.772s C:\Users\gbown\Documents\bazel-sass-test>

gregbown avatar Sep 22 '17 02:09 gregbown

load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories") sass_repositories()

This partially works on windows only if you create a sass folder inside your project with the BUILD and sass.bzl files from this repo.

Use the following directory structure for a simple Sass project:

[workspace]/
    WORKSPACE
    sass
       BUILD
       sass.bzl
    hello_world/
        BUILD
        main.scss
    shared/
        BUILD
        _fonts.scss
        _colors.scss

The build seems to start fine after providing the missing structure but then fails to find getopt.h

C:\Users\gbown\Documents\bazel-sass-test>bazel build //scss:bootstrap INFO: Found 1 target... INFO: From Compiling external/libsass/src/json.cpp [for host]: external/libsass/src/json.cpp(25): warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition external/libsass/src/json.cpp(25): note: command-line arguments: see previous definition of '_CRT_SECURE_NO_WARNINGS' INFO: From Compiling external/libsass/src/sass2scss.cpp [for host]: external/libsass/src/sass2scss.cpp(2): warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition external/libsass/src/sass2scss.cpp(2): note: command-line arguments: see previous definition of '_CRT_SECURE_NO_WARNINGS' INFO: From Compiling external/libsass/src/file.cpp [for host]: external/libsass/src/file.cpp(14): warning C4005: 'NOMINMAX': macro redefinition external/libsass/src/file.cpp(14): note: command-line arguments: see previous definition of 'NOMINMAX' ERROR: C:/users/gbown/appdata/local/temp/_bazel_gbown/z_ou-6_r/external/sassc/BUILD.bazel:4:1: C++ compilation of rule '@sassc//:sassc' failed (Exit 2). external/sassc/sassc.c(10): fatal error C1083: Cannot open include file: 'getopt.h': No such file or directory Target //scss:bootstrap failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 26.528s, Critical Path: 11.16s

--verbose_failures

SET PWD=/proc/self/cwd
SET TEMP=C:\Users\gbown\AppData\Local\Temp
SET TMP=C:\Users\gbown\AppData\Local\Temp

C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/HostX64/x64/cl.exe /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SEC /wd4996 /nologo /Iexternal/sassc /Ibazel-out/host/genfiles/external/sassc /Iexternal/libsass /Ibazel-out/host/genfiles/external/libsass /Iexternal/bazel_tools /Ibazel-out/host/genfiles/external/bazel_t /gcc3 /showIncludes /MT /O2 /c external/sassc/sassc.c /Fobazel-out/host/bin/external/sassc/_objs/sassc/external/sassc/sassc.o. external/sassc/sassc.c(10): fatal error C1083: Cannot open include file: 'getopt.h': No such file or directory

The build appears to make symbolic links from my work directory C:\Users\gbown\Documents\bazel-sass-test\bazel-bazel-sass-test\external\sassc that link to C:\Users\gbown\AppData\Local\Temp_bazel_gbown\z_OU-6_R\external\sassc There is a file getopt.h at a slightly deeper path. C:\Users\gbown\AppData\Local\Temp_bazel_gbown\z_OU-6_R\external\sassc\win\posix\getopt.h

What I see in sass.c is the include to the file in question #include <getopt.h>

Inside the win directory sassc.vcxproj.filters has ClInclude Include with path

gregbown avatar Sep 22 '17 16:09 gregbown

I was seeing this error on 0.0.3 but after updating to 1.10.3 it was gone.

filipesilva avatar Aug 10 '18 13:08 filipesilva