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

Trying to extract this SDK to a react native package that can be reused #133

Open
nicolasmelo1 opened this issue Jul 30, 2022 · 2 comments

Comments

@nicolasmelo1
Copy link

Bug Report

TL.DR.: When i compile my custom library it compiles, but when i try to use the library i've created on a real app, the app does not compile. And it really seems with WebexSDK package because with other packages/pods it works.

🔎 Search Terms

react native webex sdk, webex ios sdk as package, extract ios webex

🕗 Version & Regression Information

3.5.0

🛠 Tool Used

Macbook Pro 16GB M1

💻 Code

I Have tried installing FBSDKCoreKit in the .podspec and it compiled and worked as expected. Then when i removed the FBSDKCoreKit and installed WebexSDK it gave me an error when running the code.
This one is when installing WebexSDK library on the .podspec file
https://youtu.be/NeP2NX6cjGA

require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_version = '2021.06.28.00-v2'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
  s.name         = "react-native-module"
  s.version      = package["version"]
  s.summary      = package["description"]
  s.homepage     = package["homepage"]
  s.license      = package["license"]
  s.authors      = package["author"]

  s.platforms    = { :ios => "13.0" }
  s.source       = { :git => "https://github.com/nicolasmelo1/react-native-module.git", :tag => "#{s.version}" }

  s.source_files = "ios/**/*.{h,m,mm,swift}"

  s.dependency "React-Core"
  s.dependency "WebexSDK"

  # Don't install the dependencies when we run `pod install` in the old architecture.
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
    s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
    s.pod_target_xcconfig    = {
        "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
        "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
    }

    s.dependency "React-Codegen"
    s.dependency "RCT-Folly", folly_version
    s.dependency "RCTRequired"
    s.dependency "RCTTypeSafety"
    s.dependency "ReactCommon/turbomodule/core"
  end
end

🙁 Actual behavior

I'm getting this error on the console:

 Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ModuleExample.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ModuleExample.xcworkspace -configuration Debug -scheme ModuleExample -destination id=F364796E-5140-4CFD-ADE9-4CF794593068

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: 3fe56389d13fb695936aad1cd79bf6b2
Build description path: /Users/nicolasmelo/Library/Developer/Xcode/DerivedData/ModuleExample-cdzaxfvrbkxfyechcpvzbzeijktn/Build/Intermediates.noindex/XCBuildData/3fe56389d13fb695936aad1cd79bf6b2-desc.xcbuild

note: Build preparation complete
note: Building targets in dependency order
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the ModuleExample editor. (in target 'ModuleExample' from project 'ModuleExample')
/Users/nicolasmelo/lc-workspace/react-native-module/example/ios/ModuleExample.xcodeproj: error: The linked library 'libPods-ModuleExample.a' is missing one or more architectures required by this target: x86_64. (in target 'ModuleExample' from project 'ModuleExample')

2022-07-28 21:51:31.181 xcodebuild[28358:2026708] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-28 21:51:31.182 xcodebuild[28358:2026708] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **

It is strange because FBSDKCoreKit works and WebexSDK don't. It's important to say that on both cases i'm not even importing any of those SDKs on the code. I'm just adding WebexSDK to the podspec and compiling, there is no single code there.

What we are trying to do is create a library that we could reuse in our projects that have WebexSDK inside of it, it looks like WebexSDK cannot be compiled in a separated source from the app, it's meant to be used and compiled on the app. This is really bad for us because it means that if we want to use the SDK on two distinct apps we need to CTRL+C and CTRL+V the code. Which is definetly not ideal.

🙂 Expected behavior

I want to be able to compile WebexSDK without the app so i can extract the logic in a single library than can be reused by everyone in the team and the company. Right now the problem really seems on WebexSDK

@Rudsriva
Copy link

Rudsriva commented Aug 1, 2022

These frameworks are universal binaries so you'll need to either strip the Simulator build to get the required iOS framework or you can mark Validate Workspace to Yes to build successfully. Also you'll have to mark Enable Bitcode to No. These config you can find in Build Settings.

You would need to extract the binaries from these paths (ref. attached images) and link it in your new framework, then you should be able to use it.
Screenshot 2022-08-01 at 10 31 18 AM
Screenshot 2022-08-01 at 10 31 47 AM
Screenshot 2022-08-01 at 10 32 00 AM

@nicolasmelo1
Copy link
Author

Oh nice,

Thanks for your response, so, since i've read your message i've been trying to make it work but still without any success. One thing that i've noticed is that you compiled Test to a Test framework, can't i compile the source code to a static library?

it's still giving me this error:

Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ModuleExample.xcworkspace.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ModuleExample.xcworkspace -configuration Debug -scheme ModuleExample -destination id=F364796E-5140-4CFD-ADE9-4CF794593068

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: 9f60adfb6c57f9623891d49963e10757
Build description path: /Users/nicolasmelo/Library/Developer/Xcode/DerivedData/ModuleExample-cdzaxfvrbkxfyechcpvzbzeijktn/Build/Intermediates.noindex/XCBuildData/9f60adfb6c57f9623891d49963e10757-desc.xcbuild

note: Build preparation complete
note: Building targets in dependency order
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the ModuleExample editor. (in target 'ModuleExample' from project 'ModuleExample')
/Users/nicolasmelo/lc-workspace/react-native-module/example/ios/ModuleExample.xcodeproj: error: The linked library 'libPods-ModuleExample.a' is missing one or more architectures required by this target: x86_64. (in target 'ModuleExample' from project 'ModuleExample')

2022-08-01 10:08:23.829 xcodebuild[5150:835888] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-01 10:08:23.829 xcodebuild[5150:835888] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **

Captura de Tela 2022-08-01 às 10 27 58
Captura de Tela 2022-08-01 às 10 28 14
Captura de Tela 2022-08-01 às 10 28 28

Here is the source code, it's really simple stuff just to test.
Captura de Tela 2022-08-01 às 10 29 43

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

2 participants