Closed GaurDev06 closed 2 years ago
The project is published to maven central https://search.maven.org/artifact/de.voize/pytorch-lite-multiplatform/0.3.3/jar. Make sure you include maven central repository in your build config.
Hi, Thanks for following up on this and for your response. I also included the maven like this buildscript { repositories { gradlePluginPortal() google() mavenCentral() } dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0") classpath("com.android.tools.build:gradle:7.2.1") } }
allprojects { repositories { google() mavenCentral() } }
tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } Is there anything wrong?
No this looks right, I created a test project using a basic koltin multiplatform project setup and added your config.
Then I added to app/build.gradle.kts
:
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("de.voize:pytorch-lite-multiplatform:0.4.0") // added this
}
}
}
}
And this works fine.
PS: You can better format your code snippets using a ``` code block, see Markdown Syntax
HI @Legion2 I am trying in same way
sourceSets {
val commonMain by getting{
dependencies {
implementation("com.soywiz.korlibs.korim:korim:$korimVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
implementation( "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion")
implementation("de.voize:pytorch-lite-multiplatform:0.4.0")
}
}
But its showing error Could not resolve de.voize:pytorch-lite-multiplatform:0.4.0.
@GaurDev06 can you share your complete project (is is open source on github), so we can reproduce the problem?
@Legion2
please find the with the help of given link.
https://github.com/GaurDev06/ApplicationDemo.git
Thanks
I have checked out your project and can run ./gradlew build
and ./gradlew installDebug
on my linux without problems. Which command results in the error?
When I am running this project on my mac then I will get the error and it says that:- Could not resolve de.voize:pytorch-lite-multiplatform:0.3.3. Required by: project : shared
I will test on a mac next week.
@Legion2 Thank for the update. And waiting for your response. TIA
@GaurDev06
With your repo I get the following error on a M1 MacBook Pro on ./gradlew build
.
This is because a blank Kotlin Multiplatform Project includes a iosSimulatorArm64
target that is currently not support by this library. If you remove the target it works fine.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':shared:linkPodDebugFrameworkIosSimulatorArm64'.
> Could not resolve all task dependencies for configuration ':shared:iosSimulatorArm64CompileKlibraries'.
> Could not resolve de.voize:pytorch-lite-multiplatform:0.4.0.
Required by:
project :shared
> No matching variant of de.voize:pytorch-lite-multiplatform:0.4.0 was found. The consumer was configured to find a usage of 'kotlin-api' of a library, preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but:
- Variant 'iosArm64ApiElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'iosArm64MetadataElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'iosX64ApiElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'iosX64MetadataElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Variant 'metadataApiElements' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a library:
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'releaseApiElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares an API of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'releaseRuntimeElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a runtime of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
@erksch we should add the iosSimulatorArm64()
target, we just need to add it to gradle with iosSimulatorArm64Main.dependsOn(iosMain)
and publish I think
Hi @erksch Thanks for the Update and your time but when we install it without the iosSimulatorArm64() and iosSimulatorArmX64 then we are not able to run the application in the xcode it's showing error like Undefined symbols for architecture x86_64: "_OBJCCLASS$_TorchModule", referenced from: objc-class-ref in shared(result.o) objc-class-ref in shared(result.o) "_OBJCCLASS$_Tensor", referenced from: objc-class-ref in shared(result.o) objc-class-ref in shared(result.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) So if there any other way then please let us know. thanks again for your efforts.
You seem to not have included the PLMLibTorchWrapper pod correctly. Please check out the updated README.
Hi @erksch Thanks for the update. but when we done with the all steps then there is same error is showing :-
Execution failed for task ':shared:cinteropPLMLibTorchWrapperIosSimulatorArm64'.
> Could not resolve all files for configuration ':shared:iosSimulatorArm64PLMLibTorchWrapperCInterop'.
> Could not resolve de.voize:pytorch-lite-multiplatform:0.4.0.
Required by:
project :shared
> No matching variant of de.voize:pytorch-lite-multiplatform:0.4.0 was found. The consumer was configured to find a usage of 'kotlin-cinterop' of a library, with the library elements 'cinterop-klib', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but:
- Variant 'iosArm64ApiElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Variant 'iosArm64MetadataElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' and the consumer needed a usage of 'kotlin-cinterop' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Variant 'iosX64ApiElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Variant 'iosX64MetadataElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' and the consumer needed a usage of 'kotlin-cinterop' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Variant 'metadataApiElements' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a library:
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a usage of 'kotlin-cinterop' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'releaseApiElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares an API of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'releaseRuntimeElements-published' capability de.voize:pytorch-lite-multiplatform:0.4.0 declares a runtime of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'samplessources' capability de.voize:pytorch-lite-multiplatform:0.4.0:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Doesn't say anything about its usage (required a usage of 'kotlin-cinterop')
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'native')
> Could not resolve com.soywiz.korlibs.korim:korim:2.2.0.
Required by:
project :shared
> No matching variant of com.soywiz.korlibs.korim:korim:2.2.0 was found. The consumer was configured to find a usage of 'kotlin-cinterop' of a library, with the library elements 'cinterop-klib', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but:
- Variant 'debugApiElements-published' capability com.soywiz.korlibs.korim:korim:2.2.0 declares an API of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'debugRuntimeElements-published' capability com.soywiz.korlibs.korim:korim:2.2.0 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attributes:
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about its elements (required them with the library elements 'cinterop-klib')
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_simulator_arm64')
- Variant 'iosArm32ApiElements-published' capability com.soywiz.korlibs.korim:korim:2.2.0 declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm32' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64'
And also change the podfile:-
target 'iosApp' do
//use_frameworks!
platform :ios, '14.1'
pod 'shared', :path => '../shared'
end
and the gradle File is :-
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
}
group = "de.voize"
version = "1.0"
val pyTorchVersion = "0.2.1"
val korimVersion = "2.2.0"
repositories {
google()
mavenCentral()
}
kotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
ios.deploymentTarget = "13.5"
homepage = "https://github.com/voize-gmbh/pytorch-lite-multiplatform"
summary = "Kotlin Multiplatform wrapper for PyTorch Lite"
framework {
baseName = "shared"
}
pod("PLMLibTorchWrapper") {
version = "0.4.0"
}
useLibraries()
}
sourceSets {
val commonMain by getting{
dependencies {
implementation("de.voize:pytorch-lite-multiplatform:0.4.0")
implementation("com.soywiz.korlibs.korim:korim:$korimVersion")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting
val androidTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
}
tasks.named<org.jetbrains.kotlin.gradle.tasks.DefFileTask>("generateDefPLMLibTorchWrapper").configure {
doLast {
outputFile.writeText("""
language = Objective-C
headers = LibTorchWrapper.h
""".trimIndent())
}
}
android {
compileSdk = 32
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 22
targetSdk = 32
}
}
And also disabled the bitcode in xcode. Please correct me Thanks
remove the iosSimulatorArm64()
target
Hi @erksch, Thanks for your response, I have removed the iosSimulatorArm64() from gradle and successfullly build the kmm gradle but in IOS Xcode getting the below error
Your iosApp/Podfile
seems broken to me:
//use_frameworks!
is not a valid way to comment out a line in Ruby, instead use:
# use_frameworks!
Hi @erksch Thanks for your fast response , I used the same "# use_frameworks!" but for commenting here i used that because it will show you the heading when i will post it
Ok. Your XCode project does not link the PLMLibTorchWrapper
pod.
Please send me the content of shared/shared.podspec
and the output of ls iosApp/Pods
.
Hi @erksch,
shared/shared.podspec content is
Pod::Spec.new do |spec|
spec.name = 'shared'
spec.version = '1.0'
spec.homepage = 'https://github.com/voize-gmbh/pytorch-lite-multiplatform'
spec.source = { :http=> ''}
spec.authors = ''
spec.license = ''
spec.summary = 'Kotlin Multiplatform wrapper for PyTorch Lite'
spec.vendored_frameworks = 'build/cocoapods/framework/shared.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '13.5'
spec.dependency 'PLMLibTorchWrapper', '0.4.0'
spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':shared',
'PRODUCT_MODULE_NAME' => 'shared',
}
spec.script_phases = [
{
:name => 'Build shared',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$COCOAPODS_SKIP_KOTLIN_BUILD" ]; then
echo "Skipping Gradle build task invocation due to COCOAPODS_SKIP_KOTLIN_BUILD environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
SCRIPT
}
]
end
And iosApp/Pods file is given below...
Looks good to me. Please provide a reproducible example so we can debug or take a look at our new example project for reference.
ok will send you ASAp
Hi @erksch, Please find the file for your reference https://github.com/GaurDev06/DemoApp.git
@GaurDev06 thanks, I checked out your repo. First thing, iosApp/Pods
should be in your .gitignore
, the folder is autogenerated.
Regarding your issue, please try to delete the iosApp/Pods
folder, run cd iosApp && pod install
and try to build the app again.
@GaurDev06 have you been able to resolve your issue? If so, I'd close this issue
Closing
Hi there, I am working on KMM project and want to implement pytorch in my kmm but getting error
Could not resolve de.voize:pytorch-lite-multiplatform:0.3.3. Required by: project :shared