Avadhut
03/25/2024, 8:28 AMmoko-socket-io
project
I'm able to run the sample android app after changing target sdk, jdk and installing pod dependencies but the ios sample app build is failing with following outputs.
I'm trying to implement changes for this issue. Please help me setup iOS project.
Thanks in advance!
1. ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
> Task :sample:mpp-library:linkMultiPlatformLibraryDebugFrameworkIosArm64 FAILED
w: Following libraries are specified to be exported with -Xexport-library, but not included to the build:
/Users/whoknows/Developement/OSS/moko-socket-io/socket-io/build/libs/iosArm64/main/socket-io-cinterop-cocoapodMokoSocketIo.klib
2. cd sample/ios-app && set -o pipefail && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Compile\ Kotlin/Native /Users/whoknows/Library/Developer/Xcode/DerivedData/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/MultiPlatformLibrary.build/Script-BA95BCD441577347D0C821C3908AFD77.sh (in target 'MultiPlatformLibrary' from project 'Pods')
(1 failure)
alex009
03/26/2024, 5:31 AM> Task samplempp-library:linkMultiPlatformLibraryDebugFrameworkIosArm64 FAILED
w: Following libraries are specified to be exported with -Xexport-library, but not included to the build:
/Users/whoknows/Developement/OSS/moko-socket-io/socket-io/build/libs/iosArm64/main/socket-io-cinterop-cocoapodMokoSocketIo.klibhere you not show error. this warning not related to FAILED state. please give more log. i think you just not do
pod install
before run ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
and cinterop can't find native lib.
next step issue just same - you should show full log with error, not just "task failed"Avadhut
03/27/2024, 5:54 PMAnalyzing dependencies
Downloading dependencies
Installing MultiPlatformLibrary (0.2.0)
Installing Socket.IO-Client-Swift (15.2.0)
Installing Starscream (3.1.1)
Installing mokoSocketIo (0.4.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 4 total pods installed.
here's the full log for the gradle task: https://scans.gradle.com/s/5xdp7aj76ikvy
Let me know you need anything else. Thanks!Avadhut
03/27/2024, 6:52 PMGenerateDSYMFile /Users/whoknows/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/mokoSampleResources.app.dSYM /Users/whoknows/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/mokoSampleResources.app/mokoSampleResources (in target 'TestProj' from project 'TestProj')
cd /Users/whoknows/Developement/OSS/moko-socket-io/sample/ios-app
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/whoknows/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/mokoSampleResources.app/mokoSampleResources -o /Users/whoknows/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/mokoSampleResources.app.dSYM
** BUILD SUCCEEDED **
but if I run the sample ios app from xcode/androidstudio the build is throwing error so not able to see any output on simulator :
Ld /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/mokoSampleResources.app/mokoSampleResources normal (in target 'TestProj' from project 'TestProj')
cd /Users/whoknows/Developement/OSS/moko-socket-io/sample/ios-app
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-ios12.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk -Os -L/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/EagerLinkingTBDs/Debug-iphonesimulator -L/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk/usr/lib/swift -F/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/EagerLinkingTBDs/Debug-iphonesimulator -F/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator -F/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/Socket.IO-Client-Swift -F/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/Starscream -F/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/mokoSocketIo -F/Users/whoknows/Developement/OSS/moko-socket-io/sample/ios-app/Pods/../../mpp-library/build/cocoapods/framework -filelist /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/TestProj.build/Debug-iphonesimulator/TestProj.build/Objects-normal/arm64/mokoSampleResources.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/TestProj.build/Debug-iphonesimulator/TestProj.build/Objects-normal/arm64/mokoSampleResources_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/TestProj.build/Debug-iphonesimulator/TestProj.build/Objects-normal/arm64/mokoSampleResources.swiftmodule -lc++ -framework MultiPlatformLibrary -framework SocketIO -framework Starscream -framework mokoSocketIo -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/TestProj.build/Debug-iphonesimulator/TestProj.build/mokoSampleResources.app-Simulated.xcent -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __ents_der -Xlinker /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/TestProj.build/Debug-iphonesimulator/TestProj.build/mokoSampleResources.app-Simulated.xcent.der -framework Pods_TestProj -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/TestProj.build/Debug-iphonesimulator/TestProj.build/Objects-normal/arm64/mokoSampleResources_dependency_info.dat -o /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/mokoSampleResources.app/mokoSampleResources
ld: warning: ignoring file '/Users/whoknows/Developement/OSS/moko-socket-io/sample/mpp-library/build/cocoapods/framework/MultiPlatformLibrary.framework/MultiPlatformLibrary': found architecture 'x86_64', required architecture 'arm64'
ld: Undefined symbols:
_OBJC_CLASS_$_MPLTesting, referenced from:
in TestViewController.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'TestProj' from project 'TestProj')
warning: Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'TestProj' from project 'TestProj')
warning: Run script build phase '[CP-User] Compile Kotlin/Native' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MultiPlatformLibrary' from project 'Pods')
warning: Run script build phase '[CP] Copy dSYMs' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MultiPlatformLibrary' from project 'Pods')
** BUILD FAILED **
The following build commands failed:
Ld /Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/mokoSampleResources.app/mokoSampleResources normal (in target 'TestProj' from project 'TestProj')
(1 failure)
I'm not sure if any issue with my env/sdk versions.alex009
03/28/2024, 8:24 AMThe /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
-iphoneos_version_min has been renamed to -ios_version_min
ld: unknown options: -sdk_version
thats mean that you use xcode version newest than supported by kotlin gradle plugin in project. need to update kotlin gradle pluginalex009
03/28/2024, 8:26 AMld: warning: ignoring file '/Users/whoknows/Developement/OSS/moko-socket-io/sample/mpp-library/build/cocoapods/framework/MultiPlatformLibrary.framework/MultiPlatformLibrary': found architecture 'x86_64', required architecture 'arm64'
ld: Undefined symbols:
_OBJC_CLASS_$_MPLTesting, referenced from:
in TestViewController.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mean that MultiPlatformLibrary
compiled for x86_64 but you now build ios app for arm64 architecture.
i think you try to run on iOS simulator on m1 mac. need to update kotlin targets list and cocoapods integrationalex009
03/28/2024, 8:32 AMmobile.multiplatform.withoutIosSimulatorArm64=false
and also update podspec file to:
Pod::Spec.new do |spec|
spec.name = 'MultiPlatformLibrary'
spec.version = '0.1.0'
spec.homepage = 'Link to a Kotlin/Native module homepage'
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
spec.authors = 'IceRock Development'
spec.license = ''
spec.summary = 'Shared code between iOS and Android'
spec.vendored_frameworks = "build/cocoapods/framework/#{spec.name}.framework"
spec.libraries = "c++"
spec.module_name = "#{spec.name}_umbrella"
spec.ios.deployment_target = '11.0'
spec.osx.deployment_target = '10.6'
spec.pod_target_xcconfig = {
'KOTLIN_FRAMEWORK_BUILD_TYPE[config=*ebug]' => 'debug',
'KOTLIN_FRAMEWORK_BUILD_TYPE[config=*elease]' => 'release',
'CURENT_SDK[sdk=iphoneos*]' => 'iphoneos',
'CURENT_SDK[sdk=iphonesimulator*]' => 'iphonesimulator',
'CURENT_SDK[sdk=macosx*]' => 'macos'
}
spec.script_phases = [
{
:name => 'Compile Kotlin/Native',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "$KOTLIN_FRAMEWORK_BUILD_TYPE" == "debug" ]; then
CONFIG="Debug"
else
CONFIG="Release"
fi
if [ "$CURENT_SDK" == "iphoneos" ]; then
TARGET="Ios"
ARCH="Arm64"
elif [ "$CURENT_SDK" == "macos" ]; then
TARGET="Macos"
if [ "$NATIVE_ARCH" == "arm64" ]; then
ARCH="Arm64"
else
ARCH="X64"
fi
else
if [ "$NATIVE_ARCH" == "arm64" ]; then
TARGET="IosSimulator"
ARCH="Arm64"
else
TARGET="Ios"
ARCH="X64"
fi
fi
MPP_PROJECT_ROOT="$SRCROOT/../../mpp-library"
GRADLE_TASK="syncMultiPlatformLibrary${CONFIG}Framework${TARGET}${ARCH}"
"$MPP_PROJECT_ROOT/../gradlew" -p "$MPP_PROJECT_ROOT" "$GRADLE_TASK"
SCRIPT
}
]
end
Avadhut
03/28/2024, 5:52 PMalex009
03/29/2024, 3:57 AMld: warning: search path '/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/Socket.IO-Client-Swift' not found
ld: warning: search path '/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/Starscream' not found
ld: warning: search path '/Users/whoknows/Developement/OSS/moko-socket-io/build/ios/Debug-iphonesimulator/mokoSocketIo' not found
ld: framework 'SocketIO' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
this mean that pods was not found/not compiled. check that you run pod install
before gradle compilation. gradle should see pods and successfully compile them to link with binariesAvadhut
03/29/2024, 4:01 AMAnalyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 4 total pods installed.
Avadhut
03/29/2024, 4:02 AM./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosArm64
or
./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
alex009
03/29/2024, 4:48 AM./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosSimulatorArm64
this one will be better.
is this command run successful?Avadhut
03/29/2024, 10:57 AMFAILURE: Build failed with an exception.
* What went wrong:
Task 'syncMultiPlatformLibraryDebugFrameworkIosSimulatorArm64' not found in root project 'moko-socket-io' and its subprojects.
also tried with those 2 it gives same error on simulator runalex009
03/29/2024, 11:20 AMAvadhut
03/29/2024, 11:20 AMAvadhut
04/08/2024, 2:50 PMalex009
04/10/2024, 2:05 PMAvadhut
04/12/2024, 5:25 PMalex009
04/14/2024, 4:00 PMAvadhut
04/14/2024, 4:16 PMAvadhut
04/14/2024, 4:46 PM