-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/cgo: failed to run c-archive library built for iOS #41177
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
Comments
Could you clarify what is "no change"? It still doesn't work after downgrading, or it goes back to work? Thanks. That error message is indeed mysterious... |
Does not work after downgrade; same error with 1.14.6 |
Seems to be an environment issue that I have yet to track down. I've been able to take the same code and build successfully on another machine; copy the library to the failing machine and now XCode builds successfully. |
I encountered the same problem but the build mode is "archive", it work with build mode "c-archive", can someone take a look in this?
|
@daxzhuo build mode "archive" is intended to build a Go package, not a C library. See |
I got the same error. Here is my environment: Golang: v1.20.6 @rogchap Hi, you mentioned it worked in another environment. Could you share the differences? |
I wasn't able to track down the exact issue. The two machines had the same versions of everything; one succeeded, one had this error. The only thing I was less confident on was XCode and xcode-tools, which may have had a rouge setting 🤷♂️ Unlikely the solution you want, but I ended up rebuilding my machine, installing everything from scratch and it fixed the issue. 😬 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Create a simple go program that has C export function:
build the code with the following:
Build is successful.
Add the
arm64.a
andarm64.h
to an iOS project in XCode, and add#import "arm64.h"
to the bridging header file.Call the
sayHello
function from Swift:What did you expect to see?
XCode to build successfully, and the
helloLabel
to be updated with "Hello from Go".What did you see instead?
I get a very strange error from XCode that states
iOS-arm64 != iOS-arm64
!:Ps. I previously had this working successfully, but I can't see what changed other than upgrading to Go 1.15 (I tried downgrading to 1.14.6 but no change) and updating Catalina to 10.15.6
The text was updated successfully, but these errors were encountered: