Cannot implement socketIO pod in Kotlin multiflatform - kotlin-multiplatform

cocoapods {
ios.deploymentTarget = "15.2"
version = "1.0"
summary = "This is sample Summary"
homepage = "Home URL"
pod("socket.IO")
}
While I try make grade sync I got this error. I think I have add some extraOption in pod integration but I don't have any idea.
Maybe problem is that socket.IO uses very old target version and some value type
Executing of 'xcodebuild -project Pods.xcodeproj -scheme socket.IO -sdk iphoneos -configuration Release' failed with code 65 and message:
^
1 error generated.
In file included from /Users/nekbakhtzabirov/Documents/MarshalKMM/shared/build/cocoapods/synthetic/IOS/Pods/socket.IO/SocketIOTransportWebsocket.m:21:
/Users/nekbakhtzabirov/Documents/MarshalKMM/shared/build/cocoapods/synthetic/IOS/Pods/socket.IO/SocketIOTransportWebsocket.h:23:9: fatal error: could not build module 'SocketRocket'
#import "SRWebSocket.h"

Related

Unable to resolve module "empty-module.js" error

For building an iOS React Native app, I am able to successfully run the following command in a MacOS terminal:
xcodebuild archive -workspace MyProject.xcworkspace -derivedDataPath build -scheme MyProject -archivePath $PWD/build-artifacts/MyProject.xcarchive -configuration Release CODE_SIGN_STYLE='Automatic' BITCODE_GENERATION_MODE='bitcode'
However when invoking the same command via a Jenkins "Execute shell" step, it results in the following error:
error Unable to resolve module /Users/mike/git/my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js from /Users/mike/git/my-project/_:
None of these files exist:
* ../my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
* ../my-project/node_modules/react-native/node_modules/metro-runtime/src/modules/empty-module.js/index(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
at ModuleResolver.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:136:15)
at ModuleResolver._getEmptyModule (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:49:26)
at ModuleResolver._getFileResolvedModule (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:195:21)
at ModuleResolver.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:132:19)
at DependencyGraph.resolveDependency (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
at Object.resolve (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:129:24)
at resolve (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
at /Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (/Users/mike/git/my-project/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
I have ensured that the PATH is set consistently between the system and Jenkins for build tools like node and npm. I would appreciate any input from anyone who has experienced
similar issues.

How to use Fastlane with a CMake generated XCode project with dependency on WebP?

I have a project written in C++ where CMake is used to generate the build system for various platforms including iOS. The project has a dependency on WebP. You can find an example project on GitHub here that can be used to reproduce things & I've included the relevant source files at the end of this post for completeness.
The Xcode build system for iOS is generated using CMake as follows:
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=third_party/ios-cmake/ios.toolchain.cmake -DPLATFORM=OS64 -DDEPLOYMENT_TARGET=15.0 -DENABLE_BITCODE=0 -S . -B cmake-build-release
We can now attempt to build/archive the app using Fastlane with the command from within the generated cmake-build-release directory:
bundle exec fastlane ios beta
However this fails due to being unable to locate various webp object files (that based on console output it appears to have previously successfully compiled):
...
▸ Compiling buffer_dec.c
▸ Compiling alpha_dec.c
▸ Building library libwebpdsp.a
...
** ARCHIVE FAILED **
▸ The following build commands failed:
▸ Libtool /Users/dbotha/Library/Developer/Xcode/DerivedData/CMakeFastlaneWebpTest-dlwvukebfiwjqvaqiepshuxqklhh/ArchiveIntermediates/CMakeFastlaneWebpTest/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libwebpdecoder.a normal (in target 'webpdecoder' from project 'CMakeFastlaneWebpTest')
▸ (1 failure)
▸ ❌ error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/dbotha/CLionProjects/CMakeFastlaneWebpTest/cmake-build-release/third_party/libwebp/CMakeFastlaneWebpTest.build/Release-iphoneos/webpdecode.build/Objects-normal/arm64/alpha_dec.o (No such file or directory)
▸ ❌ error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Users/dbotha/CLionProjects/CMakeFastlaneWebpTest/cmake-build-release/third_party/libwebp/CMakeFastlaneWebpTest.build/Release-iphoneos/webpdecode.build/Objects-normal/arm64/buffer_dec.o (No such file or directory)
...
Internally Fastlane attempted to build/archive the project with the following command:
xcodebuild -scheme CMakeFastlaneWebpTest -project ./CMakeFastlaneWebpTest.xcodeproj -configuration Release -destination 'generic/platform=iOS' -archivePath ./out.xcarchive archive
Interestingly an archive can be successfully generated if I use the following xcodebuild command (note how -target flag is used instead of -scheme):
xcodebuild -project CMakeFastlaneWebpTest.xcodeproj archive -target CMakeFastlaneWebpTest -configuration Release
After this successful attempt bundle exec fastlane ios beta will now also succeed as the compiled object files are where it expected them to be.
Now I'd happily workaround this issue using my xcodebuild + -target flag approach and then use the fastlane command to push to Testflight, etc. but the real project (not this toy example) takes a very long time to build so building it twice is really wasteful from a cost point of view on CI platforms.
Does anyone have any idea what's going on here & how I can successfully build things in the first instance using fastlane without my own explicit call to xcodebuild first? Or alternatively how can I have Fastlane use the successfully built objects from my workaround so it doesn't need to rebuild the entire project from scratch?
CMakeLists.txt
cmake_minimum_required(VERSION 3.23)
project(CMakeFastlaneWebpTest)
set(CMAKE_CXX_STANDARD 14)
add_executable(CMakeFastlaneWebpTest src/main.cpp)
# Skip building of unused webp tools which fail for me under ios:
set(WEBP_BUILD_ANIM_UTILS OFF)
set(WEBP_BUILD_CWEBP OFF)
set(WEBP_BUILD_DWEBP OFF)
set(WEBP_BUILD_GIF2WEBP OFF)
set(WEBP_BUILD_IMG2WEBP OFF)
set(WEBP_BUILD_VWEBP OFF)
set(WEBP_BUILD_WEBPINFO OFF)
set(WEBP_BUILD_WEBPMUX OFF)
set(WEBP_BUILD_EXTRAS OFF)
set(WEBP_BUILD_WEBP_JS OFF)
add_subdirectory(third_party/libwebp EXCLUDE_FROM_ALL)
target_link_libraries(CMakeFastlaneWebpTest PRIVATE webpdecoder webpdemux)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/libwebp/src)
configure_file(${CMAKE_SOURCE_DIR}/fastlane/Appfile ${CMAKE_BINARY_DIR}/fastlane/Appfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/fastlane/Fastfile ${CMAKE_BINARY_DIR}/fastlane/Fastfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Gemfile ${CMAKE_BINARY_DIR}/Gemfile COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/Gemfile.lock ${CMAKE_BINARY_DIR}/Gemfile.lock COPYONLY)
set_target_properties(CMakeFastlaneWebpTest PROPERTIES
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/iOS-Info.plist.in
MACOSX_BUNDLE_GUI_IDENTIFIER com.dbotha.CMakeFastlaneWebpTest
MACOSX_BUNDLE_BUNDLE_NAME CMakeFastlaneWebpTest
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
)
set_xcode_property(CMakeFastlaneWebpTest PRODUCT_BUNDLE_IDENTIFIER "com.dbotha.CMakeFastlaneWebpTest" All)
set_xcode_property(CMakeFastlaneWebpTest CODE_SIGN_IDENTITY "iPhone Developer" All)
set_xcode_property(CMakeFastlaneWebpTest DEVELOPMENT_TEAM "GFP63373B2" All)
fastlane/Appfile
app_identifier("com.dbotha.CMakeFastlaneWebpTest") # The bundle identifier of your app
apple_id("REPLACE_ME") # Your Apple Developer Portal username
itc_team_id("REPLACE_ME") # App Store Connect Team ID
team_id("REPLACE_ME") # Developer Portal Team ID
fastlane/Fastfile
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
build_app(scheme: "CMakeFastlaneWebpTest", configuration: "Release")
upload_to_testflight
end
end
src/main.cpp
#include <iostream>
#include <webp/demux.h>
int main() {
WebPAnimDecoderOptions decOptions;
(void)decOptions;
std::cout << "Hello, World!" << std::endl;
return 0;
}
I'm not an expert in this topic but according to the documentation you should provide workspace to build your scheme.
To build an Xcode workspace, you must pass both the -workspace and
-scheme options to define the build. The parameters of the scheme will
control which targets are built and how they are built, although you may
pass other options to xcodebuild to override some parameters of the
scheme.
Scheme controls what target will be build, and guessing by your example, since you do not provide a workspace, it gets lost in the process.
The scheme is not lost anymore if you build the target manually. Since it is already build the scheme does not have to do a thing.
My proposals:
Option 1: Try adding workspace to build_app parameters in Fastfile.
Option 2: Don't bother with building scheme just use target in the
build_app parameters in Fastfile like so: build_app(target: "CMakeFastlaneWebpTest", configuration: "Release")

Build Failed when running react-native iOS

Build failed - I don't know what's the problem is, I just want to apply google-sign-in in my app using firebase, I already applied the setup of iOS through this documentation link but when I run npx react-native run-ios I have this error below, can anyone help me with this, it's very helpful for me because I've been stack with this problem.
What I do is I've added this in my podfile
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
AppDelegate.m I added it
#import <Firebase.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
(NSDictionary *)launchOptions
{
if ([FIRApp defaultApp] == nil){
[FIRApp configure];
}
Error
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 finds.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace finds.xcworkspace -configuration Debug -scheme finds -destination id=F2DA8402-50E9-481E-A93D-2AA94FAE73D4
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
note: Using new build system
note: Planning
Analyze workspace
Create build description
Build description signature: 98943ed3bd8b83f0e649a4dd42f8e14d
Build description path: /Users/macky/Library/Developer/Xcode/DerivedData/finds-cguyzegrdhdxxtdlttykzqdduzdc/Build/Intermediates.noindex/XCBuildData/98943ed3bd8b83f0e649a4dd42f8e14d-desc.xcbuild
note: Build preparation complete
note: Building targets in dependency order
error: unable to attach DB: error: accessing build database "/Users/macky/Library/Developer/Xcode/DerivedData/finds-cguyzegrdhdxxtdlttykzqdduzdc/Build/Intermediates.noindex/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.
2022-07-26 16:36:27.812 xcodebuild[19232:242056] 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-26 16:36:27.812 xcodebuild[19232:242056] 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 **
and I install pod install

How to build a react native project with cocoapods and workspace?

Before I install Pods and add a workspace to my react native project I build my project successfully using this command:
xcodebuild -scheme [SchemeName] archive -archivePath ./build/[AppName].xcarchive -allowProvisioningUpdates
I installed RN Firebase using CocoaPods and it need a xcworkspace to manage packages. According this I added the workspace option to allow the xcodebuild to find Pods:
-workspace [AppName].xcworkspace
After adding this option, the build failed because it don't find main.jsbundle.
Loading dependency graph, done.
SHA-1 for file /Users/nicolas/development/git/availpro.mobile/index.js is not computed
ReferenceError: SHA-1 for file /Users/nicolas/development/git/availpro.mobile/index.js is not computed
at DependencyGraph.getSha1 (/Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/node-haste/DependencyGraph.js:201:13)
at /Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/DeltaBundler/Transformer.js:164:26
at Generator.next (<anonymous>)
at step (/Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/DeltaBundler/Transformer.js:31:30)
at /Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/DeltaBundler/Transformer.js:50:14
at new Promise (<anonymous>)
at /Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/DeltaBundler/Transformer.js:28:12
at Transformer.transformFile (/Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/DeltaBundler/Transformer.js:188:7)
at /Users/nicolas/development/git/availpro.mobile/node_modules/metro/src/Bundler.js:78:34
at Generator.next (<anonymous>)
+ [[ false != true ]]
+ [[ ! -f /Users/nicolas/Library/Developer/Xcode/DerivedData/AvailproMobile-gewuoxculvshvhehwwobcbkhdzba/Build/Intermediates.noindex/ArchiveIntermediates/AvailproMobile-staging/BuildProductsPath/Release-iphoneos/AvailproMobile.app/main.jsbundle ]]
+ echo 'error: File /Users/nicolas/Library/Developer/Xcode/DerivedData/AvailproMobile-gewuoxculvshvhehwwobcbkhdzba/Build/Intermediates.noindex/ArchiveIntermediates/AvailproMobile-staging/BuildProductsPath/Release-iphoneos/AvailproMobile.app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/nicolas/Library/Developer/Xcode/DerivedData/AvailproMobile-gewuoxculvshvhehwwobcbkhdzba/Build/Intermediates.noindex/ArchiveIntermediates/AvailproMobile-staging/BuildProductsPath/Release-iphoneos/AvailproMobile.app/main.jsbundle does not exist. This must be a bug with
+ echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
React Native, please report it here: https://github.com/facebook/react-native/issues
+ exit 2
To quick fix the issue I generate the main.jsbundle manually before the xcodebuild:
react-native bundle --entry-file='index.js' --bundle-output='./ios/[AppName]/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
This fix seems to me a hack than a real solution.
Anyone can tell me why building the project using a .xcworkspace don't generate the main.jsbundle while building a .xcodeproj generate it ?
Thanks!

Getting Command /bin/sh failed with exit code 65 Error with Xcode 5.1 .

Sadly, I updated my iOS from 7.0.4 to 7.1 and hence was forced to upgrade Xcode from 5.0 to 5.1, after which I had to solve several issues.
But I am not able to resolve the following error.
It would be great if you can help resolving it.
I am using iOSSdk6.1 as target SDK with Xcode 5.1
Here are the logs below:
Command /bin/sh failed with exit code 65
########### TESTS #############
Use the following variables when debugging this script; note that they may change on recursions
BUILD_DIR = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products
BUILD_ROOT = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products
CONFIGURATION_BUILD_DIR = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products/Debug-iphoneos
BUILT_PRODUCTS_DIR = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products/Debug-iphoneos
CONFIGURATION_TEMP_DIR = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Intermediates/TheAmazingAudioEngine.build/Debug-iphoneos
TARGET_BUILD_DIR = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products/Debug-iphoneos
XCode has selected SDK: iphoneos with version: 6.1 (although back-targetting: 4.3)
...therefore, OTHER_SDK_TO_BUILD = iphonesimulator6.1
xcodebuild -project "/Users/rahulg/Desktop/TheAmazingAudioEngine-master/TheAmazingAudioEngine.xcodeproj" -configuration "Debug" -target "TheAmazingAudioEngine" -sdk "iphonesimulator6.1" build RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="/Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products" BUILD_ROOT="/Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products" CALLED_FROM_MASTER=1
Build settings from command line:
BUILD_DIR = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products
BUILD_ROOT = /Users/rahulg/Library/Developer/Xcode/DerivedData/TheEngineSample-abaidaurzaogqcbzpmqjesdtvulv/Build/Products
CALLED_FROM_MASTER = 1
RUN_CLANG_STATIC_ANALYZER = NO
SDKROOT = iphonesimulator6.1
=== BUILD TARGET TheAmazingAudioEngine OF PROJECT TheAmazingAudioEngine WITH CONFIGURATION Debug ===
Check dependencies
No architectures to compile for (ARCHS=i386 x86_64, VALID_ARCHS=armv7).
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Command /bin/sh failed with exit code 65
I had the same issue and I resolved it by editing the scheme of my target into release mode. (Build configuration = release)
I hope that helps you to resolve your problem.

Resources