Alexander Black
11/18/2020, 5:26 PMUndefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in result.o
ld: symbol(s) not found for architecture x86_64
I’m thinking it has something to do with building from a .m and .h file and it not being a dynamic library, so the binaries are not included, but I’m not sure how to include them
here’s my def in my build.gradle.kts:
iosX64("ios") {
compilations.getByName("main") {
val reachabilityInterop by cinterops.creating {
defFile(project.file("src/nativeInterop/Reachability.def"))
val headerPath = project.file("src/nativeInterop/Reachability/").absoluteFile
compilerOpts("-I${headerPath}", "-L${headerPath}")
}
}
}
kpgalligan
11/19/2020, 4:24 PMUndefined symbols
is upset about. I don't think the Kotlin gradle build has a way of building your Objc source automatically, so you'll need to create a binary from that first. I'd probably build a static archive .a
file and link to that, for simplicity. I don't have simple build steps available, but I'd start digging around stuff like https://stackoverflow.com/questions/4654534/how-to-build-an-objective-c-static-library and https://www.raywenderlich.com/2658-creating-a-static-library-in-ios-tutorial. Once you get an .a
file with the needed architectures (probably x64 and arm64), you'll need to tell the Kotlin compiler to link to that.Alexander Black
11/19/2020, 4:49 PMAlexander Black
11/19/2020, 4:50 PM