openimsdk / openim-sdk-core

Instant Messaging
https://openim.io
Apache License 2.0
340 stars 310 forks source link

[Compile]: How to compile IOS version #516

Open zhaolibo1989 opened 6 months ago

zhaolibo1989 commented 6 months ago

What would you like to share?

I am trying to compile Android, WASM, and IOS versions on the Windows platform.

I have successfully compiled Android and WASM versions using the following scripts.

Android:

go get golang.org/x/mobile/bind
go env -w GOOS=windows GOARCH=amd64
set JAVA_TOOL_OPTIONS=-Dfile.encoding=utf-8 
gomobile bind -v -trimpath -ldflags="-s -w" -o ./open_im_sdk.aar -target=android ./open_im_sdk/ ./open_im_sdk_callback/

WASM:

go env -w GOOS=js GOARCH=wasm 
go build -trimpath -ldflags "-s -w" -o ./_output/bin/openIM.wasm wasm/cmd/main.go

However, using similar scripts cannot compile the IOS version.

IOS:

go get golang.org/x/mobile/bind

RMDIR /Q build
RMDIR /Q open_im_sdk\ws_wrapper
DEL /Q open_im_sdk\t_friend_sdk.go
DEL /Q open_im_sdk\t_group_sdk.go

go env -w GOOS=darwin GOARCH=arm64
gomobile bind -v -trimpath -ldflags "-s -w" -o build/OpenIMCore.xcframework -target=ios ./open_im_sdk/ ./open_im_sdk_callback/

How can I complie the IOS version?

Additional information

My IOS build script output:

D:\work\code\OpenIMSDK\openim-sdk-core>go get golang.org/x/mobile/bind

D:\work\code\OpenIMSDK\openim-sdk-core>RMDIR /Q build
系统找不到指定的文件。

D:\work\code\OpenIMSDK\openim-sdk-core>RMDIR /Q open_im_sdk\ws_wrapper
系统找不到指定的文件。

D:\work\code\OpenIMSDK\openim-sdk-core>DEL /Q open_im_sdk\t_friend_sdk.go
找不到 D:\work\code\OpenIMSDK\openim-sdk-core\open_im_sdk\t_friend_sdk.go

D:\work\code\OpenIMSDK\openim-sdk-core>DEL /Q open_im_sdk\t_group_sdk.go
找不到 D:\work\code\OpenIMSDK\openim-sdk-core\open_im_sdk\t_group_sdk.go

D:\work\code\OpenIMSDK\openim-sdk-core>go env -w GOOS=darwin GOARCH=arm64

D:\work\code\OpenIMSDK\openim-sdk-core>gomobile bind -v -trimpath -ldflags "-s -w" -o build/OpenIMCore.xcframework -target=ios ./open_im_sdk/ ./open_im_sdk_callback/
gomobile: -target="ios" requires Xcode
FGadvancer commented 6 months ago

Make sure that you have successfully set up the Go environment and gomobile environment, and have installed Xcode on your Mac. If you are still experiencing issues, please provide detailed logs, as well as the version of your Mac and Xcode.

kubbot commented 4 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

kubbot commented 4 months ago

This issue was closed because it has been stalled for 7 days with no activity.