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

Make on MacOS fails #449

Closed
larrypl opened this issue May 26, 2021 · 8 comments · Fixed by #452
Closed

Make on MacOS fails #449

larrypl opened this issue May 26, 2021 · 8 comments · Fixed by #452

Comments

@larrypl
Copy link

larrypl commented May 26, 2021

Error:

$ make
go build -ldflags="-s -w -X github.com/juicedata/juicefs/pkg/version.revision=bee415d -X github.com/juicedata/juicefs/pkg/version.revisionDate=2021-05-26 -X github.com/juicedata/juicefs/pkg/version.version=0.13.0-24"  -o juicefs ./cmd
# github.com/shirou/gopsutil/cpu
../../go/pkg/mod/github.com/shirou/gopsutil@v3.20.11+incompatible/cpu/cpu_darwin_cgo.go:13:5: error: 'TARGET_OS_MAC' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_MAC
    ^
1 error generated.
make: *** [Makefile:28: juicefs] Error 2
@davies
Copy link
Contributor

davies commented May 27, 2021

What's the version of macos?

@larrypl
Copy link
Author

larrypl commented May 27, 2021

Sorry, that would help - 11.4, Darwin 20.5.0.

@xiaogaozi
Copy link
Member

What's the version of LLVM? Please run clang --version and which -a clang. According to shirou/gopsutil#976, it seems like your LLVM isn't Apple's version. For reference, here is my output:

$ sw_vers
ProductName:	macOS
ProductVersion:	11.4
BuildVersion:	20F71

$ clang --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ which -a clang
/usr/bin/clang

@xiaogaozi
Copy link
Member

xiaogaozi commented May 27, 2021

Or you could try gopsutil v3.21.3 (may fix this issue), run following commands to upgrade gopsutil:

$ pwd
~/go/src/github.com/juicedata/juicefs
$ go get github.com/shirou/gopsutil@v3.21.3
$ go get github.com/tklauser/go-sysconf
$ make -B

Let us know if this method could solve your problem.

@xiaogaozi
Copy link
Member

@larrypl We already upgrade gopsutil to v3.21.3 and release JuiceFS v0.13.1, you could use this version to test.

@larrypl
Copy link
Author

larrypl commented Jun 1, 2021

Upgrading gopsutil fixed the problem!

It was likely the version of clang - it was MacPorts clang version 11.1.0.

make test has a bunch of failures; not sure that's expected. but that's a different issue. This issue is appropriately closed.

Thanks!

@gedw99
Copy link

gedw99 commented Jul 8, 2022

i also just hit this bug on latest main code

make juicefs

/Users/apple/workspace/go/pkg/mod/github.com/shirou/gopsutil@v3.20.11+incompatible/cpu/cpu_darwin_cgo.go:13:5: warning: 'TARGET_OS_MAC' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]

sw_vers
ProductName: macOS
ProductVersion: 11.6.7
BuildVersion: 20G630

@xiaogaozi
Copy link
Member

@gedw99 This is just a warning log and does not affect compiling JuiceFS on macOS.

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