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

dev.nokee.jni-library build fails on M1 #852

Open
dosier opened this issue Jun 18, 2023 · 3 comments
Open

dev.nokee.jni-library build fails on M1 #852

dosier opened this issue Jun 18, 2023 · 3 comments

Comments

@dosier
Copy link

dosier commented Jun 18, 2023

Hey, I am trying to build a JNI library, and stumbled upon this plugin, looks pretty cool :).
However, when I try to import dev.nokee.jni-library, I am receiving the following exception:

Could not initialize class dev.nokee.runtime.nativebase.internal.DefaultMachineArchitecture
> Exception java.lang.UnsupportedOperationException: Unsupported architecture of name 'aarch64' [in thread "Daemon worker Thread 6"]

Importing id("dev.nokee.cpp-language") seems to work fine though.

I am using a M1 MBP.

My build.gradle.kts contains:

plugins {
    id("dev.nokee.jni-library")
}

With my settings.gradle.kts looking like:

pluginManagement {
    repositories {
        mavenCentral()
        gradlePluginPortal()

        maven { url = uri("https://repo.nokee.dev/release") }
        maven { url = uri("https://repo.nokee.dev/snapshot") }
    }
    val nokeeVersion = "0.5.0-930919a0"
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id.startsWith("dev.nokee.")) {
                useModule("${requested.id.id}:${requested.id.id}.gradle.plugin:${nokeeVersion}")
            }
        }
    }
}
rootProject.name = "kotlin-jni"
@lacasseio
Copy link
Member

I will have a look at this soon. I'm a bit more offline than usual this past month. However, try the latest version from here: https://services.nokee.dev/versions/latest-snapshot.json There's a newer snapshot but that one should have support for aarch64.

@autonomousapps
Copy link

autonomousapps commented Aug 31, 2023

I can confirm that the following resolved the architecture issue on my M1:

// settings.gradle
pluginManagement {
  repositories {
    gradlePluginPortal()
    maven { url = uri('https://repo.nokee.dev/release') }
    maven { url = uri('https://repo.nokee.dev/snapshot') }
  }
  resolutionStrategy {
    eachPlugin {
      if (requested.id.id.startsWith('dev.nokee.')) {
        useModule "${requested.id.id}:${requested.id.id}.gradle.plugin:0.4.3129-202303171612.d413fb13"
      }
    }
  }
}
// build.gradle
plugins {
  id 'dev.nokee.c-application' // or whatever
}

@marbleVHS
Copy link

marbleVHS commented Apr 11, 2024

Still get the error message with version 0.4.3129-202303171612.d413fb13
A problem occurred configuring project ':plugin:objc-jni'

Caused by: java.lang.IllegalArgumentException: The following target machines are not know by the defined tool chains:
 macos aarch64
	at dev.nokee.platform.nativebase.internal.TargetMachinesPropertyRegistrationRule.assertTargetMachinesAreKnown(TargetMachinesPropertyRegistrationRule.java:66)
	at dev.nokee.platform.nativebase.internal.TargetMachinesPropertyRegistrationRule.lambda$execute$0(TargetMachinesPropertyRegistrationRule.java:58)
	at dev.nokee.platform.base.internal.DimensionPropertyRegistrationFactory$Builder.lambda$validateUsing$0(DimensionPropertyRegistrationFactory.java:88)
	at dev.nokee.platform.base.internal.BuildVariants$ToCoordinateSet.lambda$asCoordinateSet$0(BuildVariants.java:118)
	at dev.nokee.util.internal.PeekTransformer.transform(PeekTransformer.java:34)
	at dev.nokee.utils.internal.WrappedTransformer.transform(WrappedTransformer.java:33)
	at dev.nokee.utils.TransformerUtils$ComposeTransformer.transform(TransformerUtils.java:276)
	at dev.nokee.utils.TransformerUtils$ComposeTransformer.transform(TransformerUtils.java:276)

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

4 participants