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

Fix build on iOS #134

Closed

Conversation

jeanregisser
Copy link

This PR fixes a compilation error on iOS as seen in ethereum/go-ethereum#20160

Unfortunately libproc.h is not included in the iOS SDK. The missing headers were taken from Xcode 11.3.1 (/Applications/Xcode11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/).

Let me know what you think. Thanks.

Headers taken from /Applications/Xcode11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
@cla-checker-service
Copy link

❌ Author of the following commits did not sign a Contributor Agreement:
8818624, 8d0b88c, bce15e6, 73c1cd0

Please, read and sign the above mentioned agreement if you want to contribute to this project

@holiman
Copy link

holiman commented Mar 26, 2020

ping @jeanregisser would you be open to signing that CLA? I guess this PR is blocked for that reason

@jeanregisser
Copy link
Author

Yes I did follow the process and signed the document on DocuSign but somehow the bot didn’t update the status.

I’ll retry today.

@arnaubennassar
Copy link

Is there any update on this?

@andrewkroh
Copy link
Member

We don't want to include and maintain Apple's headers in this project. Apple should add the necessary headers to their IOS SDK if they are meant to be used to IOS projects. I recommend using tags to exclude the use of gosigar from projects that need to compile for mobile.

I think we would accept a patch to include sigar_stub.go for IOS. It would need to be accompanied by tests on Travis CI that verify builds work for gomobile build -target=ios -x ., GOOS=darwin GOARCH=amd64 build, and GOOS=darwin GOARCH=386 go build ..

I did check if the MacOS SDK would work unmodified, but, no, it did not work without cherry-picking particular files as this PR has done. Specifically some of the headers complain that architecture not supported due to ARM.

The other issue I encountered is that gomobile doesn't support -gccgoflags or CGO_CFLAGS. So you cannot pass through the CFLAGS option. The only way I could set the value was by adding a source file with a CGO "comment" that set CFLAGS. From gomobile help build:

The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
shared with the build command. For documentation, see 'go help build'.

@user1121114685
Copy link

感谢你的支持,成功的解决了编译错误的问题,这个修复在
https://github.com/shirou/gopsutil
中支持良好,一次性解决了编译问题,非常感谢。

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 this pull request may close these issues.

5 participants