Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install error on mac #23

Closed
meirf opened this issue Feb 7, 2018 · 6 comments · Fixed by #33
Closed

install error on mac #23

meirf opened this issue Feb 7, 2018 · 6 comments · Fixed by #33

Comments

@meirf
Copy link

meirf commented Feb 7, 2018

Running $ go get github.com/Azure/azure-storage-blob-go/2016-05-31/azblob

gives me this output

# github.com/Azure/azure-storage-blob-go/2016-05-31/azblob
gocode/src/github.com/Azure/azure-storage-blob-go/2016-05-31/azblob/highlevel.go:164:7: undefined: mmf
gocode/src/github.com/Azure/azure-storage-blob-go/2016-05-31/azblob/highlevel.go:166:12: undefined: newMMF

My environment:

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mfischer/alpha/gocode"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mm/q2bf08hn361bhqqq5wy38ssc0000gn/T/go-build111810440=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

Edit:
oh I see there are files for windows/linux but none for mac. For now, I'll comment out that code since looks like only used as example.

@meirf meirf changed the title install error install error on mac Feb 7, 2018
@meirf meirf closed this as completed Feb 7, 2018
@JeffreyRichter
Copy link
Member

Yes, we will. For now, rename mmap_linux.go to mmap_darwin.go and you should be good. I have the fix for this but it is not checked in yet.

@brusMX
Copy link

brusMX commented Feb 20, 2018

Actually the file name has changed

mv mmf_darwin_linux.go mmf_darwin.go

@shanebarnes
Copy link

Renaming the file with a "_unix" suffix should allow for successful builds targeting both darwin and linux:

mv mmf_darwin_linux.go mmf_unix.go

@JeffreyRichter
Copy link
Member

Renaming to mmf_unix.go will break the build on Windows. However, I think I fixed this awhile a go by adding "// +build linux darwin" to the .go file.

@shanebarnes
Copy link

shanebarnes commented Mar 16, 2018

According to the documentation (https://golang.org/pkg/go/build/#overview), using a conditional compilation suffix should take the following form: source_GOOS_GOARCH.go (e.g., source_windows_amd64.go). So using the build tags is appropriate in this case but the file suffix must not trigger an implicit conditional compilation.

@JeffreyRichter
Copy link
Member

If you run "go tool dist list", you'll see the list of supported GOOS/GOARC combinations. "unix" is not on the list at all and therefore not a supported GOOS. So, a file name ending with "_unix.go" is ALWAYS compiled by the compiler regardless of the GOOS. This is why I MUST add "// +build linux darwin" to the top of my file. Alternatively, I could have to files with identical contents but one named mmf_darwin.go and the other named mmf_linux.go. I prefer the 1 file so I don't have to make similar changes in multiple files.

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

Successfully merging a pull request may close this issue.

4 participants