Hello, I am tearing the little I have left of my h...
# multiplatform
p
Hello, I am tearing the little I have left of my hair 🙂 I have a KMM project test up and get this error when building from XCode:
Copy code
Command PhaseScriptExecution failed with a nonzero exit code
Seem to work from Android Studio, even the iOS build… 🤔 If I dig down a little bit into the logs in XCode I find this:
Copy code
> Task :shared:linkDebugFrameworkIos FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory:
   
  kotlin.native.cacheKind.iosX64=none
   
Also, consider filing an issue with full Gradle log here: <https://kotl.in/issue>
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin//libclang_rt.ios.a, missing required architecture x86_64 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin//libclang_rt.ios.a (4 slices)
Undefined symbols for architecture x86_64:
 "___cpu_model", referenced from:
   polyHash_x86(int, unsigned short const*) in libstdlib-cache.a(result.o)
ld: symbol(s) not found for architecture x86_64

FAILURE: Build failed with an exception.
I am totally lost, anyone have any idea or where to start looking?
r
Have you tried this?
Copy code
Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory:
   
  kotlin.native.cacheKind.iosX64=none
p
Yes, nothing changes.
r
Maybe also try clearing Xcode's derived data folder https://programmingwithswift.com/delete-derived-data-xcode/
Otherwise, I'm not sure, sorry
p
No, didn’t help… it’s strange that it works building from within Android Studio… 🤔
I checked out the code again and tried to build and then it works, have no clue, but probably some cache somewhere ... 😅
w
@pererikbergman, are you using xcode 13? If so, can you check you are using Kotlin version 1.5.30 or newer? 🤔 I’m fairly sure that was the error I was getting too, and it was related to the Kotlin version.
✅ 1
Yeah, found the link we saw this: https://youtrack.jetbrains.com/issue/KT-47333
p
I solved it, for me it was a dependency issue on shared module, this time, I got it one more time when I accidentally added android dependency in the common code. It might be me who is not used to debug on iOS but the error messages was a bit strange and misleading, next time I will just go over the dependency and the code in more depth 😄
m
yes, many scenarios get you to this same error..I saw it many times. I think it helps if you always try to build it via Kotlin IDE (Android Studio..etc) or command line (calling build gradle task directly), there you would get a better error message.