Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on windows getopt.h No such file or directory #13

Open
gregbown opened this issue Sep 22, 2017 · 2 comments
Open

Build on windows getopt.h No such file or directory #13

gregbown opened this issue Sep 22, 2017 · 2 comments

Comments

@gregbown
Copy link

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
Copy link
Author

gregbown commented Sep 22, 2017

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 gregbown changed the title Build on windows no such package @io_bazel_rules_sass//sass Build on windows getopt.h No such file or directory Sep 22, 2017
laszlocsomor added a commit to laszlocsomor/rules_sass that referenced this issue Apr 3, 2018
alexeagle pushed a commit that referenced this issue Apr 4, 2018
* windows: README.md's example now builds on Windows

Depends on: #18
See: #13

* windows: @sassc//:sassc compiles with SassC 3.5.2
@filipesilva
Copy link

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

gonzojive pushed a commit to gonzojive/rules_sass that referenced this issue Feb 19, 2023
* chore(deps): update actions/checkout action to v3

* chore: update actions/cache as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants