https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kotlin-native
  • s

    spierce7

    12/28/2017, 1:40 AM
    Also, when will the kotlinx.serialization library work with native?
    o
    • 2
    • 1
  • b

    Bimawa

    12/28/2017, 4:10 PM
    I’m so hard want use Kotlin with Objective-c, its posible? Just hate swift, and believe in the future with Kotlin, but i need cool support llvm 😄
    o
    • 2
    • 2
  • t

    thewoolleyman

    12/28/2017, 6:06 PM
    Hello. I'm attempting to compile the kotlin-native calculator example using the instructions here: https://github.com/JetBrains/kotlin-native/tree/master/samples/calculator But when I run
    ../gradlew :calculator:compileKonanKotlinArithmeticParserIphone --debug --stacktrace
    from the
    samples/calculator
    , I get the following error:
    > Task :calculator:compileKonanKotlinArithmeticParserIphone
    11:04:52.692 [ERROR] [system.err] error: compilation failed: No such file or directory
    11:04:52.692 [ERROR] [system.err]
    11:04:52.692 [ERROR] [system.err]  * Source files: Parser.kt
    11:04:52.692 [ERROR] [system.err]  * Compiler version info: Konan: EAP 0.6.0.0 / Kotlin: 1.2.0
    11:04:52.692 [ERROR] [system.err]  * Output kind: FRAMEWORK
    11:04:52.692 [ERROR] [system.err]
    11:04:52.692 [ERROR] [system.err] exception: java.lang.Error: No such file or directory
    11:04:52.692 [ERROR] [system.err]       at org.jetbrains.kotlin.backend.konan.llvm.LlvmUtilsKt.parseBitcodeFile(LlvmUtils.kt:266)
    11:04:52.692 [ERROR] [system.err]       at org.jetbrains.kotlin.backend.konan.llvm.Runtime.<init>(Runtime.kt:30)
    11
    ...
    ...
    o
    • 2
    • 4
  • i

    itnoles

    12/29/2017, 3:18 AM
    How does Objective-C able to do [NSData bytes] as const void into const char ?
    o
    • 2
    • 1
  • j

    Jorrit

    12/30/2017, 5:14 PM
    Why do Kotlin/Native produced binaries depend on libstdc++ ?
    o
    • 2
    • 4
  • j

    Jorrit

    12/30/2017, 5:22 PM
    Produced binaries are still rather large... 2MB for hello world in MIPS, for example
    o
    • 2
    • 4
  • j

    jkbbwr

    12/30/2017, 9:52 PM
    When trying to link against python
    /usr/lib/libpython3.6m.so: error: undefined reference to 'getrandom', version 'GLIBC_2.25'
    exception: java.lang.IllegalStateException: The /home/jakob/.konan/dependencies/target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/bin/ld.gold command returned non-zero exit code: 1.
    Using cdef
    headers = Python.h
    libraryPaths = /usr/include/python3.6m
    linkerOpts = -L/usr/lib -lpython3.6m -ldl -lutil -lm -Xlinker -export-dynamic
    o
    • 2
    • 6
  • g

    Guillaume Delorme

    12/31/2017, 2:04 PM
    Hello, I am trying to use OpenGL extensions on Linux with libepoxy. But cinterop don't seems to generate pointer to function declared with "#define" in the .h files. For example, in the .h file, there is :
    #define glCreateShader epoxy_glCreateShader
    In generated .kt file, epoxy_glCreateShader is present, but not glCreateShader:
    var epoxy_glCreateShader: CPointer<CFunction<(GLenum) -> GLuint>>?
        get() = interpretPointed<CPointerVar<CFunction<(GLenum) -> GLuint>>>(kniBridge423()).value
        set(value) { interpretPointed<CPointerVar<CFunction<(GLenum) -> GLuint>>>(kniBridge423()).value = value }
    Here the .def file I used with cinterop :
    depends = posix
    package = epoxy
    headers = epoxy/gl.h epoxy/glx.h
    headerFilter = epoxy/**
    linkerOpts = -lepoxy
    compilerOpts.linux = -I/usr/include
    Did you have any idea ?
    o
    m
    • 3
    • 5
  • i

    itnoles

    12/31/2017, 8:34 PM
    Do I need to create a stub file for UITableViewCell ?
    o
    • 2
    • 1
  • s

    spierce7

    01/02/2018, 5:21 AM
    I read a few weeks ago that the current threading model in kotlin-native would probably not be the same model with the 1.0 release. Has that been discussed any further, and are there any details about what may change before the official release?
    m
    s
    +5
    • 8
    • 10
  • s

    Soslan

    01/02/2018, 5:33 PM
    Hello, i'm trying to produce framework from .kt file(For some reason it doesn't produce it from jar file) But ios project doesn't build, compilation fails with architecture error . Do you have any idea how to fix it?
    ld: warning: ignoring file /Users/admin/Downloads/kotlin-native-master/samples/calculator/build/konan/bin/xcode/test.framework/test, file was built for x86_64 which is not the architecture being linked (arm64): /Users/admin/Downloads/kotlin-native-master/samples/calculator/build/konan/bin/xcode/test.framework/test
    Undefined symbols for architecture arm64:
     “_OBJC_CLASS_$_Test”, referenced from:
         objc-class-ref in ViewController.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    o
    • 2
    • 2
  • f

    ftomassetti

    01/02/2018, 5:44 PM
    I wonder what is the current status of the Wasm target and CLion. Maybe I would have better luck running the compiler manually without using CMake…
    o
    • 2
    • 3
  • c

    christophsturm

    01/02/2018, 7:01 PM
    https://tbfleming.github.io/cib/ not really kotlin related but if the kotlin compiler could run without a jvm this would be possible with kotlin too
    p
    • 2
    • 2
  • n

    nish

    01/03/2018, 1:12 AM
    are you asking if kotlin native supports wasm?
    f
    o
    n
    • 4
    • 3
  • j

    jo

    01/03/2018, 6:02 AM
    Is static library production supported on Windows?
    o
    • 2
    • 1
  • a

    andreasmattsson

    01/05/2018, 4:17 PM
    Hrmm... Doing some quick tests in kotlin native and noticing that
    platform.posix.usleep
    doesn't seem to do anything on Windows/mingw (no errors, no wait, just continues execution immediately) Is this expected behavior? On linux (WSL/Ubuntu on Windows) the same code works as expected.
    o
    • 2
    • 1
  • a

    alexcouch

    01/07/2018, 7:36 AM
    So is there some kind of docs for kotlin native that I can refer to in regards to importing libraries and using cmake to build and compile kotlin projects?
    o
    g
    +2
    • 5
    • 8
  • s

    Sam

    01/07/2018, 3:42 PM
    Being new to Gradle, is there a blog or reference article that walks me through setting it up to work with K/N?
    n
    h
    • 3
    • 3
  • r

    russhwolf

    01/07/2018, 7:55 PM
    If CMake isn't the long-term build solution, does that mean CLion won't be the long-term IDE?
    o
    l
    i
    • 4
    • 3
  • s

    salomonbrys

    01/08/2018, 10:08 AM
    When I diff the content of the same lib built for 2 different targets, the
    linkdata/module_data_flow_graph
    differs, so I'm not sure I can manually "merge" two klibs.
    o
    • 2
    • 3
  • b

    benny.huo

    01/10/2018, 12:46 PM
    Waiting for interop for jvm. 😁
    ➕ 3
    m
    g
    +3
    • 6
    • 16
  • s

    salomonbrys

    01/10/2018, 7:19 PM
    Hi guys, do you know how to add a KLib file to a CMake project ?
    o
    a
    • 3
    • 2
  • t

    Tristan Caron

    01/12/2018, 11:19 AM
    Is kotlin native supported by IDEA Ultimate?
    o
    k
    • 3
    • 3
  • r

    rwachol

    01/12/2018, 2:22 PM
    hello I tried to play with koltin native and got stuck with this:
    > target-sysroot-3-darwin-ios is not available; candidates:
      org.jetbrains.kotlin.konan.util.DependencySource$Remote$Internal@59336ce2
      Local(path=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk)
      Local(path=)
    o
    • 2
    • 3
  • c

    colintheshots

    01/13/2018, 2:09 PM
    I'm trying to build the KotlinConf iOS app and I keep getting fatal error: 'helperlib/helperlib.h' file not found. The file is clearly sitting right there in the filesystem. Why isn't gradle seeing it? The same thing seems to happen with a number of the kotlin-native samples where it can't find headers.
    o
    • 2
    • 1
  • a

    albertgao

    01/13/2018, 8:40 PM
    What kotlin apis can be compiled with kotlin native? do Kotlin-stdlib and kotlin-reflect on the list?
    l
    o
    s
    • 4
    • 7
  • r

    rootandy

    01/15/2018, 12:12 PM
    old gradle syntax was like
    konan.targets = ['iphone', 'iphone_sim']
    
    konanArtifacts {
    framework('MyFramework')
    }
    g
    • 2
    • 3
  • s

    Simone Civetta

    01/17/2018, 12:03 PM
    Hi, is there a way to conditionally compile blocks of code ? For instance :
    #if os(iOS)
        // My iOS-only code
    #endif
    or
    #if platform(framework)
        // My framework-only code
    #endif
    o
    b
    • 3
    • 2
  • s

    stepango

    01/18/2018, 4:54 AM
    Is it possible to access kotlin-native code from java using jni?
    o
    • 2
    • 1
  • a

    altavir

    01/18/2018, 4:19 PM
    I currently have some problems with using kotlin native with gradle in IDEA. What I am trying to do is to create a bridge between different languages using C API. I have this API in separate module. In kotlin-native module I have a
    def
    file in
    src/main/c_interop
    and expect to place kotlin files in
    src/main/kotlin
    . Now, I have a few problems. 1)
    def
    file does not accept relative header names. I have to declare absolute ones, which is not convenient. I remember seeing something about it in issues. Are there any fixes? 2)
    src/main/kotlin
    is not marked as a source tree. I can mark it myself in idea module options, but it resets itself after gradle sync. 3) generated interop headers are placed in build directory. I can't understand how to access them without creating a copy in the source tree. 4) IDE does not seem to recognize
    konan
    and
    kotlinx.cinterop
    packages. How can I load those. Can I do it at all?
    o
    i
    • 3
    • 3
Powered by Linen
Title
a

altavir

01/18/2018, 4:19 PM
I currently have some problems with using kotlin native with gradle in IDEA. What I am trying to do is to create a bridge between different languages using C API. I have this API in separate module. In kotlin-native module I have a
def
file in
src/main/c_interop
and expect to place kotlin files in
src/main/kotlin
. Now, I have a few problems. 1)
def
file does not accept relative header names. I have to declare absolute ones, which is not convenient. I remember seeing something about it in issues. Are there any fixes? 2)
src/main/kotlin
is not marked as a source tree. I can mark it myself in idea module options, but it resets itself after gradle sync. 3) generated interop headers are placed in build directory. I can't understand how to access them without creating a copy in the source tree. 4) IDE does not seem to recognize
konan
and
kotlinx.cinterop
packages. How can I load those. Can I do it at all?
o

olonho

01/19/2018, 7:27 AM
1) please use compiler options to specify library search path, like in https://github.com/JetBrains/kotlin-native/blob/1399ac9777a56f7263611fe2eac59b71b1a7f415/samples/videoplayer/build.gradle#L26
2-4) Idea is not supported for developing K/N apps yet
i

ilya.matveev

01/19/2018, 10:28 AM
Kotlin/Native has a preview support in CLion (including code completion/navigation for interop libraries) so you may use it. Here are some details: https://blog.jetbrains.com/kotlin/2017/11/kotlinnative-ide-support-preview/ Note that CLion uses CMake as a build system. You may translate your Gradle project into a CMake one by running
generateCMake
gradle task. Please try using CLion and give us feedback on it.
View count: 2