Closed maddie closed 8 years ago
Thanks for your report, I haven't tried cross compiling yet as it currently requires CGO under Windows unfortunately. I'm going to get rid of it.
Try COM1
as the address, if it doesn't work, you might give this a shot: \\.\COM1
. (note that the string have to be escaped and it will be "\\\\.\\COM22"
.
Thanks for your response.
I'm aware that compiling on Windows it tells me gcc is not found, that's why I was trying to cross compile in a Linux host.
For now I'll try to set up the Windows environment and compile, thanks again for your great work!
You still need cgo in Windows, please refer here for installation: https://github.com/golang/go/wiki/cgo (as mentioned in README).
In order to use cgo on Windows, you'll also need to first install a gcc compiler (for instance, mingw-w64) and have gcc.exe (etc.) in your PATH environment variable before compiling with cgo will work.
Removing cgo is in progress, it will make building in Windows much less painful :)
Alright, thanks!
@maddie I've just replace cgo dependency with its generated files. Please let me know if you find any issues. Thanks.
Hi there!
Compiling for GOOS=windows GOARCH=amd64
and GOARCH=386
is now successful under Linux.
However compiling for GOARCH=386
fails with following message under OSX:
COOS=windows GOARCH=386 go build -o hello.exe main.go [16:20:17]
# github.com/goburrow/serial
/path/to/gopath/src/github.com/goburrow/serial/serial_darwin.go:179: cannot use flag (type uint64) as type uint32 in assignment
/path/to/gopath/src/github.com/goburrow/serial/serial_darwin.go:181: cannot use flag (type uint64) as type uint32 in assignment
/path/to/gopath/src/github.com/goburrow/serial/serial_darwin.go:192: invalid operation: termios.Cflag |= flag (mismatched types uint32 and uint64)
Thank you!
I guess it could be related to the OS (since OS X are all 64-bit now), so if it's not an easy fix, building on Linux would suffice.
Thank you!
Not sure if OS X can be used on 386 :P
github.com/goburrow/modbus
depends on this library, and when I try to run:GOOS=windows GOARCH=amd64 go build -o hello.exe main.go
It says:
So it's currently not possible to cross compile? (Linux host, Windows binary)
And a side question that doesn't really deserve another issue -- under Linux we can use
/dev/ttyS0
as the address, what if in Windows? Just useCOM1
?Thanks a lot for your work!