mdlayher / raw

Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.
MIT License
425 stars 71 forks source link

32bit build fails on Linux i686 #31

Closed vaizki closed 5 years ago

vaizki commented 5 years ago

I was trying to build a package which depends on github.com/google/gopacket/pcap which depends on this package. I need (yes I know...) really need to run it on a 32bit Linux install but the build fails:

# github.com/mdlayher/raw
../../mdlayher/raw/raw_linux.go:316:32: undefined: syscall.SYS_GETSOCKOPT
../../mdlayher/raw/raw_linux.go:329:32: undefined: syscall.SYS_SETSOCKOPT
../../mdlayher/raw/timeval.go:17:6: cannot use int64(timeout / time.Second) (type int64) as type int32 in field value
../../mdlayher/raw/timeval.go:18:7: cannot use int64(timeout % time.Second / time.Microsecond) (type int64) as type int32 in field value

I am aware that a i386 build is not a priority in 2018 but this could probably be solved with just build costraints and splitting out the statistics into a separate file?

So instead of // +build linux use '// +build linux,!386for 64bit and// +build linux,386` for the 32bit files? Unfortunately I am a Go beginner so testing this enough to present a patch is proving a bit painful for me...