Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Support for windows/amd64 ? #13

Open
slass100 opened this issue Jun 8, 2018 · 10 comments
Open

Support for windows/amd64 ? #13

slass100 opened this issue Jun 8, 2018 · 10 comments

Comments

@slass100
Copy link

slass100 commented Jun 8, 2018

C:\Users\u1\go>go version
go version go1.10.3 windows/amd64

C:\Users\u1\go>go get -v github.com/google/goexpect
github.com/google/goterm/term
# github.com/google/goterm/term
src\github.com\google\goterm\term\termios.go:202:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:202:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:213:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:213:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:288:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:288:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:310:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:310:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:319:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:319:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:319:32: too many errors

@arowden
Copy link

arowden commented Jun 19, 2018

Unfortunately goterm\term doesn't support windows or mac. I had this issue as well. Not sure why they coupled it so tightly to this project knowing that...

@skalle
Copy link
Contributor

skalle commented Jul 4, 2018

As you already figured out this is due to the term package being Linux only, mainly due to the PTY functions, this is needed when spawning local commands with the Expect package..

For spawners like SSH/Telnet/Fake/Generic this is not needed and it'd be fully possible to detect !Linux environments and skip the PTY parts when building as would adding PTY support for BSD/MacOS/Windows ..

I'd be more than happy to take a PRs to fix this but personally I don't have the time , or any boxes running !Linux for that matter , to make expect run on !Linux environments.

@skalle
Copy link
Contributor

skalle commented Jul 15, 2018

I've devised a bit of a plan here ... Plan is to use the Go build system to skip building the OpenPTY parts when building on !Linux platforms .. This should enable using goexpect everywhere except for the local process part..

@skalle
Copy link
Contributor

skalle commented Jul 19, 2018

Just an update, will be a bit longer before goexpect will build on a windows machine.

https://github.com/google/goterm/tree/buildExperiment - Began to split the builds up with that one ... Will need to change some stuff in Expect too before it'll build.

@yingshaoxo
Copy link

C:\Users\u1\go>go version
go version go1.10.3 windows/amd64

C:\Users\u1\go>go get -v github.com/google/goexpect
github.com/google/goterm/term

github.com/google/goterm/term

src\github.com\google\goterm\term\termios.go:202:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:202:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:213:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:213:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:288:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:288:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:310:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:310:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:319:32: not enough arguments in call to syscall.Syscall
src\github.com\google\goterm\term\termios.go:319:33: undefined: syscall.SYS_IOCTL
src\github.com\google\goterm\term\termios.go:319:32: too many errors

Same problem here.

@yingshaoxo
Copy link

I did a test:

Found that if I import "github.com/google/goexpect", the error will cause.


My compile command is:

export CGO_ENABLED=0

mkdir bin
rm bin/* -fr
cd bin

go get github.com/mitchellh/gox
gox -output="{{.OS}}_{{.Arch}}" -os="windows" -osarch="linux/amd64" -osarch="linux/arm" ../src
cd ..

It supposes to work well when I use the following code:

import (
	"github.com/google/goexpect"
	"runtime"
)

func windows_processing() {
}

func linux_processing() {
}

func macos_processing() {
}

func Doit() {
	if runtime.GOOS == "windows" {
		windows_processing()
	} else if runtime.GOOS == "linux" {
		linux_processing()
	} else if runtime.GOOS == "darwin" {
		macos_processing()
	}
}

runtime.GOOS will also work at compiling time.

You should add that check when you init this package. @skalle

@yingshaoxo
Copy link

yingshaoxo commented Nov 5, 2019

Sorry for disturbing you guys.

runtime.GOOS will not work at the time of compiling.

Now I think Golang's cross-compiling system is quite Useless.

It works only if you use a non-native library.

https://stackoverflow.com/questions/43215655/building-multiple-binaries-using-different-packages-and-build-tags

@niltooth
Copy link

Any progress made on this?

@skalle
Copy link
Contributor

skalle commented Mar 27, 2020

Hey dev-mull and others following this.

Not much progress, all due to lack of cycles.
I did have a BSD version going but never managed to get all the needed tests and such in.

If anywone would like to tackle this it'd be great, I'd be more than happy to get someone up to speed.

@skalle skalle removed their assignment Mar 27, 2020
@QGB
Copy link

QGB commented Jul 10, 2022

CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "-s -w -buildid="
undefined: syscall.SYS_IOCTL

undefined: syscall.TIOCSWINSZ

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants