vbsteven
03/22/2023, 5:17 PMDavid Herman
03/23/2023, 9:02 PMWilliam Reed
03/24/2023, 1:42 PMsome_struct_t**
and the function populates the array at the given pointer. i’ve seen docs on how to create an array and get a pointer to it in K/N but since i don’t know the size of it ahead of time i’m not sure how to create it. in c i would just pass a pointer to such an empty array but i’m not sure what the kotlin equivalent isReuben Firmin
03/24/2023, 6:20 PMstat
or nftw
? I'm attempting to work from the docs at https://linux.die.net/man/3/nftw, but I'm a little lost.
// ...
val dir = "/tmp"
nftw(dir, ::printEntry, 50, FTW_PHYS)
}
fun printEntry(path: String, ??? ) {
}
Reuben Firmin
03/25/2023, 11:38 AMRoberto Leinardi
03/25/2023, 3:40 PMJames Ward
03/25/2023, 5:16 PMshell.nix
with import <nixpkgs> {};
mkShell {
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
stdenv.cc.cc.lib
zlib
libclang.lib
];
NIX_LD = lib.fileContents "${<http://stdenv.cc|stdenv.cc>}/nix-support/dynamic-linker";
}
Justin
03/27/2023, 6:53 AMCaused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find :kotlin-native-prebuilt-linux-aarch64:1.8.0.
Searched in the following locations:
- <https://download.jetbrains.com/kotlin/native/builds/releases/1.8.0/linux-aarch64/kotlin-native-prebuilt-linux-aarch64-1.8.0.tar.gz>
I test it with a basic hallo world native application.
Changed the build.gradle.kts
to support my M1:
...
kotlin {
val hostOs = System.getProperty("os.name")
val arch = System.getProperty("os.arch")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" && arch == "aarch64" -> macosArm64("native")
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" && arch == "aarch64" -> linuxArm64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
Dockerfile
FROM gradle:8-jdk17-focal AS builder
COPY . /app
WORKDIR /app
RUN gradle build --warning-mode summary --stacktrace --scan
FROM ubuntu:focal
COPY --from=builder /app/build/bin/native/releaseExecutable ./
CMD ["./clean-native.kexe"]
It looks like the on the latest release linux-aarch64 does not exist.
Is this possible and how could I do this?rb90
03/27/2023, 10:55 AMA problem occurred configuring project ':shared'.
> Failed to notify project evaluation listener.
> Cannot add task 'xxx' as a task with that name already exists.
Can you please tell me how to explicitly exclude/disable a task for a dependency?Jan
03/27/2023, 2:02 PMBig Chungus
03/28/2023, 7:45 AMchar**
in C is represented as CPointerVar<Char>
in kotlin?AnnaSkantz
03/31/2023, 5:47 AM-opt
to the freeCompilerArgs
list in the build.gradle.kts
file in the shared folder (execution time went from approx 1.4 to 0.33). Now, I have some questions:
1. What kinds of optimizations are made by adding -opt
? (such as for instance “constant folding”, “dead code removal” etc.)
2. Are there other optimizations that I can apply?
I would appreciate any input or suggestions that you have as I struggle to find documentation or information on this. If you know any good resources, let me know!
Thanks!Adam S
03/31/2023, 12:39 PMList<T>
(where T
is a CStructVar
) to CValuesRef<T>
?vbsteven
04/02/2023, 3:33 PMResult<T>
to make the the error explicit in the signature, or I can add a @Throws
annotation and just throw the exception. Currently I'm favoring the Result<T>
approach but it has some issues (like the Exception type not being generic).
Any opinions on this?Big Chungus
04/04/2023, 9:09 AMJeff Lockhart
04/04/2023, 11:30 PMDmytro Serdiuk
04/06/2023, 5:14 PMKeep your library up-to-date. If you’re a library author, updating to the new Kotlin version is extremely important. Using older versions could block your users from updating Kotlin in their projects.and
Change the versions of dependencies to EAP ones. The EAP version of Kotlin may not work with the libraries of the previously released version.Does it mean that some Kotlin versions are not compatible or not ABI stable? Thanks
Mitchell Syer
04/07/2023, 8:16 PMlld-link: warning: ignoring unknown argument: -exclude-symbols:main_test
lld-link: error: -exclude-symbols:main_test is not allowed in .drectve
Tóth István Zoltán
04/10/2023, 4:59 AMSebastian Owodzin
04/12/2023, 10:41 PMType mismatch: inferred type is suntrix.kmp.firebase.FIRApp but objcnames.classes.FIRApp was expected
?
The generated Kotlin “header” looks weird (see installationsWithApp()
)
public open expect class FIRInstallationsMeta : platform.darwin.NSObjectMeta {
protected constructor() { /* compiled code */ }
@kotlin.commonizer.ObjCCallable @kotlin.Deprecated public open external expect fun alloc(): suntrix.kmp.firebase.installations.FIRInstallations? { /* compiled code */ }
@kotlin.commonizer.ObjCCallable @kotlin.Deprecated public open external expect fun allocWithZone(zone: kotlinx.cinterop.CPointer<cnames.structs._NSZone>?): suntrix.kmp.firebase.installations.FIRInstallations? { /* compiled code */ }
@kotlin.commonizer.ObjCCallable public open external expect fun installations(): suntrix.kmp.firebase.installations.FIRInstallations { /* compiled code */ }
@kotlin.commonizer.ObjCCallable public open external expect fun installationsWithApp(application: objcnames.classes.FIRApp): suntrix.kmp.firebase.installations.FIRInstallations { /* compiled code */ }
@kotlin.commonizer.ObjCCallable public open external expect fun new(): suntrix.kmp.firebase.installations.FIRInstallations? { /* compiled code */ }
}
Big Chungus
04/14/2023, 12:14 PMAbhishek Kumar
04/17/2023, 8:53 AMSergey Aldoukhov
04/17/2023, 5:12 PMkotlin {
...
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
...
}
...
sourceSets {
val nativeMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-cli:0.3.5")
}
}
val nativeMac by creating {
dependsOn(nativeMain)
dependencies {
implementation("io.ktor:ktor-client-darwin:$ktorVersion")
}
}
}
}
And I’m getting
The Kotlin source set nativeMac was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets>
But I can’t figure how to “add a source set to a target’s compilation”, also the link in the warning goes to nowhere.Dmytro Serdiuk
04/17/2023, 10:49 PMayodele
04/18/2023, 10:15 AMCPointer<ObjCObjectVar>NSError?>>
.
Using try and catch is not useful and I don't want to pass in nullkevin.cianfarini
04/19/2023, 3:09 PMAny
in swift. Is there any reason K/N hasn’t decided to just box the value across the bridge?Adam Helbling
04/20/2023, 1:35 AM./gradlew linkNative
It’s obviously something to do with the header files used from the toolchain but I have no idea how to specify anything different.
2 errors generated.
* Source files:
* Compiler version info: Konan: 1.7.21 / Kotlin: 1.7.21
* Output kind: DYNAMIC
e: org.jetbrains.kotlin.konan.KonanExternalToolFailure: The /Users/ahelbling/.konan/dependencies/apple-llvm-20200714-macos-aarch64-essentials/bin/clang++ command returned non-zero exit code: 1.
output:
In file included from /var/folders/08/mqm71ljs6qsct07_r9qxd9vc0000gn/T/konan_temp15784896127495882400/api.cpp:165:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/exception:84:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/cstdlib:135:9: error: no member named 'at_quick_exit' in the global namespace
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/cstdlib:136:9: error: no member named 'quick_exit' in the global namespace
using ::quick_exit _LIBCPP_USING_IF_EXISTS;
~~^
2 errors generated.
Landry Norris
04/20/2023, 2:40 PMAdam S
04/21/2023, 1:38 PMModel model = LoadModel("resources/model.obj")
Texture2D texture = LoadTexture("resources/texture.png");
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
I can get close, but for some reason the generated cinterop Kotlin code has texture as a val
, not a var
val model: CValue<Model> = LoadModel("resources/model.obj")
val texture: CValue<Texture> = LoadTexture("resources/texture.png")
model.useContents {
// model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture
materials!![0].maps!![MATERIAL_MAP_DIFFUSE].texture = texture // ERROR val cannot be reassigned
}
any hints are appreciated!Big Chungus
04/22/2023, 9:00 AM