https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
l

Leon Kiefer

03/31/2024, 7:21 PM
Hi, I'm trying to add wasmJs target to my multiplatform project and now I'm stuck with this error message (see thread) which comes from running
wasmJsBrowserRun
. I'm on kotlin 1.9.23 and following the kotlin-wasm-examples. The project structure is: root -shared -mobile -web only web and shared have the
wasmJs
target and only web has
binaries.executable()
🧵 2
1
Copy code
:web:compileKotlinWasmJs FAILED	
e: Daemon compilation failed: null	
java.lang.Exception	
	at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:69)	
	at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:65)	
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:244)	
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:175)	
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:135)	
	at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:73)	
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)	
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)	
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)	
	at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)	
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)	
	at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)	
	at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)	
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)	
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)	
	at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)	
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)	
	at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:170)	
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)	
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)	
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)	
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)	
	at org.gradle.internal.Factories$1.create(Factories.java:31)	
	at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:264)	
	at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:128)	
	at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:133)	
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)	
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)	
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)	
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)	
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)	
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)	
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)	
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)	
	at java.base/java.lang.Thread.run(Thread.java:840)	
Caused by: java.lang.NullPointerException	
	at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.destinationDir(IncrementalJsCompilerRunner.kt:116)	
	at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.destinationDir(IncrementalJsCompilerRunner.kt:86)	
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:264)	
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:125)	
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile$default(IncrementalCompilerRunner.kt:109)	
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execJsIncrementalCompiler(CompileServiceImpl.kt:579)	
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execJsIncrementalCompiler(CompileServiceImpl.kt:105)	
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1715)	
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)	
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)	
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)	
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)	
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)	
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)	
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)	
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)	
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)	
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)	
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)	
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)	
	... 3 more	
Failed to compile with Kotlin daemon: java.lang.Exception	
	at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:69)	
	at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:65)	
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:244)	
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:175)	
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:135)	
	at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:73)	
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)	
...
Caused by: java.lang.NullPointerException	
	at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.destinationDir(IncrementalJsCompilerRunner.kt:116)	
	at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.destinationDir(IncrementalJsCompilerRunner.kt:86)	
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:264)	
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:125)	
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile$default(IncrementalCompilerRunner.kt:109)	
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execJsIncrementalCompiler(CompileServiceImpl.kt:579)	
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execJsIncrementalCompiler(CompileServiceImpl.kt:105)	
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1715)	
...
	... 3 more	
Using fallback strategy: Compile without Kotlin daemon	
Try ./gradlew --stop if this issue persists.	
exception: error: IR: Specify output dir via -ir-output-dir	
exception: error: old Kotlin/JS compiler is no longer supported. Please migrate to the new JS IR backend
I fixed the problem. I had the following in my gradle config:
Copy code
kotlinOptions {
                freeCompilerArgs = listOf("-Xexpect-actual-classes")
            }
I needed it to change to:
Copy code
kotlinOptions {
                freeCompilerArgs += listOf("-Xexpect-actual-classes")
            }
to ensure not to override the default compiler args, which are critical for the js compilation.
w

William Walker

04/03/2024, 12:05 AM
Thanks for sharing!
4 Views