sevlyar / go-daemon

A library for writing system daemons in golang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't cross-compile to darwin

sb10 opened this issue · comments

I don't know how to reproduce this "normally", but I'm using go 1.8.1 on linux, https://glide.sh/get to manage my dependencies (of which go-daemon is one), and github.com/gobuild/gopack to build release zips for different platforms. Here's what happens when it tries to build the darwin version:

# github.com/VertebrateResequencing/wr/vendor/github.com/sevlyar/go-daemon
vendor/github.com/sevlyar/go-daemon/lock_file.go:53: undefined: lockFile
vendor/github.com/sevlyar/go-daemon/lock_file.go:58: undefined: unlockFile
vendor/github.com/sevlyar/go-daemon/lock_file.go:121: undefined: getFdName
2017/06/07 15:11:28 [Fatal] pack.go:80 exit status 2

This error doesn't make much sense to me, since I can grep for lockFile in that directory and its found in vendor/github.com/sevlyar/go-daemon/lock_file_darwin.go.

I didn't investigate further. Instead I had to specify in my glide configuration that I use old commit 01bb5ca of go-daemon before this would work.

If you want to cross-compile the package you should enable cgo (CGO_ENABLED=1) because the package uses cgo and cgo is disabled by default when cross-compiling. I do not recommend you to use 01bb5ca commit because some bugs was fixed by next commits.