wellington/wellington

Windows throws segfault in libsass

drewwells opened this issue · 6 comments

For reasons unknown, there are segfaults in go-libsass for Windows only.

To repo:

  1. Windows
  2. @error or Sass that produces any sort of error
  3. Segfault

Expected:
output error message

Works for me using cross compiled wt.exe from master yesterday. At least for undefined variables ;) If you're interested I could provide binaries for win/win64.

C:\Users\xxx\Documents>wt compile illegal.scss
2016/01/11 15:58:18 ←[31mError > C:/Users/xxx/Documents/illegal.scss:7
Undefined variable: "$padding".←[0m

Can you try compiling with this:
https://github.com/wellington/go-libsass/blob/master/blah/error.scss

Anything special you did to compile the binary? I haven't been able to repo
this outside of the go tool chain so might be a side effect in cgo build
optimizations.

On Mon, Jan 11, 2016, 9:24 AM kopernikus notifications@github.com wrote:

Works for me using cross compiled wt.exe from master yesterday. At least
for undefined variables ;) If you're interested I could provide binaries
for win/win64.

C:\Users\xxx\Documents>wt compile illegal.scss
2016/01/11 15:58:18 ←[31mError > C:/Users/xxx/Documents/illegal.scss:7
Undefined variable: "$padding".←[0m


Reply to this email directly or view it on GitHub
#160 (comment)
.

For the 386 build I get the correct error message:

C:\Users\xxx\Documents>type error.scss
p {

C:\Users\xxx\Documents>wt compile error.scss
2016/01/11 21:16:02 �[31mError > C:/Users/xxx/Documents/error.scss:1
Invalid CSS after "p {": expected "}", was ""�[0m`

I built it directly from the wellington/wt dir because go get -u github.com/wellington/wellington did not produce any result. IIRC go build github.com/wellington/wellington/wt worked..., Anyway the build command was:
env GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ CGO_LDFLAGS="-static" go build -o wt.exe -x -ldflags "-extldflags '-static'" main.go

With the 64-bit build however I do get the backtrace below. Build command was: env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CGO_LDFLAGS="-static" go build -o wt64.exe -x -ldflags "-extldflags '-static'" main.go

Both binaries are built on debian jessie with:

  • build-essential
  • gcc-mingw-w64 4.6.3-14+8
  • g++-mingw-w64 4.6.3-14+8
  • gcc-multilib 4.7.2-1

binaries tested on windows 10 enterprise

hth

C:\Users\xxx\Documents>wt64 compile error.scss
Exception 0x20474343 0x41e3e80 0x0 0x7ffd0940a1c8
PC=0x7ffd0940a1c8
signal arrived during external code execution

github.com/wellington/go-libsass/libs._Cfunc_sass_compiler_parse(0x1c2e870, 0x0)
github.com/wellington/go-libsass/libs/_obj/_cgo_gotypes.go:244 +0x3c
github.com/wellington/go-libsass/libs.SassCompilerParse(0x1c2e870)
/opt/gopkgs/src/github.com/wellington/go-libsass/libs/wrap.go:217 +0x28
github.com/wellington/go-libsass.(_Context).FileCompile(0xc0820a4000, 0xc082002300, 0xa, 0x3da41c0, 0xc082020010, 0x0, 0x0)
/opt/gopkgs/src/github.com/wellington/go-libsass/context.go:142 +0x1dd
github.com/wellington/go-libsass.(_sass).run(0xc08206d5e0, 0x0, 0x0)
/opt/gopkgs/src/github.com/wellington/go-libsass/compiler.go:241 +0x9e
github.com/wellington/go-libsass.(_sass).Run(0xc08206d5e0, 0x0, 0x0)
/opt/gopkgs/src/github.com/wellington/go-libsass/compiler.go:284 +0x34
github.com/wellington/wellington.loadAndBuild(0xc082002300, 0xa, 0xc08206d400, 0xc082007320, 0x3da48a0, 0xc082020010, 0x0, 0x0, 0x0, 0x0)
/opt/gopkgs/src/github.com/wellington/wellington/build.go:295 +0x4b3
github.com/wellington/wellington.(_Build).build(0xc08206a180, 0xc082002300, 0xa, 0x0, 0x0)
/opt/gopkgs/src/github.com/wellington/wellington/build.go:168 +0x2f9
github.com/wellington/wellington.(_Build).doBuild.func1(0xc08206a180, 0xc082002300, 0xa)
/opt/gopkgs/src/github.com/wellington/wellington/build.go:143 +0x40
created by github.com/wellington/wellington.(_Build).doBuild
/opt/gopkgs/src/github.com/wellington/wellington/build.go:148 +0x1c1

goroutine 1 [chan receive]:
github.com/wellington/wellington.(_Build).Run(0xc08206a180, 0x0, 0x0)
/opt/gopkgs/src/github.com/wellington/wellington/build.go:118 +0xec
main.run(0xc08208f0f0, 0x1, 0x1, 0xc082007320, 0xc08206d400)
/opt/gopkgs/src/github.com/wellington/wellington/wt/main.go:398 +0x42b
main.Compile(0xc27d20, 0xc08208f0f0, 0x1, 0x1)
/opt/gopkgs/src/github.com/wellington/wellington/wt/main.go:373 +0xf5
github.com/spf13/cobra.(_Command).execute(0xc27d20, 0xc08208f080, 0x1, 0x1, 0x0, 0x0)
/opt/gopkgs/src/github.com/spf13/cobra/command.go:569 +0x870
github.com/spf13/cobra.(_Command).ExecuteC(0xc28320, 0xc27d20, 0x0, 0x0)
/opt/gopkgs/src/github.com/spf13/cobra/command.go:656 +0x572
github.com/spf13/cobra.(_Command).Execute(0xc28320, 0x0, 0x0)
/opt/gopkgs/src/github.com/spf13/cobra/command.go:615 +0x34
main.main()
/opt/gopkgs/src/github.com/wellington/wellington/wt/main.go:175 +0x34

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/opt/go-1.5.2/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 5 [semacquire]:
sync.runtime_Semacquire(0xc08206a1a4)
/opt/go-1.5.2/go/src/runtime/sema.go:43 +0x2d
sync.(_WaitGroup).Wait(0xc08206a198)
/opt/go-1.5.2/go/src/sync/waitgroup.go:126 +0xbb
github.com/wellington/wellington.(_Build).doBuild(0xc08206a180)
/opt/gopkgs/src/github.com/wellington/wellington/build.go:137 +0x122
github.com/wellington/wellington.(_Build).Run.func1(0xc08206a180)
/opt/gopkgs/src/github.com/wellington/wellington/build.go:113 +0x57
created by github.com/wellington/wellington.(_Build).Run
/opt/gopkgs/src/github.com/wellington/wellington/build.go:114 +0x96
rax 0x8c
rbx 0x41e3e80
rcx 0x0
rdi 0x41e3ec0
rsi 0xb90a10
rbp 0x24f0f0
rsp 0x24ef30
r8 0x7ffd0bf1aa68
r9 0x1c20000
r10 0x2
r11 0xd0
r12 0x24f280
r13 0x24f240
r14 0x24f250
r15 0x24f3d0
rip 0x7ffd0940a1c8
rflags 0x206
cs 0x33
fs 0x53
gs 0x2b

Hmm, I have not tried 32bit windows. If that works, that's good enough Windows support for me!

Thank you for the windows cgo instructions! For the first time, I'm building cgo based windows binaries locally :)

I'm curious if there's a way to force go test into a specific GOARCH. This would make it possible to CI the project on windows