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

build failed on mac about cgo #67

Closed
upccup opened this issue Sep 1, 2015 · 3 comments
Closed

build failed on mac about cgo #67

upccup opened this issue Sep 1, 2015 · 3 comments
Assignees

Comments

@upccup
Copy link

upccup commented Sep 1, 2015

i meet a problem when build gopsutil on mac

full error output:
not-type:1:35: error: use of undeclared identifier 'cgo_undefined'
void *cgo_f_1_2(void) { GoBytes __cgo_undefined; }

not-const:1:63: error: invalid operands to binary expression ('GoBytes (_)(void *, int)' and 'int')
void cgo_f_1_3(void) { enum { __cgo__undefined = (GoBytes)_1 }; }

not-type:2:52: error: use of undeclared identifier 'cgo_undefined'
void *cgo_f_2_2(void) { HOST_CPU_LOAD_INFO_COUNT __cgo_undefined; }

not-const:3:81: error: indirection requires pointer operand ('int' invalid)
void cgo_f_3_3(void) { enum { __cgo__undefined = (host_cpu_load_info_data_t)*1 }; }

not-const:4:67: error: indirection requires pointer operand ('int' invalid)
void cgo_f_4_3(void) { enum { __cgo__undefined = (host_info_t)*1 }; }

not-type:5:47: error: use of undeclared identifier 'cgo_undefined'
void *cgo_f_5_2(void) { host_processor_info __cgo_undefined; }

not-const:5:75: error: invalid operands to binary expression ('kern_return_t (_)(host_t, processor_flavor_t, natural_t *, processor_info_array_t *, mach_msg_type_number_t *)' and 'int')
void cgo_f_5_3(void) { enum { __cgo__undefined = (host_processor_info)_1 }; }

not-type:6:43: error: use of undeclared identifier 'cgo_undefined'
void *cgo_f_6_2(void) { host_statistics __cgo_undefined; }

not-const:6:71: error: invalid operands to binary expression ('kern_return_t (_)(host_t, host_flavor_t, host_info_t, mach_msg_type_number_t *)' and 'int')
void cgo_f_6_3(void) { enum { __cgo__undefined = (host_statistics)_1 }; }

not-const:7:62: error: indirection requires pointer operand ('int' invalid)
void cgo_f_7_3(void) { enum { __cgo__undefined = (host_t)*1 }; }

@shirou shirou self-assigned this Sep 3, 2015
@shirou
Copy link
Owner

shirou commented Sep 3, 2015

cgo is required to build on darwin (see #66). I think this error is related to cgo. Could you check your installed go argument? Go should be build with cgo-enabled.

Could you try to build CGO_ENABLED=1 like

CGO_ENABLED=1 go test ./...

Thank you.

@upccup
Copy link
Author

upccup commented Sep 6, 2015

@shirou it's ok after i reinstall with sudo brew install go. Thank you very much

@shirou
Copy link
Owner

shirou commented Sep 6, 2015

grad to hear that. if you meet other problem, feel free to open an issue.

@shirou shirou closed this as completed Sep 6, 2015
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

No branches or pull requests

2 participants