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

gosigar won't build for IOS #137

Open
andrewkroh opened this issue May 14, 2020 · 2 comments
Open

gosigar won't build for IOS #137

andrewkroh opened this issue May 14, 2020 · 2 comments

Comments

@andrewkroh
Copy link
Member

libproc is not available in the IOS SDK. The build tags on the files could be updated to include the sigar_stub.go and exclude the darwin files to word-around the issue for any projects that use this library.

If this is pursued then the project should add a test that compiles work for

GOOS=darwin GOOS=amd64 go build .
GOOS=darwin GOOS=386 go build .
gomobile build -target=ios .

The README should also be updated to include a note about IOS.

@andrewkroh
Copy link
Member Author

Relates: #134

birros added a commit to birros/gosigar that referenced this issue Dec 19, 2021
@birros
Copy link

birros commented Dec 19, 2021

I found a tricky way to make ios build. I added a cgo flags with include dir pointing to macOS sdk where libproc.h is located.

I'm not doing a pull request because I don't know if you accept this trick, it's not a fix. I'll let you choose if it's relevant.

package gosigar

/*
#cgo CFLAGS: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
#include <libproc.h>
*/
import "C"

Example: birros/gosigar/blob/v0.12.0-fix-ios/sigar_darwin.go#L6

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

No branches or pull requests

2 participants