openimsdk / open-im-sdk-ios

An OpenIM SDK in Objective-C for iOS
https://openim.io
MIT License
158 stars 143 forks source link

[FEATURE?]: Issue with Output Directory Structure when Building iOS SDK using gomobile #55

Open zhaolibo1989 opened 4 weeks ago

zhaolibo1989 commented 4 weeks ago

What would you like to share?

Title: Issue with Output Directory Structure when Building iOS SDK using gomobile

Hello,

I'm experiencing an issue with the output directory structure when building our iOS SDK using gomobile. After upgrading our Go version, the directory structure generated for the iOS framework has changed, which is causing compatibility issues with our iOS app.

Here are the details of my environment and the issue:

Previous Directory Structure:

OPENIMCORE.XCFRAMEWORK
│  Headers
│  Modules
│  OpenIMCore
│  Resources
│
└─Versions
    ├─A
    │  │  OpenIMCore
    │  │
    │  ├─Headers
    │  │      OpenIMCore.h
    │  │      Open_im_sdk.objc.h
    │  │      Open_im_sdk_callback.objc.h
    │  │      ref.h
    │  │      Universe.objc.h
    │  │
    │  ├─Modules
    │  │      module.modulemap
    │  │
    │  └─Resources
    │          Info.plist
    │
    └─Current
        │  OpenIMCore
        │
        ├─Headers
        │      OpenIMCore.h
        │      Open_im_sdk.objc.h
        │      Open_im_sdk_callback.objc.h
        │      ref.h
        │      Universe.objc.h
        │
        ├─Modules
        │      module.modulemap
        │
        └─Resources
                Info.plist

Current Directory Structure:

OPENIMCORE.XCFRAMEWORK
│  Info.plist
│
├─ios-arm64
│  └─OpenIMCore.framework
│      │  Info.plist
│      │  OpenIMCore
│      │
│      ├─Headers
│      │      OpenIMCore.h
│      │      Open_im_sdk.objc.h
│      │      Open_im_sdk_callback.objc.h
│      │      ref.h
│      │      Universe.objc.h
│      │
│      └─Modules
│              module.modulemap
│
└─ios-arm64_x86_64-simulator
    └─OpenIMCore.framework
        │  Info.plist
        │  OpenIMCore
        │
        ├─Headers
        │      OpenIMCore.h
        │      Open_im_sdk.objc.h
        │      Open_im_sdk_callback.objc.h
        │      ref.h
        │      Universe.objc.h
        │
        └─Modules
                module.modulemap

gomobile Command Used:

#!/bin/sh

VERSION=$(git describe --tags | sed -E 's/^v//')

echo VERSION: ${VERSION}

rm -rf build/ open_im_sdk/t_friend_sdk.go open_im_sdk/t_group_sdk.go  open_im_sdk/ws_wrapper/
GOARCH=arm64 gomobile bind -v -trimpath -ldflags "-s -w -X 'github.com/openimsdk/openim-sdk-core/v3/version.Version=${VERSION}'" -o build/OpenIMCore.xcframework -target=ios ./open_im_sdk/ ./open_im_sdk_callback/

The new directory structure is not compatible with our iOS app, and our developers are unable to use the SDK as expected. I've tried to troubleshoot by checking the gomobile version and ensuring that my environment is set up correctly, but the issue persists.

I would appreciate any guidance on how to resolve this issue or if there's a way to configure gomobile to generate the previous directory structure.

Thank you for your help!

Additional information

No response

zhaolibo1989 commented 3 weeks ago

The gomobile framework directory's generation code has been modified, with the commit log available here. For the code diff, you can check it out here.

As a workaround, you can use an earlier version of gomobile (v0.0.0-20240320162201-c76e57eead38) by running the following commands:

go get golang.org/x/mobile@v0.0.0-20240320162201-c76e57eead38
go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240320162201-c76e57eead38

This version corresponds to a point in time before the aforementioned code changes were made.

std-s commented 3 weeks ago

@zhaolibo1989 Hi, the go version we currently package xcframework for is 1.22.7; the xcode version is Version 15.2.