https://kotlinlang.org logo
#webassembly
Title
# webassembly
a

Adrian K

10/25/2023, 6:44 AM
When I'm trying to build
compose-imageviewer
from
kotlin-wasm-examples
I'm getting
java.lang.IllegalStateException: e: Could not find "/home/me/kt/kotlin-wasm-examples/compose-imageviewer/shared/build/kotlinTransformedMetadataLibraries/jsWasmMain/org.jetbrains.skiko-skiko-0.0.7.80-wasm01-jsWasmMain-mF0BDQ.klib" in [/home/me/.local/share/kotlin/daemon]
but if I check this path I can see that file, with the same name... any ideas?
o

Oleksandr Karpovich [JB]

10/25/2023, 9:33 AM
What kotlin version do you use? Please try with the latest commit in the main branch - https://github.com/Kotlin/kotlin-wasm-examples/commit/053feef9962718138ab723fbf8199e204a817052
a

Adrian K

10/25/2023, 9:37 AM
gradle.properties shows
kotlin.version=1.9.20-RC
I am using latest commit, I'm using Ubuntu if that's important
o

Oleksandr Karpovich [JB]

10/25/2023, 9:38 AM
hm. I'm on Ubuntu too. Tried to run it again right before commenting here.
./gradlew wasmJsBrowserRun
what gradle task do you run? Do you simply run or doing something else?
a

Adrian K

10/25/2023, 9:40 AM
I'm running
build
from
imageviewer
project (directly from intellij). all other projects are building fine, but that
shared
one fails in
compileJsWasmMainKotlinMetadata
because of that one file
o

Oleksandr Karpovich [JB]

10/25/2023, 9:41 AM
I see. Adding this in shared/build.gradle.kts should help:
Copy code
project.tasks.whenTaskAdded {
        if (name == "compileJsWasmMainKotlinMetadata") {
            enabled = false
        }
    }
a

Adrian K

10/25/2023, 9:43 AM
So let me give you some background, because maybe that's not the main issue: I tried to run
wasmJsBrowserRun
task and it works fine. The problem is that none browser actually works. In firefox I'm getting
Copy code
wasm validation error: at offset 406: bad type
and in chrome
Copy code
WebAssembly.instantiateStreaming(): invalid value type 0x71 @+405
CompileError: WebAssembly.instantiateStreaming(): invalid value type 0x71 @+405
I have enabled GC on both browsers and the webassembly page shows that GC is enabled, that's why I thought there is some build issue
o

Oleksandr Karpovich [JB]

10/25/2023, 9:44 AM
the latest kotlin/wasm requires a dev/nightly version of Chrome (probably for firefox too) https://www.google.com/chrome/dev
a

Adrian K

10/25/2023, 9:47 AM
Ok, that worked for Chrome. Thanks a lot! I didn't know that nightly builds are required because GC options are there in release builds
👍 2
o

Oleksandr Karpovich [JB]

10/25/2023, 9:48 AM
1.9.20-RC uses new wasm opcodes which are currently supported only in Chrome 119 and newer (dev and beta, iirc)
I agree that it's not obvious
a

Adrian K

10/25/2023, 9:50 AM
Is this mentioned anywhere in documentation? I missed that info or it's not mentioned since it's experimental feature and there is no need to document everything? I think it would be nice to at least add it to the repository readme.md
o

Oleksandr Karpovich [JB]

10/25/2023, 9:51 AM
you are right, we'll mention it in readme.md
a

Adrian K

10/25/2023, 9:52 AM
Awesome! And thank you once again with that problem!
👍 1