Krystian
12/01/2023, 7:30 AMe: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: warning: ignoring file '/opt/homebrew/Cellar/sdl2/2.28.5/lib/libSDL2-2.0.0.dylib': found architecture 'arm64', required architecture 'x86_64'
ld: Undefined symbols:
_SDL_CreateWindow, referenced from:
_platform_SDL2_SDL_CreateWindow_wrapper374 in KotlinNativeTemplate.kexe.o
_SDL_Init, referenced from:
_platform_SDL2_SDL_Init_wrapper826 in KotlinNativeTemplate.kexe.o
_SDL_Quit, referenced from:
_platform_SDL2_SDL_Quit_wrapper830 in KotlinNativeTemplate.kexe.o
Why is K/N asking for x86_64 on ARM?
My .def is inside this postKrystian
12/01/2023, 7:30 AMpackage = platform.SDL2
headers = SDL2/SDL.h
compilerOpts = -D_THREAD_SAFE -I/opt/homebrew/include/ -I/opt/homebrew/include/SDL2/
linkerOpts = -L/opt/homebrew/lib/ -lSDL2
As you can see, my .def is standard as it should beJan Holešovský
12/01/2023, 7:46 AMKrystian
12/01/2023, 1:22 PMJan Holešovský
12/01/2023, 1:51 PMJan Holešovský
12/01/2023, 1:52 PMKrystian
12/01/2023, 9:23 PMMiroslav Sobotka
12/05/2023, 9:14 AMMiroslav Sobotka
12/05/2023, 9:35 AMplugins {
kotlin("multiplatform") version "2.0.0-Beta1"
}
group = "cz.mira"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
kotlin {
macosArm64 {
compilations.getByName("main") {
val sdl2 by cinterops.creating {
}
}
binaries {
executable {
entryPoint = "main"
}
}
}
}
sdl2.def
(your file)
main.kt
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.toKString
@OptIn(ExperimentalForeignApi::class)
fun main() {
println("Hello, Kotlin/Native! The SDL2 version " +
"is ${platform.SDL2.SDL_GetRevision()?.toKString()}")
}
Miroslav Sobotka
12/05/2023, 9:35 AM10:34:00: Executing 'runReleaseExecutableMacosArm64'...
> Task :checkKotlinGradlePluginConfigurationErrors
> Task :cinteropSdl2MacosArm64
> Task :compileKotlinMacosArm64
> Task :xcodeVersion
> Task :linkReleaseExecutableMacosArm64
> Task :runReleaseExecutableMacosArm64
Hello, Kotlin/Native! The SDL2 version is SDL-release-2.28.5-0-g15ead9a40
BUILD SUCCESSFUL in 13s
6 actionable tasks: 6 executed
10:34:14: Execution finished 'runReleaseExecutableMacosArm64'.
Krystian
12/09/2023, 3:52 PM