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

How to generate web3swift framework file from source #369

Closed
soharang opened this issue Aug 26, 2021 · 2 comments
Closed

How to generate web3swift framework file from source #369

soharang opened this issue Aug 26, 2021 · 2 comments

Comments

@soharang
Copy link

soharang commented Aug 26, 2021

hello,

I tried to follow the guide to build web3swift by my self with my local source.
But I couldn't get a valid framework file to apply to my project.

Here is my steps.

  1. I made a clone the branch named "develop" in my local storage because I need the commit which updates the version of libraries for xcode 12.5(Update Cartfile and Pods dependencies #330).
    It seems that the commit has not been merged into the official branch.

  2. I executed following commands in the source location.

    % brew install carthage
    % carthage update --platform iOS --use-xcframeworks
    % ./carthage-build.sh build --platform iOS
    
  3. I opened web3swift.xcworkspace and run Build by Cmd+B.

That was all from the guide, "Build from source" and I have no idea how to apply my build output.
So I tried following steps to create web3swift.xcframework.

% xcodebuild archive -scheme "web3swift" -archivePath "build/ios.xcarchive" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES 
% xcodebuild archive -scheme "web3swift" -archivePath "build/ios_simulator.xcarchive" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES 
% xcodebuild -create-xcframework -framework "build/ios.xcarchive/Products/Library/Frameworks/web3swift.framework" -framework "build/ios_simulator.xcarchive/Products/Library/Frameworks/web3swift.framework" -output "build/web3swift.xcframework" 

I got a web3swift.xcframework so I put this into my project by adding it in Frameworks and Libraries.
And when I try to import "web3swift" it says "Failed to build module 'web3swift' from its module interface; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced".

It seems that I did wrong during creating framework output because I cannot import other related libraries too such as BigInt and CryptoSwift.

Can anyone give me a little help to create a right library from source?

Here is my environment.

  • Xcode 12.5.1
  • Swift 5.4.2
  • Latest commit in the branch : a3b2acf
  • Carthage 0.38.0
  • Brew 3.2.9
  • Big Sur 11.4
@soharang soharang changed the title How to web3swift framework file from source How to generate web3swift framework file from source Aug 26, 2021
@soharang
Copy link
Author

soharang commented Aug 27, 2021

I solved the problem.
I added --no-skip-current parameter to build command and now I got web3swift.framework.
"% ./carthage-build.sh build --platform iOS --no-skip-current"

So I copied and added Carthage/Build/iOS/*.framework files into my project.

Now I got another problem importing web3swiflt regarding BigInt.BigUInt - 'BigUInt' is not a member type of struct 'BigInt.BigInt' in x86_64-apple-ios-simulator.swiftinterface.

@soharang
Copy link
Author

I solved another problem.
I added --use-xcframwork in the command, carthage-build.sh build
% ./carthage-build.sh build --platform iOS --no-skip-current --use-xcframwork
Finally I can import web3swift without any error.

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

No branches or pull requests

1 participant